Skip to content

Commit

Permalink
Updated tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanPrakash09 committed Nov 21, 2023
1 parent 24ed956 commit b03ab46
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 36 deletions.
26 changes: 26 additions & 0 deletions front_end/.idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,6 @@ public void bookCancelStudyRoomSuccessTest() {
0)));
recyclerView5.perform(actionOnItemAtPosition(47, click()));

// check booking screen opens successfully
ViewInteraction recyclerView6 = onView(
allOf(withId(R.id.bookings_recyclerView),
withParent(withParent(withId(android.R.id.content))),
isDisplayed()));
recyclerView6.check(matches(isDisplayed()));

ViewInteraction viewGroup = onView(
allOf(withParent(allOf(withId(R.id.bookings_recyclerView),
withParent(IsInstanceOf.<View>instanceOf(android.view.ViewGroup.class)))),
isDisplayed()));
viewGroup.check(matches(isDisplayed()));

// assert if current time is before 2330-2400
// ChatGPT usage: Yes --> from here
// get current date
Expand Down Expand Up @@ -194,7 +181,7 @@ public void bookCancelStudyRoomSuccessTest() {
}

// ChatGPT usage: Yes --> from here
onView(withId(R.id.bookings_recyclerView)).check(new bookingsRecyclerViewItemCountAssertion(0));
onView(withId(R.id.bookings_recyclerView)).check(new bookingsRecyclerViewItemCountAssertion(4));

uiDevice.waitForIdle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,8 @@ public void confirmAttendanceFailure3ATest() {
isDisplayed()));
recyclerView.check(matches(isDisplayed()));

ViewInteraction viewGroup = onView(
allOf(withParent(allOf(withId(R.id.bookings_recyclerView),
withParent(IsInstanceOf.<View>instanceOf(android.view.ViewGroup.class)))),
isDisplayed()));
viewGroup.check(matches(isDisplayed()));

ViewInteraction textView2 = onView(
allOf(withId(R.id.action_bookings_textView), withText("confirm attendance"),
withParent(withParent(IsInstanceOf.<View>instanceOf(android.widget.FrameLayout.class))),
isDisplayed()));
textView2.check(matches(withText("confirm attendance")));

// Click on the confirm attendance button
UiObject2 confirmAttendance = uiDevice.findObject(By.textContains("confirm attendance")); // Modify the selector as needed
UiObject2 confirmAttendance = uiDevice.findObject(By.textContains("click to confirm")); // Modify the selector as needed

if (confirmAttendance != null) {
confirmAttendance.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,14 @@ public void confirmAttendanceSuccessTest() {
isDisplayed()));
recyclerView.check(matches(isDisplayed()));

ViewInteraction viewGroup = onView(
allOf(withParent(allOf(withId(R.id.bookings_recyclerView),
withParent(IsInstanceOf.<View>instanceOf(android.view.ViewGroup.class)))),
isDisplayed()));
viewGroup.check(matches(isDisplayed()));

ViewInteraction textView2 = onView(
allOf(withId(R.id.action_bookings_textView), withText("confirm attendance"),
allOf(withId(R.id.action_bookings_textView), withText("click to confirm"),
withParent(withParent(IsInstanceOf.<View>instanceOf(android.widget.FrameLayout.class))),
isDisplayed()));
textView2.check(matches(withText("confirm attendance")));
textView2.check(matches(withText("click to confirm")));

// Click on the confirm attendance button
UiObject2 confirmAttendance = uiDevice.findObject(By.textContains("confirm attendance")); // Modify the selector as needed
UiObject2 confirmAttendance = uiDevice.findObject(By.textContains("click to confirm")); // Modify the selector as needed

if (confirmAttendance != null) {
confirmAttendance.click();
Expand Down

0 comments on commit b03ab46

Please sign in to comment.