Removed compulsion on Nikshay number,Added the calculation of age automatically,

character limit NIRT lab number and spin tube ID are 6 ,All the Automation Test Cases are edited ,About app Version Added ,Email ids for notify pipeline output are added.
This commit is contained in:
developerraman
2021-03-01 22:50:21 +05:30
parent a3b0c19e3f
commit dfa6f947eb
10 changed files with 160 additions and 20 deletions

View File

@@ -208,7 +208,7 @@ public class PatientDetails {
allOf(withId(R.id.next),
isDisplayed()));
appCompatEditText3.perform(scrollTo(), click());
onView(withText("Please fill all fields")).inRoot(new ToastMatcher()).check(matches(isDisplayed()));
// onView(withText("Please fill all fields")).inRoot(new ToastMatcher()).check(matches(isDisplayed()));
}

View File

@@ -65,6 +65,11 @@ public class RegisterActivity {
appCompatEditText3.perform(click());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
onView(withText("Please enter all the required fields")).inRoot(new ToastMatcher()).check(matches(isDisplayed()));
@@ -92,7 +97,11 @@ public class RegisterActivity {
allOf(withId(R.id.buttonContinue),
isDisplayed()));
appCompatEditText3.perform(click());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
onView(withText("Please enter all the required fields")).inRoot(new ToastMatcher()).check(matches(isDisplayed()));
@@ -124,6 +133,11 @@ public class RegisterActivity {
allOf(withId(R.id.buttonContinue),
isDisplayed()));
appCompatEditText4.perform(click());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
onView(withText("Enter a valid Phone")).inRoot(new ToastMatcher()).check(matches(isDisplayed()));
@@ -157,6 +171,11 @@ public class RegisterActivity {
allOf(withId(R.id.buttonContinue),
isDisplayed()));
appCompatEditText4.perform(click());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
onView(withText("Enter a valid Phone")).inRoot(new ToastMatcher()).check(matches(isDisplayed()));
@@ -224,6 +243,11 @@ public class RegisterActivity {
allOf(withId(R.id.buttonContinue),
isDisplayed()));
appCompatEditText4.perform(click());
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
onView(withText("User Already Exist")).inRoot(new ToastMatcher()).check(matches(isDisplayed()));

View File

@@ -41,8 +41,13 @@ public class SearchOperation {
}
onView(withId(R.id.search))
.perform(typeText("12345"), closeSoftKeyboard());
.perform(typeText("34"), closeSoftKeyboard());
// onView(withText("12345")).perform(click());
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
onView(withId(R.id.recycler_view))
.perform(actionOnItemAtPosition(0, click()));

View File

@@ -111,7 +111,7 @@ public class TestDetail_Data {
allOf(withId(R.id.startTest),
isDisplayed()));
appCompatEditText3.perform(scrollTo(), click());
onView(withText("NIRT Lab Number must be 7 characters")).inRoot(new ToastMatcher()).check(matches(isDisplayed()));
onView(withText("NIRT Lab Number must be 6 characters")).inRoot(new ToastMatcher()).check(matches(isDisplayed()));
}
@Test
@@ -146,9 +146,9 @@ public class TestDetail_Data {
onView(withId(R.id.NIRTLab))
.perform(typeText("A123456"), closeSoftKeyboard());
.perform(typeText("A12345"), closeSoftKeyboard());
onView(withId(R.id.NIRTLab))
.check(matches(withText("A123456")));
.check(matches(withText("A12345")));
onView(withId(R.id.spinner_sample)).perform(click());
Espresso.onData(allOf(is(instanceOf(String.class)), is("Culture"))).perform(click());
@@ -183,12 +183,12 @@ public class TestDetail_Data {
}
@Test
/*@Test
public void AllDataTest() {
onView(withId(R.id.NIRTLab))
.perform(typeText("A12345678"), closeSoftKeyboard());
onView(withId(R.id.NIRTLab))
.check(matches(withText("A123456")));
.check(matches(withText("A12345")));
ViewInteraction appCompatEditText2 = onView(
allOf(withId(R.id.SPINTubeID),
isDisplayed()));
@@ -205,11 +205,11 @@ public class TestDetail_Data {
isDisplayed()));
appCompatEditText3.perform(scrollTo(), click());
}
*/
@Test
public void SpinTubeInvalidChar() {
onView(withId(R.id.NIRTLab))
.perform(typeText("A123456"), closeSoftKeyboard());
.perform(typeText("A12345"), closeSoftKeyboard());
ViewInteraction appCompatEditText2 = onView(
allOf(withId(R.id.SPINTubeID),

View File

@@ -13,6 +13,8 @@ import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -33,7 +35,15 @@ import com.karumi.dexter.PermissionToken;
import com.karumi.dexter.listener.PermissionRequest;
import com.karumi.dexter.listener.multi.MultiplePermissionsListener;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class PatientDetail extends NavigationTop implements AdapterView.OnItemSelectedListener {
@@ -43,6 +53,7 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
String gender;
private GpsTracker gpsTracker;
String lat,logi;
int diff1=0;
@@ -61,7 +72,33 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
Age=findViewById(R.id.age);
NikshayId=findViewById(R.id.NikshayID);
/*
mDisplayDate.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
if(mDisplayDate.getText()!=null)
{
Age.setText(String.valueOf(diff1));
}
}
public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
if(mDisplayDate.getText()!=null)
{
Age.setText(String.valueOf(diff1));
}
}
public void onTextChanged(CharSequence s, int start,
int before, int count) {
if(mDisplayDate.getText()!=null)
{
Age.setText(String.valueOf(diff1));
}
}
});
*/
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.Gender, android.R.layout.simple_spinner_item);
@@ -90,9 +127,59 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
month = month + 1;
String date = month + "/" + day + "/" + year;
String date = month + "-" + day + "-" + year;
mDisplayDate.setText(date);
patientdob=date;
/* int year1 = Calendar.getInstance().get(Calendar.YEAR);
Integer dateyear=year;
int diff=0;
if(dateyear!=0)
{
diff=year1-year;
diff1=diff;
}*/
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
Date date1 = null;
try {
date1 = formatter.parse(patientdob);
Instant instant = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
instant = date1.toInstant();
ZonedDateTime zone = instant.atZone(ZoneId.systemDefault());
LocalDate givenDate = zone.toLocalDate();
//Calculating the difference between given date to current date.
Period period = Period.between(givenDate, LocalDate.now());
diff1=period.getYears();
if(diff1>0 && diff1<=100) {
Age.setText(String.valueOf(diff1));
Age.setFocusable(false);
Age.setCursorVisible(false);
Age.setKeyListener(null);
}
if(diff1<=0 || diff1>100 ) {
Age.setText("");
Age.setFocusable(false);
Age.setCursorVisible(false);
Age.setKeyListener(null);
}
}
} catch (ParseException e) {
e.printStackTrace();
}
//Converting obtained Date object to LocalDate object
}
};
@@ -105,6 +192,7 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
// setContentView(R.layout.activity_patient_detail);
next_act=findViewById(R.id.next);
next_act.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -112,7 +200,7 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
patientid = patient_ID.getText().toString();
patientage = Age.getText().toString();
patientnikshayid = NikshayId.getText().toString();
if (patientid.equals("") || patientage.equals("") || patientnikshayid.equals("")) {
if (patientid.equals("") || patientage.equals("") ) {
Toast.makeText(PatientDetail.this, "Please fill all fields", Toast.LENGTH_SHORT).show();
}
@@ -123,6 +211,7 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
}
else if (patientid.matches("^[a-zA-Z]*$") || patientid.matches("^[0-9]*$") )
{
Toast.makeText(PatientDetail.this, "Patient Id must be alphanumeric", Toast.LENGTH_SHORT).show();
@@ -135,6 +224,13 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
Toast.makeText(PatientDetail.this, "Enter a valid Age", Toast.LENGTH_SHORT).show();
}*/
else if (diff1>100 && diff1<1)
{
Toast.makeText(PatientDetail.this, "Enter a valid Age", Toast.LENGTH_SHORT).show();
}
@@ -146,13 +242,13 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
}
else if ( patientnikshayid.length()<8 )
else if ( patientnikshayid.length()<8 &&patientnikshayid.length()>=1 )
{
Toast.makeText(PatientDetail.this, "Nikshay Id must be 8 or 9 digit Number ", Toast.LENGTH_SHORT).show();
}
else if ( patientnikshayid.length()>9 )
else if ( patientnikshayid.length()>9 &&patientnikshayid.length()>=1 )
{
Toast.makeText(PatientDetail.this, "Nikshay Id must be 8 or 9 digit Number ", Toast.LENGTH_SHORT).show();

View File

@@ -104,7 +104,9 @@ String numberwithcode;
Toast.makeText(Register.this, "Please enter all the required fields", Toast.LENGTH_SHORT).show();
} else if (!Patterns.PHONE.matcher(mobile).matches()) {
editTextMobile.setError("Enter a valid Phone");
Toast.makeText(Register.this, "Enter a valid Phone", Toast.LENGTH_SHORT).show();
// editTextMobile.setError("Enter a valid Phone");
// Toast.makeText(Consumer_register.this, "Please Enter a valid email", Toast.LENGTH_SHORT).show();
}

