From b03ab46b87d4b984ec2aad344fb0a5137762ceb6 Mon Sep 17 00:00:00 2001 From: AmanPrakash09 Date: Mon, 20 Nov 2023 23:52:17 -0800 Subject: [PATCH] Updated tests. --- .../androidTestResultsUserPreferences.xml | 26 +++++++++++++++++++ .../BookCancelStudyRoomSuccessTest.java | 15 +---------- .../ConfirmAttendanceFailure3ATest.java | 14 +--------- .../ConfirmAttendanceSuccessTest.java | 12 +++------ 4 files changed, 31 insertions(+), 36 deletions(-) diff --git a/front_end/.idea/androidTestResultsUserPreferences.xml b/front_end/.idea/androidTestResultsUserPreferences.xml index ab567055..179293d7 100644 --- a/front_end/.idea/androidTestResultsUserPreferences.xml +++ b/front_end/.idea/androidTestResultsUserPreferences.xml @@ -56,6 +56,32 @@ + + + + + + + + + + + + + + diff --git a/front_end/app/src/androidTest/java/com/javajedis/bookit/bookCancelStudyRoomsUseCase/BookCancelStudyRoomSuccessTest.java b/front_end/app/src/androidTest/java/com/javajedis/bookit/bookCancelStudyRoomsUseCase/BookCancelStudyRoomSuccessTest.java index befcba41..3a59c296 100644 --- a/front_end/app/src/androidTest/java/com/javajedis/bookit/bookCancelStudyRoomsUseCase/BookCancelStudyRoomSuccessTest.java +++ b/front_end/app/src/androidTest/java/com/javajedis/bookit/bookCancelStudyRoomsUseCase/BookCancelStudyRoomSuccessTest.java @@ -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.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 @@ -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(); diff --git a/front_end/app/src/androidTest/java/com/javajedis/bookit/confirmAttendanceUseCase/ConfirmAttendanceFailure3ATest.java b/front_end/app/src/androidTest/java/com/javajedis/bookit/confirmAttendanceUseCase/ConfirmAttendanceFailure3ATest.java index 52c9fb2f..796956a1 100644 --- a/front_end/app/src/androidTest/java/com/javajedis/bookit/confirmAttendanceUseCase/ConfirmAttendanceFailure3ATest.java +++ b/front_end/app/src/androidTest/java/com/javajedis/bookit/confirmAttendanceUseCase/ConfirmAttendanceFailure3ATest.java @@ -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.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.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(); diff --git a/front_end/app/src/androidTest/java/com/javajedis/bookit/confirmAttendanceUseCase/ConfirmAttendanceSuccessTest.java b/front_end/app/src/androidTest/java/com/javajedis/bookit/confirmAttendanceUseCase/ConfirmAttendanceSuccessTest.java index f23ea3bb..500b597b 100644 --- a/front_end/app/src/androidTest/java/com/javajedis/bookit/confirmAttendanceUseCase/ConfirmAttendanceSuccessTest.java +++ b/front_end/app/src/androidTest/java/com/javajedis/bookit/confirmAttendanceUseCase/ConfirmAttendanceSuccessTest.java @@ -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.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.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();