diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/DashboardE2ETest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/DashboardE2ETest.kt index e0fe3bcffa..1f50e7b9ac 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/DashboardE2ETest.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/DashboardE2ETest.kt @@ -101,11 +101,11 @@ class DashboardE2ETest : StudentTest() { dashboardPage.assertDisplaysGroup(group2, course1) Log.d(STEP_TAG,"Click on 'All Courses' button. Assert that the All Courses Page is loaded.") - dashboardPage.clickEditDashboard() - editDashboardPage.assertPageObjects() + dashboardPage.openAllCoursesPage() + allCoursesPage.assertPageObjects() Log.d(STEP_TAG, "Favorite '${course1.name}' course and navigate back to Dashboard Page.") - editDashboardPage.favoriteCourse(course1.name) + allCoursesPage.favoriteCourse(course1.name) Espresso.pressBack() Log.d(STEP_TAG,"Assert that only the favoured course, '${course1.name}' is displayed." + @@ -124,16 +124,16 @@ class DashboardE2ETest : StudentTest() { Log.d(STEP_TAG,"Click on 'All Courses' button. Assert that the All Courses Page is loaded.") dashboardPage.assertPageObjects() - dashboardPage.clickEditDashboard() - editDashboardPage.assertPageObjects() + dashboardPage.openAllCoursesPage() + allCoursesPage.assertPageObjects() Log.d(STEP_TAG, "Assert that the mass select button's text is 'Unselect All', since one of the courses is selected.") - editDashboardPage.assertCourseMassSelectButtonIsDisplayed(true) + allCoursesPage.assertCourseMassSelectButtonIsDisplayed(true) Log.d(STEP_TAG, "Toggle off favourite star icon of '${course1.name}' course." + "Assert that the 'mass' select button's label is 'Select All'.") - editDashboardPage.unfavoriteCourse(course1.name) - editDashboardPage.assertCourseMassSelectButtonIsDisplayed(false) + allCoursesPage.unfavoriteCourse(course1.name) + allCoursesPage.assertCourseMassSelectButtonIsDisplayed(false) Log.d(STEP_TAG, "Navigate back to Dashboard Page.") Espresso.pressBack() @@ -186,15 +186,15 @@ class DashboardE2ETest : StudentTest() { dashboardPage.assertCourseGrade(course2.name, "N/A") Log.d(STEP_TAG,"Click on 'All Courses' button.") - dashboardPage.clickEditDashboard() - editDashboardPage.assertPageObjects() + dashboardPage.openAllCoursesPage() + allCoursesPage.assertPageObjects() Log.d(STEP_TAG, "Assert that the group 'mass' select button's label is 'Select All'.") - editDashboardPage.swipeUp() - editDashboardPage.assertGroupMassSelectButtonIsDisplayed(false) + allCoursesPage.swipeUp() + allCoursesPage.assertGroupMassSelectButtonIsDisplayed(false) Log.d(STEP_TAG, "Favorite '${group.name}' course and navigate back to Dashboard Page.") - editDashboardPage.favoriteGroup(group.name) + allCoursesPage.favoriteGroup(group.name) Espresso.pressBack() Log.d(STEP_TAG,"Assert that only the favoured group, '${group.name}' is displayed." + @@ -203,18 +203,18 @@ class DashboardE2ETest : StudentTest() { dashboardPage.assertGroupNotDisplayed(group2) Log.d(STEP_TAG,"Click on 'All Courses' button.") - dashboardPage.clickEditDashboard() - editDashboardPage.assertPageObjects() + dashboardPage.openAllCoursesPage() + allCoursesPage.assertPageObjects() Thread.sleep(2000) //It can be flaky without this 2 seconds - editDashboardPage.swipeUp() + allCoursesPage.swipeUp() Log.d(STEP_TAG, "Assert that the group 'mass' select button's label is 'Unselect All'.") - editDashboardPage.assertGroupMassSelectButtonIsDisplayed(true) + allCoursesPage.assertGroupMassSelectButtonIsDisplayed(true) Log.d(STEP_TAG, "Toggle off favourite star icon of '${group.name}' group." + "Assert that the 'mass' select button's label is 'Select All'.") - editDashboardPage.unfavoriteGroup(group.name) - editDashboardPage.assertGroupMassSelectButtonIsDisplayed(false) + allCoursesPage.unfavoriteGroup(group.name) + allCoursesPage.assertGroupMassSelectButtonIsDisplayed(false) Log.d(STEP_TAG, "Navigate back to Dashboard Page.") Espresso.pressBack() diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/TodoE2ETest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/TodoE2ETest.kt index 4968c7105f..103b61215f 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/TodoE2ETest.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/TodoE2ETest.kt @@ -120,8 +120,8 @@ class TodoE2ETest: StudentTest() { Log.d(STEP_TAG, "Navigate back to the Dashboard Page. Open ${favoriteCourse.name} course. Mark it as favorite.") Espresso.pressBack() - dashboardPage.clickEditDashboard() - editDashboardPage.favoriteCourse(favoriteCourse.name) + dashboardPage.openAllCoursesPage() + allCoursesPage.favoriteCourse(favoriteCourse.name) Log.d(STEP_TAG, "Navigate back to the Dashboard Page and open the To Do Page again.") Espresso.pressBack() diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineAllCoursesE2ETest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineAllCoursesE2ETest.kt new file mode 100644 index 0000000000..8eaceb62d5 --- /dev/null +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineAllCoursesE2ETest.kt @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2023 - present Instructure, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package com.instructure.student.ui.e2e.offline + +import android.util.Log +import androidx.test.espresso.Espresso +import androidx.test.espresso.matcher.ViewMatchers +import com.google.android.material.checkbox.MaterialCheckBox +import com.instructure.canvas.espresso.OfflineE2E +import com.instructure.panda_annotations.FeatureCategory +import com.instructure.panda_annotations.Priority +import com.instructure.panda_annotations.SecondaryFeatureCategory +import com.instructure.panda_annotations.TestCategory +import com.instructure.panda_annotations.TestMetaData +import com.instructure.student.ui.utils.StudentTest +import com.instructure.student.ui.utils.seedData +import com.instructure.student.ui.utils.tokenLogin +import dagger.hilt.android.testing.HiltAndroidTest +import org.junit.After +import org.junit.Test +import java.lang.Thread.sleep + +@HiltAndroidTest +class OfflineAllCoursesE2ETest : StudentTest() { + override fun displaysPageObjects() = Unit + + override fun enableAndConfigureAccessibilityChecks() = Unit + + @OfflineE2E + @Test + @TestMetaData(Priority.MANDATORY, FeatureCategory.DASHBOARD, TestCategory.E2E, false, SecondaryFeatureCategory.ALL_COURSES) + fun testOfflineAllCoursesE2E() { + + Log.d(PREPARATION_TAG, "Seeding data.") + val data = seedData(students = 1, teachers = 1, courses = 3, announcements = 1) + val student = data.studentsList[0] + val course1 = data.coursesList[0] + val course2 = data.coursesList[1] + val course3 = data.coursesList[2] + + Log.d(STEP_TAG, "Login with user: ${student.name}, login id: ${student.loginId}.") + tokenLogin(student) + dashboardPage.waitForRender() + + Log.d(STEP_TAG, "Open the 'All Courses' page and wait for it to be rendered.") + dashboardPage.openAllCoursesPage() + allCoursesPage.assertPageObjects() + + Log.d(STEP_TAG, "Favourite '${course1.name}' course and assert if it became favourited. Then navigate back to Dashboard page.") + allCoursesPage.favoriteCourse(course1.name) + allCoursesPage.assertCourseFavorited(course1) + Espresso.pressBack() + + Log.d(STEP_TAG, "Open global 'Manage Offline Content' page via the more menu of the Dashboard Page.") + dashboardPage.openGlobalManageOfflineContentPage() + manageOfflineContentPage.assertPageObjects() + + Log.d(STEP_TAG, "Assert that the '${course1.name}' course's checkbox state is 'Unchecked'.") + manageOfflineContentPage.assertCheckedStateOfItem(course1.name, MaterialCheckBox.STATE_UNCHECKED) + manageOfflineContentPage.assertCheckedStateOfItem(course2.name, MaterialCheckBox.STATE_UNCHECKED) + + Log.d(STEP_TAG, "Select '${course1.name}' and '${course2.name}' courses' checkboxes and Sync them.") + manageOfflineContentPage.changeItemSelectionState(course1.name) + manageOfflineContentPage.changeItemSelectionState(course2.name) + manageOfflineContentPage.clickOnSyncButtonAndConfirm() + + Log.d(STEP_TAG, "Wait for the 'Download Started' dashboard notification to be displayed, and the to disappear.") + dashboardPage.waitForRender() + dashboardPage.waitForSyncProgressDownloadStartedNotification() + dashboardPage.waitForSyncProgressDownloadStartedNotificationToDisappear() + + Log.d(STEP_TAG, "Wait for the 'Syncing Offline Content' dashboard notification to be displayed, and the to disappear. (It should be displayed after the 'Download Started' notification immediately.)") + dashboardPage.waitForSyncProgressStartingNotification() + dashboardPage.waitForSyncProgressStartingNotificationToDisappear() + + Log.d(PREPARATION_TAG, "Turn off the Wi-Fi and Mobile Data on the device, so it will go offline.") + turnOffConnectionViaADB() + + Log.d(STEP_TAG, "Wait for the Dashboard Page to be rendered, and assert that '${course1.name}' is the only course which is displayed on the offline mode Dashboard Page.") + dashboardPage.waitForRender() + sleep(10000) + dashboardPage.assertDisplaysCourse(course1) + dashboardPage.assertCourseNotDisplayed(course2) + dashboardPage.assertCourseNotDisplayed(course3) + + Log.d(STEP_TAG, "Open the 'All Courses' page and wait for it to be rendered.") + dashboardPage.openAllCoursesPage() + allCoursesPage.assertPageObjects() + + Log.d(STEP_TAG, "Assert that the plus 'Note' box is displayed in which warns the user that favouring courses can only be done in online mode.") + allCoursesPage.assertOfflineNoteDisplayed() + + Log.d(STEP_TAG, "Dismiss the offline 'Note' box and assert if it's disappear.") + allCoursesPage.dismissOfflineNoteBox() + allCoursesPage.assertOfflineNoteNotDisplayed() + + Log.d(STEP_TAG, "Assert that the select/unselect all button is not clickable because offline mode does not supports it.") + allCoursesPage.assertSelectUnselectAllButtonNotClickable() + + Log.d(STEP_TAG, "Try to unfavorite '${course1.name}' course and assert it does not happened because favoring does not allowed in offline state.") + allCoursesPage.unfavoriteCourse(course1.name) + allCoursesPage.assertCourseFavorited(course1) + + Log.d(STEP_TAG, "Assert that '${course3.name}' course's details are faded (and they having 0.4 alpha value) and it's offline sync icon is not displayed since it's not synced.") + allCoursesPage.assertCourseDetailsAlpha(course3.name, 0.4f) + allCoursesPage.assertCourseOfflineSyncButton(course3.name, ViewMatchers.Visibility.GONE) + + Log.d(STEP_TAG, "Assert that '${course1.name}' course's favourite star is faded (and it's having 0.4 alpha value) because favoring is not possible in offline mode," + + "the course title and open button are not faded (1.0 alpha value) and the offline sync icon is displayed since the course is synced.") + allCoursesPage.assertCourseFavouriteStarAlpha(course1.name, 0.4f) + allCoursesPage.assertCourseTitleAlpha(course1.name, 1.0f) + allCoursesPage.assertCourseOpenButtonAlpha(course1.name, 1.0f) + allCoursesPage.assertCourseOfflineSyncButton(course1.name, ViewMatchers.Visibility.VISIBLE) + + Log.d(STEP_TAG, "Click on '${course1.name}' course and assert if it will navigate the user to the CourseBrowser Page.") + allCoursesPage.openCourse(course1.name) + courseBrowserPage.assertTitleCorrect(course1) + + } + + @After + fun tearDown() { + Log.d(PREPARATION_TAG, "Turn back on the Wi-Fi and Mobile Data on the device, so it will come back online.") + turnOnConnectionViaADB() + } + +} \ No newline at end of file diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineCourseBrowserE2ETest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineCourseBrowserE2ETest.kt index 04a6fc4337..0c36ed3721 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineCourseBrowserE2ETest.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineCourseBrowserE2ETest.kt @@ -42,7 +42,7 @@ class OfflineCourseBrowserE2ETest : StudentTest() { @OfflineE2E @Test - @TestMetaData(Priority.MANDATORY, FeatureCategory.DASHBOARD, TestCategory.E2E) + @TestMetaData(Priority.MANDATORY, FeatureCategory.COURSE, TestCategory.E2E) fun testOfflineCourseBrowserPageUnavailableE2E() { Log.d(PREPARATION_TAG,"Seeding data.") diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/interaction/DashboardInteractionTest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/interaction/DashboardInteractionTest.kt index f02805dfff..e9ec0dcbb3 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/interaction/DashboardInteractionTest.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/interaction/DashboardInteractionTest.kt @@ -93,10 +93,10 @@ class DashboardInteractionTest : StudentTest() { dashboardPage.assertCourseNotShown(nonFavorite) dashboardPage.editFavorites() - editDashboardPage.assertCourseDisplayed(nonFavorite) - editDashboardPage.assertCourseNotFavorited(nonFavorite) - editDashboardPage.favoriteCourse(nonFavorite) - editDashboardPage.assertCourseFavorited(nonFavorite) + allCoursesPage.assertCourseDisplayed(nonFavorite) + allCoursesPage.assertCourseNotFavorited(nonFavorite) + allCoursesPage.favoriteCourse(nonFavorite) + allCoursesPage.assertCourseFavorited(nonFavorite) Espresso.pressBack() @@ -115,10 +115,10 @@ class DashboardInteractionTest : StudentTest() { dashboardPage.assertDisplaysCourse(favorite) dashboardPage.editFavorites() - editDashboardPage.assertCourseDisplayed(favorite) - editDashboardPage.assertCourseFavorited(favorite) - editDashboardPage.unfavoriteCourse(favorite) - editDashboardPage.assertCourseNotFavorited(favorite) + allCoursesPage.assertCourseDisplayed(favorite) + allCoursesPage.assertCourseFavorited(favorite) + allCoursesPage.unfavoriteCourse(favorite) + allCoursesPage.assertCourseNotFavorited(favorite) Espresso.pressBack() @@ -137,9 +137,9 @@ class DashboardInteractionTest : StudentTest() { data.courses.values.forEach { dashboardPage.assertDisplaysCourse(it) } dashboardPage.editFavorites() - toFavorite.forEach { editDashboardPage.assertCourseNotFavorited(it) } - editDashboardPage.selectAllCourses() - toFavorite.forEach { editDashboardPage.assertCourseFavorited(it) } + toFavorite.forEach { allCoursesPage.assertCourseNotFavorited(it) } + allCoursesPage.selectAllCourses() + toFavorite.forEach { allCoursesPage.assertCourseFavorited(it) } Espresso.pressBack() @@ -156,9 +156,9 @@ class DashboardInteractionTest : StudentTest() { toRemove.forEach { dashboardPage.assertDisplaysCourse(it) } dashboardPage.editFavorites() - toRemove.forEach { editDashboardPage.assertCourseFavorited(it) } - editDashboardPage.unselectAllCourses() - toRemove.forEach { editDashboardPage.assertCourseNotFavorited(it) } + toRemove.forEach { allCoursesPage.assertCourseFavorited(it) } + allCoursesPage.unselectAllCourses() + toRemove.forEach { allCoursesPage.assertCourseNotFavorited(it) } Espresso.pressBack() diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/pages/EditDashboardPage.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/pages/AllCoursesPage.kt similarity index 62% rename from apps/student/src/androidTest/java/com/instructure/student/ui/pages/EditDashboardPage.kt rename to apps/student/src/androidTest/java/com/instructure/student/ui/pages/AllCoursesPage.kt index c4bd4d94cf..d14942bad9 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/pages/EditDashboardPage.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/pages/AllCoursesPage.kt @@ -16,25 +16,31 @@ package com.instructure.student.ui.pages -import androidx.test.espresso.matcher.ViewMatchers.hasDescendant -import androidx.test.espresso.matcher.ViewMatchers.withContentDescription -import androidx.test.espresso.matcher.ViewMatchers.withParent -import androidx.test.espresso.matcher.ViewMatchers.withText +import android.view.View +import androidx.appcompat.widget.AppCompatImageView +import androidx.test.espresso.assertion.ViewAssertions.matches +import androidx.test.espresso.matcher.ViewMatchers.* import com.instructure.canvasapi2.models.Course +import com.instructure.dataseeding.model.CourseApiModel +import com.instructure.espresso.DoesNotExistAssertion +import com.instructure.espresso.ViewAlphaAssertion import com.instructure.espresso.assertDisplayed import com.instructure.espresso.click import com.instructure.espresso.page.BasePage import com.instructure.espresso.page.onView import com.instructure.espresso.page.plus +import com.instructure.espresso.page.waitForView import com.instructure.espresso.page.withId import com.instructure.espresso.page.withText import com.instructure.espresso.scrollTo import com.instructure.espresso.swipeUp import com.instructure.student.R +import org.hamcrest.Matcher import org.hamcrest.Matchers.allOf +import org.hamcrest.Matchers.anyOf import org.hamcrest.Matchers.containsString -class EditDashboardPage : BasePage(R.id.editDashboardPage) { +class AllCoursesPage : BasePage(R.id.editDashboardPage) { fun assertCourseDisplayed(course: Course) { val itemMatcher = allOf(withText(containsString(course.name)), withId(R.id.title)) @@ -102,6 +108,14 @@ class EditDashboardPage : BasePage(R.id.editDashboardPage) { onView(itemMatcher).assertDisplayed() } + fun assertCourseFavorited(course: CourseApiModel) { + val childMatcher = withContentDescription("Remove from dashboard") + val itemMatcher = allOf( + withContentDescription(containsString("Course ${course.name}, favorite")), + hasDescendant(childMatcher)) + onView(itemMatcher).assertDisplayed() + } + fun selectAllCourses() { val childMatcher = withContentDescription("Add all to dashboard") val itemMatcher = allOf(hasDescendant(withText(R.string.allCoursesCourseHeader)), hasDescendant(childMatcher)) @@ -116,6 +130,17 @@ class EditDashboardPage : BasePage(R.id.editDashboardPage) { onView(withParent(itemMatcher) + childMatcher).click() } + fun openCourse(courseName: String) { + onView(withId(R.id.title) + withText(courseName)).click() + } + + //OfflineMethod + fun assertSelectUnselectAllButtonNotClickable() { + val unselectAllMatcher = withContentDescription("Remove all from dashboard") + val selectAllMatcher = withContentDescription("Add all to dashboard") + onView(anyOf(unselectAllMatcher, selectAllMatcher)).check(matches(isNotClickable())) + } + fun assertCourseMassSelectButtonIsDisplayed(someSelected: Boolean) { if (someSelected) { @@ -149,4 +174,54 @@ class EditDashboardPage : BasePage(R.id.editDashboardPage) { onView(withId(R.id.swipeRefreshLayout) + withParent(withId(R.id.editDashboardPage))).swipeUp() } + //OfflineMethod + fun assertOfflineNoteDisplayed() { + waitForView(withId(R.id.noteTitle) + withText(R.string.allCoursesOfflineNoteTitle)).assertDisplayed() + onView(withId(R.id.note) + withText(R.string.allCoursesOfflineNote)) + } + + //OfflineMethod + fun assertOfflineNoteNotDisplayed() { + onView(withId(R.id.noteTitle) + withText(R.string.allCoursesOfflineNoteTitle)).check(DoesNotExistAssertion(10)) + } + + //OfflineMethod + fun dismissOfflineNoteBox() { + onView(allOf(isAssignableFrom(AppCompatImageView::class.java), hasSibling(withId(R.id.noteTitle)), hasSibling(withId(R.id.note)))).click() + onView(withId(R.id.noteTitle) + withText(R.string.allCoursesOfflineNoteTitle)).check(DoesNotExistAssertion(10)) + } + + //OfflineMethod + private fun assertViewAlpha(matcher: Matcher, expectedAlphaValue: Float) { + onView(matcher).check(ViewAlphaAssertion(expectedAlphaValue)) + } + + //OfflineMethod + fun assertCourseFavouriteStarAlpha(courseName: String, expectedAlphaValue: Float) { + assertViewAlpha(withId(R.id.favoriteButton) + hasSibling(withId(R.id.title) + withText(courseName)), expectedAlphaValue) + } + + //OfflineMethod + fun assertCourseTitleAlpha(courseName: String, expectedAlphaValue: Float) { + assertViewAlpha(withId(R.id.title) + withText(courseName), expectedAlphaValue) + } + + //OfflineMethod + fun assertCourseOpenButtonAlpha(courseName: String, expectedAlphaValue: Float) { + assertViewAlpha(withId(R.id.openButton) + hasSibling(withId(R.id.title) + withText(courseName)), expectedAlphaValue) + } + + //OfflineMethod + fun assertCourseDetailsAlpha(courseName: String, expectedAlphaValue: Float) { + assertCourseFavouriteStarAlpha(courseName, expectedAlphaValue) + assertCourseTitleAlpha(courseName, expectedAlphaValue) + assertCourseOpenButtonAlpha(courseName, expectedAlphaValue) + } + + //OfflineMethod + fun assertCourseOfflineSyncButton(courseName: String, visibility: Visibility) { + onView(withId(R.id.offlineSyncIcon) + hasSibling(withId(R.id.title) + withText(courseName))) + .check(matches(withEffectiveVisibility(visibility))) + } + } \ No newline at end of file diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/pages/DashboardPage.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/pages/DashboardPage.kt index c4d2b55143..a8b51842eb 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/pages/DashboardPage.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/pages/DashboardPage.kt @@ -272,8 +272,8 @@ class DashboardPage : BasePage(R.id.dashboardPage) { Espresso.openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().targetContext) } - fun clickEditDashboard() { - onView(withId(R.id.editDashboardTextView)).scrollTo().click() + fun openAllCoursesPage() { + waitForView(withId(R.id.editDashboardTextView)).scrollTo().click() } fun assertCourseNotDisplayed(course: CourseApiModel) { diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/pages/offline/ManageOfflineContentPage.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/pages/offline/ManageOfflineContentPage.kt index 184b5ba3a4..a64ec38b56 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/pages/offline/ManageOfflineContentPage.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/pages/offline/ManageOfflineContentPage.kt @@ -128,7 +128,7 @@ class ManageOfflineContentPage : BasePage(R.id.manageOfflineContentPage) { } fun waitForItemDisappear(itemName: String) { - onView(withId(R.id.checkbox) + hasSibling(withId(R.id.title) + withText(itemName))).check(DoesNotExistAssertion(5)) + waitForView(withId(R.id.checkbox) + hasSibling(withId(R.id.title) + withText(itemName))).check(DoesNotExistAssertion(5)) } fun assertDisplaysNoCourses() { diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/utils/StudentTest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/utils/StudentTest.kt index 88c4ab96d8..d11f313b76 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/utils/StudentTest.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/utils/StudentTest.kt @@ -42,6 +42,7 @@ import com.instructure.student.R import com.instructure.student.activity.LoginActivity import com.instructure.student.espresso.StudentHiltTestApplication_Application import com.instructure.student.ui.pages.AboutPage +import com.instructure.student.ui.pages.AllCoursesPage import com.instructure.student.ui.pages.AnnotationCommentListPage import com.instructure.student.ui.pages.AnnouncementListPage import com.instructure.student.ui.pages.AssignmentDetailsPage @@ -56,7 +57,6 @@ import com.instructure.student.ui.pages.CourseGradesPage import com.instructure.student.ui.pages.DashboardPage import com.instructure.student.ui.pages.DiscussionDetailsPage import com.instructure.student.ui.pages.DiscussionListPage -import com.instructure.student.ui.pages.EditDashboardPage import com.instructure.student.ui.pages.ElementaryCoursePage import com.instructure.student.ui.pages.ElementaryDashboardPage import com.instructure.student.ui.pages.FileListPage @@ -162,7 +162,7 @@ abstract class StudentTest : CanvasTest() { val leftSideNavigationDrawerPage = LeftSideNavigationDrawerPage() val discussionDetailsPage = DiscussionDetailsPage() val discussionListPage = DiscussionListPage(Searchable(R.id.search, R.id.search_src_text, R.id.search_close_btn)) - val editDashboardPage = EditDashboardPage() + val allCoursesPage = AllCoursesPage() val fileListPage = FileListPage(Searchable(R.id.search, R.id.queryInput, R.id.clearButton, R.id.backButton)) val fileUploadPage = FileUploadPage() val helpPage = HelpPage() diff --git a/automation/espresso/src/main/kotlin/com/instructure/espresso/CustomViewAssertions.kt b/automation/espresso/src/main/kotlin/com/instructure/espresso/CustomViewAssertions.kt index 0951e8236d..77a1c2d6ec 100644 --- a/automation/espresso/src/main/kotlin/com/instructure/espresso/CustomViewAssertions.kt +++ b/automation/espresso/src/main/kotlin/com/instructure/espresso/CustomViewAssertions.kt @@ -26,9 +26,11 @@ import androidx.test.espresso.NoMatchingViewException import androidx.test.espresso.ViewAssertion import androidx.test.espresso.assertion.ViewAssertions.doesNotExist import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.espresso.matcher.ViewMatchers.assertThat import androidx.viewpager.widget.ViewPager import com.google.android.material.bottomnavigation.BottomNavigationView import junit.framework.AssertionFailedError +import org.hamcrest.CoreMatchers.`is` import org.hamcrest.Matcher import org.hamcrest.Matchers import org.junit.Assert.assertEquals @@ -120,3 +122,10 @@ class ConstraintLayoutItemCountAssertion(private val expectedCount: Int) : ViewA } } +class ViewAlphaAssertion(private val expectedAlpha: Float): ViewAssertion { + override fun check(view: View, noViewFoundException: NoMatchingViewException?) { + noViewFoundException?.let { throw it } + assertThat("View alpha should be $expectedAlpha", view.alpha, `is`(expectedAlpha)) + } +} + diff --git a/libs/panda_annotations/src/main/java/com/instructure/panda_annotations/TestMetaData.kt b/libs/panda_annotations/src/main/java/com/instructure/panda_annotations/TestMetaData.kt index e9f5f0ddb6..4400d2346b 100644 --- a/libs/panda_annotations/src/main/java/com/instructure/panda_annotations/TestMetaData.kt +++ b/libs/panda_annotations/src/main/java/com/instructure/panda_annotations/TestMetaData.kt @@ -43,7 +43,7 @@ enum class SecondaryFeatureCategory { ASSIGNMENT_COMMENTS, ASSIGNMENT_QUIZZES, ASSIGNMENT_DISCUSSIONS, GROUPS_DASHBOARD, GROUPS_FILES, GROUPS_ANNOUNCEMENTS, GROUPS_DISCUSSIONS, GROUPS_PAGES, GROUPS_PEOPLE, EVENTS_DISCUSSIONS, EVENTS_QUIZZES, EVENTS_ASSIGNMENTS, EVENTS_NOTIFICATIONS, - MODULES_ASSIGNMENTS, MODULES_DISCUSSIONS, MODULES_FILES, MODULES_PAGES, MODULES_QUIZZES, OFFLINE_MODE + MODULES_ASSIGNMENTS, MODULES_DISCUSSIONS, MODULES_FILES, MODULES_PAGES, MODULES_QUIZZES, OFFLINE_MODE, ALL_COURSES } enum class TestCategory {