Skip to content

Commit df8acb8

Browse files
authored
[MBL-19440][Student] Extend Notifications E2E test to verify inbox conversations are excluded (#3339)
* Extend NotificationsE2ETest to verify inbox conversations are not listed in notifications page. refs: MBL-19440 affects: Student release note: * PR fix refs: MBL-19440 affects: Student release note: ---------
1 parent e1cc698 commit df8acb8

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

apps/student/src/androidTest/java/com/instructure/student/ui/e2e/classic/NotificationsE2ETest.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.instructure.canvas.espresso.TestMetaData
2525
import com.instructure.canvas.espresso.annotations.E2E
2626
import com.instructure.canvas.espresso.refresh
2727
import com.instructure.dataseeding.api.AssignmentsApi
28+
import com.instructure.dataseeding.api.ConversationsApi
2829
import com.instructure.dataseeding.api.QuizzesApi
2930
import com.instructure.dataseeding.api.SubmissionsApi
3031
import com.instructure.dataseeding.model.GradingType
@@ -103,6 +104,23 @@ class NotificationsE2ETest : StudentTest() {
103104
println("API may not work properly, so not all the notifications can be seen on the screen.")
104105
}
105106

107+
Log.d(PREPARATION_TAG, "Seed an inbox conversation from teacher to student: '${student.name}'.")
108+
val seededConversation = ConversationsApi.createConversation(teacher.token, listOf(student.id.toString()))[0]
109+
110+
Log.d(STEP_TAG, "Navigate to Inbox page.")
111+
dashboardPage.clickInboxTab()
112+
113+
Log.d(ASSERTION_TAG, "Assert that the conversation '${seededConversation.subject}' IS displayed in the Inbox.")
114+
inboxPage.assertConversationDisplayed(seededConversation.subject)
115+
116+
Log.d(STEP_TAG, "Navigate back to Notifications page.")
117+
dashboardPage.clickNotificationsTab()
118+
119+
Log.d(ASSERTION_TAG, "Refresh the Notifications Page and verify that the conversation '${seededConversation.subject}' is NOT displayed in the Notifications page.")
120+
refresh()
121+
sleep(3000) //wait here to be sure that the conversation notification does not appears.
122+
notificationPage.assertNotificationNotDisplayed(seededConversation.subject)
123+
106124
refresh()
107125
run submitAndGradeRepeat@{
108126
repeat(10) {

apps/student/src/androidTest/java/com/instructure/student/ui/pages/classic/NotificationPage.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package com.instructure.student.ui.pages.classic
1818

1919
import androidx.test.espresso.Espresso.onView
2020
import androidx.test.espresso.NoMatchingViewException
21+
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
2122
import androidx.test.espresso.matcher.ViewMatchers.hasSibling
2223
import com.instructure.canvas.espresso.containsTextCaseInsensitive
2324
import com.instructure.canvas.espresso.refresh
@@ -44,6 +45,11 @@ class NotificationPage : BasePage() {
4445
onView(matcher).assertDisplayed()
4546
}
4647

48+
fun assertNotificationNotDisplayed(notificationTitle: String) {
49+
val matcher = allOf(withText(notificationTitle), withAncestor(R.id.listView))
50+
onView(matcher).check(doesNotExist())
51+
}
52+
4753
fun assertHasGrade(title: String, grade: String) {
4854
val matcher = allOf(containsTextCaseInsensitive(title.dropLast(1)) + hasSibling(withId(R.id.description) + withText("Grade: $grade")))
4955
onView(matcher).scrollTo().assertDisplayed()

0 commit comments

Comments
 (0)