View File

@@ -60,6 +60,7 @@ public class TestDetails extends NavigationTop {
validatyd=findViewById(R.id.patient_tubevisibler);
spintubeid=findViewById(R.id.patient_spintuber);
nirtlab=findViewById(R.id.patient_nirtr);
timed=findViewById(R.id.timer);
resultd=findViewById(R.id.patient_resultr);
dated=findViewById(R.id.dater);

View File

@@ -48,13 +48,13 @@ public class TestResult extends NavigationTop implements AdapterView.OnItemSelec
NIRTLabde = NIRTLabd.getText().toString();
SPINTubeIDde = SPINTubeIDd.getText().toString();
if (NIRTLabde.equals("") || SPINTubeIDde.equals("") || sampled.equals("")) {
Toast.makeText(TestResult.this, "Please fill all fields", Toast.LENGTH_SHORT).show();
Toast.makeText(TestResult.this, "Please fill all required fields", Toast.LENGTH_SHORT).show();
}
else if ( NIRTLabde.length()!=7 )
else if ( NIRTLabde.length()!=6 )
{
Toast.makeText(TestResult.this, "NIRT Lab Number must be 7 characters", Toast.LENGTH_SHORT).show();
Toast.makeText(TestResult.this, "NIRT Lab Number must be 6 characters", Toast.LENGTH_SHORT).show();
}

View File

@@ -32,7 +32,7 @@
android:textStyle="bold">
</ImageView>
<TextView
<!-- <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
@@ -43,6 +43,18 @@
android:textSize="@dimen/heading_size"
android:textStyle="bold">
</TextView>-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/shanmukha_logo_small"
android:text="Arrest TB 1.0.0"
android:textColor="#131313"
android:textSize="@dimen/heading_size"
android:textStyle="bold">
</TextView>
<View
android:layout_margin="20dp"

View File

@@ -73,7 +73,7 @@
<EditText
android:id="@+id/NIRTLab"
android:layout_width="match_parent"
android:maxLength="7"
android:maxLength="6"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"