Skip to content

Commit 08f61c0

Browse files
authored
Adds comprehensive E2E tests verifying inbox signatures display correctly when composing messages via FAB buttons, ensuring user-specific signatures don't leak between accounts (validates bug: MBL-18929 fix). (#3335)
refs: MBL-18950 affects: All release note:
1 parent 0d5a895 commit 08f61c0

File tree

4 files changed

+595
-0
lines changed

4 files changed

+595
-0
lines changed

apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/SettingsE2ETest.kt

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ import com.instructure.canvas.espresso.annotations.E2E
2727
import com.instructure.canvas.espresso.checkToastText
2828
import com.instructure.canvas.espresso.pressBackButton
2929
import com.instructure.dataseeding.api.AssignmentsApi
30+
import com.instructure.dataseeding.api.CoursesApi
3031
import com.instructure.dataseeding.model.GradingType
3132
import com.instructure.dataseeding.model.SubmissionType
33+
import com.instructure.dataseeding.model.UpdateCourse
3234
import com.instructure.dataseeding.util.CanvasNetworkAdapter
3335
import com.instructure.dataseeding.util.days
3436
import com.instructure.dataseeding.util.fromNow
@@ -432,4 +434,250 @@ class SettingsE2ETest : ParentComposeTest() {
432434
Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature text is displayed by default since we logged back with '${parent.name}' teacher.")
433435
inboxComposeMessagePage.assertBodyText("\n\n---\nPresident of AC Milan\nVice President of Ferencvaros")
434436
}
437+
438+
@E2E
439+
@Test
440+
@TestMetaData(Priority.BUG_CASE, FeatureCategory.INBOX, TestCategory.E2E, SecondaryFeatureCategory.INBOX_SIGNATURE)
441+
fun testInboxSignaturesFABButtonWithDifferentUsersE2E() {
442+
443+
//Bug Ticket: MBL-18929
444+
Log.d(PREPARATION_TAG, "Seeding data.")
445+
val data = seedData(students = 1, teachers = 1, parents = 2, courses = 1)
446+
val parent = data.parentsList[0]
447+
val parent2 = data.parentsList[1]
448+
val teacher = data.teachersList[0]
449+
val course = data.coursesList[0]
450+
451+
Log.d(PREPARATION_TAG, "Seed assignment for '${course.name}' course.")
452+
val testAssignment = AssignmentsApi.createAssignment(course.id, teacher.token, submissionTypes = listOf(SubmissionType.ON_PAPER), withDescription = true, pointsPossible = 15.0, dueAt = 1.days.fromNow.iso8601)
453+
454+
val syllabusBody = "This is the syllabus body."
455+
Log.d(PREPARATION_TAG, "Update '${course.name}' course to set Syllabus with some syllabus body.")
456+
CoursesApi.updateCourse(course.id, UpdateCourse(syllabusBody = syllabusBody))
457+
458+
Log.d(STEP_TAG, "Click 'Find My School' button.")
459+
loginLandingPage.clickFindMySchoolButton()
460+
461+
Log.d(STEP_TAG, "Enter domain: '${CanvasNetworkAdapter.canvasDomain}'")
462+
loginFindSchoolPage.enterDomain(CanvasNetworkAdapter.canvasDomain)
463+
464+
Log.d(STEP_TAG, "Click on 'Next' button on the toolbar.")
465+
loginFindSchoolPage.clickToolbarNextMenuItem()
466+
467+
Log.d(STEP_TAG, "Login with user: '${parent.name}', login id: '${parent.loginId}'.")
468+
loginSignInPage.loginAs(parent)
469+
dashboardPage.waitForRender()
470+
471+
Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.")
472+
dashboardPage.openLeftSideMenu()
473+
474+
Log.d(STEP_TAG, "Navigate to Settings Page on the left-side menu.")
475+
leftSideNavigationDrawerPage.clickSettings()
476+
477+
Log.d(ASSERTION_TAG, "Assert that by default the Inbox Signature is 'Not Set'.")
478+
settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Not Set")
479+
480+
Log.d(STEP_TAG, "Click on the 'Inbox Signature' settings.")
481+
settingsPage.clickOnSettingsItem("Inbox Signature")
482+
483+
Log.d(ASSERTION_TAG, "Assert that by default the 'Inbox Signature' toggle is turned off.")
484+
inboxSignatureSettingsPage.assertSignatureEnabledState(false)
485+
486+
val signatureText = "Best Regards\nCanvas Parent"
487+
Log.d(STEP_TAG, "Turn on the 'Inbox Signature' and set the inbox signature text to: '$signatureText'. Save the changes.")
488+
inboxSignatureSettingsPage.toggleSignatureEnabledState()
489+
inboxSignatureSettingsPage.changeSignatureText(signatureText)
490+
inboxSignatureSettingsPage.saveChanges()
491+
492+
Log.d(ASSERTION_TAG, "Assert that the 'Inbox settings saved!' toast message is displayed.")
493+
checkToastText(R.string.inboxSignatureSettingsUpdated, activityRule.activity)
494+
495+
Log.d(STEP_TAG, "Refresh the Settings page.")
496+
settingsPage.refresh()
497+
498+
Log.d(ASSERTION_TAG, "Assert that the Inbox Signature became 'Enabled'.")
499+
settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Enabled")
500+
501+
Log.d(STEP_TAG, "Navigate back to the Dashboard.")
502+
Espresso.pressBack()
503+
504+
Log.d(STEP_TAG, "Select course: '${course.name}'.")
505+
coursesPage.clickCourseItem(course.name)
506+
507+
Log.d(STEP_TAG, "Select 'GRADES' tab.")
508+
courseDetailsPage.selectTab("GRADES")
509+
510+
Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Grades tab.")
511+
courseDetailsPage.clickComposeMessageFAB()
512+
513+
Log.d(ASSERTION_TAG, "Assert that the inbox signature: '${signatureText}' text is displayed when composing message from Grades tab FAB.")
514+
inboxComposeMessagePage.assertBodyText("\n\n---\nBest Regards\nCanvas Parent")
515+
516+
Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.")
517+
inboxComposePage.clickOnCloseButton()
518+
519+
Log.d(STEP_TAG, "Select 'SYLLABUS' tab.")
520+
courseDetailsPage.selectTab("SYLLABUS")
521+
522+
Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Syllabus tab.")
523+
courseDetailsPage.clickComposeMessageFAB()
524+
525+
Log.d(ASSERTION_TAG, "Assert that the inbox signature: '${signatureText}' text is displayed when composing message from Syllabus tab FAB.")
526+
inboxComposeMessagePage.assertBodyText("\n\n---\nBest Regards\nCanvas Parent")
527+
528+
Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.")
529+
inboxComposePage.clickOnCloseButton()
530+
531+
Log.d(STEP_TAG, "Select 'SUMMARY' tab.")
532+
courseDetailsPage.selectTab("SUMMARY")
533+
534+
Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Summary tab.")
535+
courseDetailsPage.clickComposeMessageFAB()
536+
537+
Log.d(ASSERTION_TAG, "Assert that the inbox signature: '${signatureText}' text is displayed when composing message from Summary tab FAB.")
538+
inboxComposeMessagePage.assertBodyText("\n\n---\nBest Regards\nCanvas Parent")
539+
540+
Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.")
541+
inboxComposePage.clickOnCloseButton()
542+
543+
Log.d(STEP_TAG, "Select 'GRADES' tab.")
544+
courseDetailsPage.selectTab("GRADES")
545+
546+
Log.d(STEP_TAG, "Click on assignment: '${testAssignment.name}' to open Assignment Details Page.")
547+
courseDetailsPage.clickAssignment(testAssignment.name)
548+
549+
Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on Assignment Details Page.")
550+
assignmentDetailsPage.clickComposeMessageFAB()
551+
552+
Log.d(ASSERTION_TAG, "Assert that the inbox signature: '${signatureText}' text is displayed when composing message from Assignment Details FAB.")
553+
inboxComposeMessagePage.assertBodyText("\n\n---\nBest Regards\nCanvas Parent")
554+
555+
Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.")
556+
inboxComposePage.clickOnCloseButton()
557+
558+
Log.d(STEP_TAG, "Navigate back to Dashboard.")
559+
pressBackButton(2)
560+
561+
Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.")
562+
dashboardPage.openLeftSideMenu()
563+
564+
Log.d(STEP_TAG, "Click on 'Change User' button on the Left Side Navigation Drawer menu.")
565+
leftSideNavigationDrawerPage.clickChangeUser()
566+
567+
Log.d(STEP_TAG, "Click on the 'Find another school' button.")
568+
loginLandingPage.clickFindAnotherSchoolButton()
569+
570+
Log.d(STEP_TAG, "Enter domain: '${CanvasNetworkAdapter.canvasDomain}'")
571+
loginFindSchoolPage.enterDomain(CanvasNetworkAdapter.canvasDomain)
572+
573+
Log.d(STEP_TAG, "Click on 'Next' button on the toolbar.")
574+
loginFindSchoolPage.clickToolbarNextMenuItem()
575+
576+
Log.d(STEP_TAG, "Login with the other user: '${parent2.name}', login id: '${parent2.loginId}'.")
577+
loginSignInPage.loginAs(parent2)
578+
dashboardPage.waitForRender()
579+
580+
Log.d(STEP_TAG, "Select course: '${course.name}'.")
581+
coursesPage.clickCourseItem(course.name)
582+
583+
Log.d(STEP_TAG, "Select 'GRADES' tab.")
584+
courseDetailsPage.selectTab("GRADES")
585+
586+
Log.d(STEP_TAG, "Click on assignment: '${testAssignment.name}' to open Assignment Details Page.")
587+
courseDetailsPage.clickAssignment(testAssignment.name)
588+
589+
Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on Assignment Details Page.")
590+
assignmentDetailsPage.clickComposeMessageFAB()
591+
592+
Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature text is NOT displayed since it was set for another user.")
593+
inboxComposeMessagePage.assertBodyText("")
594+
595+
Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.")
596+
inboxComposeMessagePage.clickOnCloseButton()
597+
598+
Log.d(STEP_TAG, "Navigate back to Dashboard.")
599+
pressBackButton(2)
600+
601+
Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.")
602+
dashboardPage.openLeftSideMenu()
603+
604+
Log.d(STEP_TAG, "Navigate to Settings Page on the Left Side Navigation Drawer menu.")
605+
leftSideNavigationDrawerPage.clickSettings()
606+
607+
Log.d(ASSERTION_TAG, "Assert that by default the Inbox Signature is 'Not Set'.")
608+
settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Not Set")
609+
610+
Log.d(STEP_TAG, "Click on the 'Inbox Signature' settings.")
611+
settingsPage.clickOnSettingsItem("Inbox Signature")
612+
613+
Log.d(ASSERTION_TAG, "Assert that by default the 'Inbox Signature' toggle is turned off.")
614+
inboxSignatureSettingsPage.assertSignatureEnabledState(false)
615+
616+
val secondSignatureText = "Loyal member of Instructure"
617+
Log.d(STEP_TAG, "Turn on the 'Inbox Signature' and set the inbox signature text to: '$secondSignatureText'. Save the changes.")
618+
inboxSignatureSettingsPage.toggleSignatureEnabledState()
619+
inboxSignatureSettingsPage.changeSignatureText(secondSignatureText)
620+
inboxSignatureSettingsPage.saveChanges()
621+
622+
Log.d(STEP_TAG, "Refresh the Settings page.")
623+
settingsPage.refresh()
624+
625+
Log.d(ASSERTION_TAG, "Assert that the Inbox Signature became 'Enabled'.")
626+
settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Enabled")
627+
628+
Log.d(STEP_TAG, "Navigate back to the Dashboard.")
629+
Espresso.pressBack()
630+
631+
Log.d(STEP_TAG, "Select course: '${course.name}'.")
632+
coursesPage.clickCourseItem(course.name)
633+
634+
Log.d(STEP_TAG, "Select 'GRADES' tab.")
635+
courseDetailsPage.selectTab("GRADES")
636+
637+
Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Grades tab.")
638+
courseDetailsPage.clickComposeMessageFAB()
639+
640+
Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from Grades tab FAB.")
641+
inboxComposeMessagePage.assertBodyText("\n\n---\nLoyal member of Instructure")
642+
643+
Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.")
644+
inboxComposePage.clickOnCloseButton()
645+
646+
Log.d(STEP_TAG, "Select 'SYLLABUS' tab.")
647+
courseDetailsPage.selectTab("SYLLABUS")
648+
649+
Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Syllabus tab.")
650+
courseDetailsPage.clickComposeMessageFAB()
651+
652+
Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from Syllabus tab FAB.")
653+
inboxComposeMessagePage.assertBodyText("\n\n---\nLoyal member of Instructure")
654+
655+
Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.")
656+
inboxComposePage.clickOnCloseButton()
657+
658+
Log.d(STEP_TAG, "Select 'SUMMARY' tab.")
659+
courseDetailsPage.selectTab("SUMMARY")
660+
661+
Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Summary tab.")
662+
courseDetailsPage.clickComposeMessageFAB()
663+
664+
Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from Summary tab FAB.")
665+
inboxComposeMessagePage.assertBodyText("\n\n---\nLoyal member of Instructure")
666+
667+
Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.")
668+
inboxComposePage.clickOnCloseButton()
669+
670+
Log.d(STEP_TAG, "Select 'GRADES' tab.")
671+
courseDetailsPage.selectTab("GRADES")
672+
673+
Log.d(STEP_TAG, "Click on assignment: '${testAssignment.name}' to open Assignment Details Page.")
674+
courseDetailsPage.clickAssignment(testAssignment.name)
675+
676+
Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on Assignment Details Page.")
677+
assignmentDetailsPage.clickComposeMessageFAB()
678+
679+
Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from Assignment details FAB.")
680+
inboxComposeMessagePage.assertBodyText("\n\n---\nLoyal member of Instructure")
681+
}
682+
435683
}

apps/parent/src/androidTest/java/com/instructure/parentapp/utils/ParentComposeTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ abstract class ParentComposeTest : ParentTest() {
6666
protected val notAParentPage = NotAParentPage(composeTestRule)
6767
protected val courseDetailsPage = CourseDetailsPage(composeTestRule)
6868
protected val summaryPage = SummaryPage(composeTestRule)
69+
protected val inboxComposePage = InboxComposePage(composeTestRule)
6970
protected val announcementDetailsPage = AnnouncementDetailsPage(composeTestRule)
7071
protected val createAccountPage = CreateAccountPage(composeTestRule)
7172
protected val inboxDetailsPage = InboxDetailsPage(composeTestRule)

0 commit comments

Comments
 (0)