diff --git a/apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/SettingsE2ETest.kt b/apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/SettingsE2ETest.kt index 26e37c737c..cc1562470e 100644 --- a/apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/SettingsE2ETest.kt +++ b/apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/SettingsE2ETest.kt @@ -27,8 +27,10 @@ import com.instructure.canvas.espresso.annotations.E2E import com.instructure.canvas.espresso.checkToastText import com.instructure.canvas.espresso.pressBackButton import com.instructure.dataseeding.api.AssignmentsApi +import com.instructure.dataseeding.api.CoursesApi import com.instructure.dataseeding.model.GradingType import com.instructure.dataseeding.model.SubmissionType +import com.instructure.dataseeding.model.UpdateCourse import com.instructure.dataseeding.util.CanvasNetworkAdapter import com.instructure.dataseeding.util.days import com.instructure.dataseeding.util.fromNow @@ -432,4 +434,250 @@ class SettingsE2ETest : ParentComposeTest() { Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature text is displayed by default since we logged back with '${parent.name}' teacher.") inboxComposeMessagePage.assertBodyText("\n\n---\nPresident of AC Milan\nVice President of Ferencvaros") } + + @E2E + @Test + @TestMetaData(Priority.BUG_CASE, FeatureCategory.INBOX, TestCategory.E2E, SecondaryFeatureCategory.INBOX_SIGNATURE) + fun testInboxSignaturesFABButtonWithDifferentUsersE2E() { + + //Bug Ticket: MBL-18929 + Log.d(PREPARATION_TAG, "Seeding data.") + val data = seedData(students = 1, teachers = 1, parents = 2, courses = 1) + val parent = data.parentsList[0] + val parent2 = data.parentsList[1] + val teacher = data.teachersList[0] + val course = data.coursesList[0] + + Log.d(PREPARATION_TAG, "Seed assignment for '${course.name}' course.") + val testAssignment = AssignmentsApi.createAssignment(course.id, teacher.token, submissionTypes = listOf(SubmissionType.ON_PAPER), withDescription = true, pointsPossible = 15.0, dueAt = 1.days.fromNow.iso8601) + + val syllabusBody = "This is the syllabus body." + Log.d(PREPARATION_TAG, "Update '${course.name}' course to set Syllabus with some syllabus body.") + CoursesApi.updateCourse(course.id, UpdateCourse(syllabusBody = syllabusBody)) + + Log.d(STEP_TAG, "Click 'Find My School' button.") + loginLandingPage.clickFindMySchoolButton() + + Log.d(STEP_TAG, "Enter domain: '${CanvasNetworkAdapter.canvasDomain}'") + loginFindSchoolPage.enterDomain(CanvasNetworkAdapter.canvasDomain) + + Log.d(STEP_TAG, "Click on 'Next' button on the toolbar.") + loginFindSchoolPage.clickToolbarNextMenuItem() + + Log.d(STEP_TAG, "Login with user: '${parent.name}', login id: '${parent.loginId}'.") + loginSignInPage.loginAs(parent) + dashboardPage.waitForRender() + + Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.") + dashboardPage.openLeftSideMenu() + + Log.d(STEP_TAG, "Navigate to Settings Page on the left-side menu.") + leftSideNavigationDrawerPage.clickSettings() + + Log.d(ASSERTION_TAG, "Assert that by default the Inbox Signature is 'Not Set'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Not Set") + + Log.d(STEP_TAG, "Click on the 'Inbox Signature' settings.") + settingsPage.clickOnSettingsItem("Inbox Signature") + + Log.d(ASSERTION_TAG, "Assert that by default the 'Inbox Signature' toggle is turned off.") + inboxSignatureSettingsPage.assertSignatureEnabledState(false) + + val signatureText = "Best Regards\nCanvas Parent" + Log.d(STEP_TAG, "Turn on the 'Inbox Signature' and set the inbox signature text to: '$signatureText'. Save the changes.") + inboxSignatureSettingsPage.toggleSignatureEnabledState() + inboxSignatureSettingsPage.changeSignatureText(signatureText) + inboxSignatureSettingsPage.saveChanges() + + Log.d(ASSERTION_TAG, "Assert that the 'Inbox settings saved!' toast message is displayed.") + checkToastText(R.string.inboxSignatureSettingsUpdated, activityRule.activity) + + Log.d(STEP_TAG, "Refresh the Settings page.") + settingsPage.refresh() + + Log.d(ASSERTION_TAG, "Assert that the Inbox Signature became 'Enabled'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Enabled") + + Log.d(STEP_TAG, "Navigate back to the Dashboard.") + Espresso.pressBack() + + Log.d(STEP_TAG, "Select course: '${course.name}'.") + coursesPage.clickCourseItem(course.name) + + Log.d(STEP_TAG, "Select 'GRADES' tab.") + courseDetailsPage.selectTab("GRADES") + + Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Grades tab.") + courseDetailsPage.clickComposeMessageFAB() + + Log.d(ASSERTION_TAG, "Assert that the inbox signature: '${signatureText}' text is displayed when composing message from Grades tab FAB.") + inboxComposeMessagePage.assertBodyText("\n\n---\nBest Regards\nCanvas Parent") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Select 'SYLLABUS' tab.") + courseDetailsPage.selectTab("SYLLABUS") + + Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Syllabus tab.") + courseDetailsPage.clickComposeMessageFAB() + + Log.d(ASSERTION_TAG, "Assert that the inbox signature: '${signatureText}' text is displayed when composing message from Syllabus tab FAB.") + inboxComposeMessagePage.assertBodyText("\n\n---\nBest Regards\nCanvas Parent") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Select 'SUMMARY' tab.") + courseDetailsPage.selectTab("SUMMARY") + + Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Summary tab.") + courseDetailsPage.clickComposeMessageFAB() + + Log.d(ASSERTION_TAG, "Assert that the inbox signature: '${signatureText}' text is displayed when composing message from Summary tab FAB.") + inboxComposeMessagePage.assertBodyText("\n\n---\nBest Regards\nCanvas Parent") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Select 'GRADES' tab.") + courseDetailsPage.selectTab("GRADES") + + Log.d(STEP_TAG, "Click on assignment: '${testAssignment.name}' to open Assignment Details Page.") + courseDetailsPage.clickAssignment(testAssignment.name) + + Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on Assignment Details Page.") + assignmentDetailsPage.clickComposeMessageFAB() + + Log.d(ASSERTION_TAG, "Assert that the inbox signature: '${signatureText}' text is displayed when composing message from Assignment Details FAB.") + inboxComposeMessagePage.assertBodyText("\n\n---\nBest Regards\nCanvas Parent") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Navigate back to Dashboard.") + pressBackButton(2) + + Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.") + dashboardPage.openLeftSideMenu() + + Log.d(STEP_TAG, "Click on 'Change User' button on the Left Side Navigation Drawer menu.") + leftSideNavigationDrawerPage.clickChangeUser() + + Log.d(STEP_TAG, "Click on the 'Find another school' button.") + loginLandingPage.clickFindAnotherSchoolButton() + + Log.d(STEP_TAG, "Enter domain: '${CanvasNetworkAdapter.canvasDomain}'") + loginFindSchoolPage.enterDomain(CanvasNetworkAdapter.canvasDomain) + + Log.d(STEP_TAG, "Click on 'Next' button on the toolbar.") + loginFindSchoolPage.clickToolbarNextMenuItem() + + Log.d(STEP_TAG, "Login with the other user: '${parent2.name}', login id: '${parent2.loginId}'.") + loginSignInPage.loginAs(parent2) + dashboardPage.waitForRender() + + Log.d(STEP_TAG, "Select course: '${course.name}'.") + coursesPage.clickCourseItem(course.name) + + Log.d(STEP_TAG, "Select 'GRADES' tab.") + courseDetailsPage.selectTab("GRADES") + + Log.d(STEP_TAG, "Click on assignment: '${testAssignment.name}' to open Assignment Details Page.") + courseDetailsPage.clickAssignment(testAssignment.name) + + Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on Assignment Details Page.") + assignmentDetailsPage.clickComposeMessageFAB() + + Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature text is NOT displayed since it was set for another user.") + inboxComposeMessagePage.assertBodyText("") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposeMessagePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Navigate back to Dashboard.") + pressBackButton(2) + + Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.") + dashboardPage.openLeftSideMenu() + + Log.d(STEP_TAG, "Navigate to Settings Page on the Left Side Navigation Drawer menu.") + leftSideNavigationDrawerPage.clickSettings() + + Log.d(ASSERTION_TAG, "Assert that by default the Inbox Signature is 'Not Set'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Not Set") + + Log.d(STEP_TAG, "Click on the 'Inbox Signature' settings.") + settingsPage.clickOnSettingsItem("Inbox Signature") + + Log.d(ASSERTION_TAG, "Assert that by default the 'Inbox Signature' toggle is turned off.") + inboxSignatureSettingsPage.assertSignatureEnabledState(false) + + val secondSignatureText = "Loyal member of Instructure" + Log.d(STEP_TAG, "Turn on the 'Inbox Signature' and set the inbox signature text to: '$secondSignatureText'. Save the changes.") + inboxSignatureSettingsPage.toggleSignatureEnabledState() + inboxSignatureSettingsPage.changeSignatureText(secondSignatureText) + inboxSignatureSettingsPage.saveChanges() + + Log.d(STEP_TAG, "Refresh the Settings page.") + settingsPage.refresh() + + Log.d(ASSERTION_TAG, "Assert that the Inbox Signature became 'Enabled'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Enabled") + + Log.d(STEP_TAG, "Navigate back to the Dashboard.") + Espresso.pressBack() + + Log.d(STEP_TAG, "Select course: '${course.name}'.") + coursesPage.clickCourseItem(course.name) + + Log.d(STEP_TAG, "Select 'GRADES' tab.") + courseDetailsPage.selectTab("GRADES") + + Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Grades tab.") + courseDetailsPage.clickComposeMessageFAB() + + Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from Grades tab FAB.") + inboxComposeMessagePage.assertBodyText("\n\n---\nLoyal member of Instructure") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Select 'SYLLABUS' tab.") + courseDetailsPage.selectTab("SYLLABUS") + + Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Syllabus tab.") + courseDetailsPage.clickComposeMessageFAB() + + Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from Syllabus tab FAB.") + inboxComposeMessagePage.assertBodyText("\n\n---\nLoyal member of Instructure") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Select 'SUMMARY' tab.") + courseDetailsPage.selectTab("SUMMARY") + + Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on the Summary tab.") + courseDetailsPage.clickComposeMessageFAB() + + Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from Summary tab FAB.") + inboxComposeMessagePage.assertBodyText("\n\n---\nLoyal member of Instructure") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Select 'GRADES' tab.") + courseDetailsPage.selectTab("GRADES") + + Log.d(STEP_TAG, "Click on assignment: '${testAssignment.name}' to open Assignment Details Page.") + courseDetailsPage.clickAssignment(testAssignment.name) + + Log.d(STEP_TAG, "Click on the 'Compose Message' FAB on Assignment Details Page.") + assignmentDetailsPage.clickComposeMessageFAB() + + Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from Assignment details FAB.") + inboxComposeMessagePage.assertBodyText("\n\n---\nLoyal member of Instructure") + } + } \ No newline at end of file diff --git a/apps/parent/src/androidTest/java/com/instructure/parentapp/utils/ParentComposeTest.kt b/apps/parent/src/androidTest/java/com/instructure/parentapp/utils/ParentComposeTest.kt index b46c703105..81beeda7f9 100644 --- a/apps/parent/src/androidTest/java/com/instructure/parentapp/utils/ParentComposeTest.kt +++ b/apps/parent/src/androidTest/java/com/instructure/parentapp/utils/ParentComposeTest.kt @@ -66,6 +66,7 @@ abstract class ParentComposeTest : ParentTest() { protected val notAParentPage = NotAParentPage(composeTestRule) protected val courseDetailsPage = CourseDetailsPage(composeTestRule) protected val summaryPage = SummaryPage(composeTestRule) + protected val inboxComposePage = InboxComposePage(composeTestRule) protected val announcementDetailsPage = AnnouncementDetailsPage(composeTestRule) protected val createAccountPage = CreateAccountPage(composeTestRule) protected val inboxDetailsPage = InboxDetailsPage(composeTestRule) diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/compose/SettingsE2ETest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/compose/SettingsE2ETest.kt index 7a62e86529..c15553f422 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/compose/SettingsE2ETest.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/compose/SettingsE2ETest.kt @@ -712,4 +712,177 @@ class SettingsE2ETest : StudentComposeTest() { Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature text is displayed by default since we logged back with '${student.name}' student.") inboxComposePage.assertBodyText("\n\n---\nPresident of AC Milan\nVice President of Ferencvaros") } + + @E2E + @Test + @TestMetaData(Priority.BUG_CASE, FeatureCategory.INBOX, TestCategory.E2E, SecondaryFeatureCategory.INBOX_SIGNATURE) + fun testInboxSignaturesFABButtonWithDifferentUsersE2E() { + + //Bug Ticket: MBL-18929 + Log.d(PREPARATION_TAG, "Seeding data.") + val data = seedData(students = 2, teachers = 1 ,courses = 1) + val student = data.studentsList[0] + val student2 = data.studentsList[1] + val teacher = data.teachersList[0] + val course = data.coursesList[0] + + Log.d(STEP_TAG, "Click 'Find My School' button.") + loginLandingPage.clickFindMySchoolButton() + + Log.d(STEP_TAG, "Enter domain: '${CanvasNetworkAdapter.canvasDomain}'") + loginFindSchoolPage.enterDomain(CanvasNetworkAdapter.canvasDomain) + + Log.d(STEP_TAG, "Click on 'Next' button on the toolbar.") + loginFindSchoolPage.clickToolbarNextMenuItem() + + Log.d(STEP_TAG, "Login with user: '${student.name}', login id: '${student.loginId}'.") + loginSignInPage.loginAs(student) + dashboardPage.waitForRender() + + Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.") + dashboardPage.openLeftSideMenu() + + Log.d(STEP_TAG, "Navigate to Settings Page on the left-side menu.") + leftSideNavigationDrawerPage.clickSettingsMenu() + + Log.d(ASSERTION_TAG, "Assert that by default the Inbox Signature is 'Not Set'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Not Set") + + Log.d(STEP_TAG, "Click on the 'Inbox Signature' settings.") + settingsPage.clickOnSettingsItem("Inbox Signature") + + Log.d(ASSERTION_TAG, "Assert that by default the 'Inbox Signature' toggle is turned off.") + inboxSignatureSettingsPage.assertSignatureEnabledState(false) + + val signatureText = "Best Regards\nCanvas Student" + Log.d(STEP_TAG, "Turn on the 'Inbox Signature' and set the inbox signature text to: '$signatureText'. Save the changes.") + inboxSignatureSettingsPage.toggleSignatureEnabledState() + inboxSignatureSettingsPage.changeSignatureText(signatureText) + inboxSignatureSettingsPage.saveChanges() + + Log.d(ASSERTION_TAG, "Assert that the 'Inbox settings saved!' toast message is displayed.") + checkToastText(R.string.inboxSignatureSettingsUpdated, activityRule.activity) + + Log.d(STEP_TAG, "Refresh the Settings page.") + settingsPage.refresh() + + Log.d(ASSERTION_TAG, "Assert that the Inbox Signature became 'Enabled'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Enabled") + + Log.d(STEP_TAG, "Navigate back to the Dashboard.") + Espresso.pressBack() + + Log.d(STEP_TAG, "Select course: '${course.name}'.") + dashboardPage.selectCourse(course) + + Log.d(STEP_TAG, "Navigate to People page.") + courseBrowserPage.selectPeople() + + Log.d(STEP_TAG, "Click on teacher: '${teacher.name}' to open People Details Page.") + peopleListPage.selectPerson(teacher) + + Log.d(ASSERTION_TAG, "Assert that People Details Page displays correct: '${teacher.name}'.") + personDetailsPage.assertIsPerson(teacher.name) + + Log.d(STEP_TAG, "Click on the 'Compose' button on People Details Page.") + personDetailsPage.clickCompose() + + Log.d(ASSERTION_TAG, "Assert that the inbox signature: '$signatureText' text is displayed when composing message from People Details FAB.") + inboxComposePage.assertBodyText("\n\n---\nBest Regards\nCanvas Student") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Navigate back to Dashboard.") + pressBackButton(3) + + Log.d(STEP_TAG, "Click on 'Change User' button on the Left Side Navigation Drawer menu.") + leftSideNavigationDrawerPage.clickChangeUserMenu() + + Log.d(STEP_TAG, "Click on the 'Find another school' button.") + loginLandingPage.clickFindAnotherSchoolButton() + + Log.d(STEP_TAG, "Enter domain: '${CanvasNetworkAdapter.canvasDomain}'") + loginFindSchoolPage.enterDomain(CanvasNetworkAdapter.canvasDomain) + + Log.d(STEP_TAG, "Click on 'Next' button on the toolbar.") + loginFindSchoolPage.clickToolbarNextMenuItem() + + Log.d(STEP_TAG, "Login with the other user: '${student2.name}', login id: '${student2.loginId}'.") + loginSignInPage.loginAs(student2) + dashboardPage.waitForRender() + + Log.d(STEP_TAG, "Select course: '${course.name}'.") + dashboardPage.selectCourse(course) + + Log.d(STEP_TAG, "Navigate to People page.") + courseBrowserPage.selectPeople() + + Log.d(STEP_TAG, "Click on teacher: '${teacher.name}' to open People Details Page.") + peopleListPage.selectPerson(teacher) + + Log.d(ASSERTION_TAG, "Assert that People Details Page displays correct: '${teacher.name}'.") + personDetailsPage.assertIsPerson(teacher.name) + + Log.d(STEP_TAG, "Click on the 'Compose' button on People Details Page.") + personDetailsPage.clickCompose() + + Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature text is NOT displayed since it was set for another user.") + inboxComposePage.assertBodyText("") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Navigate back to Dashboard.") + pressBackButton(3) + + Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.") + dashboardPage.openLeftSideMenu() + + Log.d(STEP_TAG, "Navigate to Settings Page on the Left Side Navigation Drawer menu.") + leftSideNavigationDrawerPage.clickSettingsMenu() + + Log.d(ASSERTION_TAG, "Assert that by default the Inbox Signature is 'Not Set'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Not Set") + + Log.d(STEP_TAG, "Click on the 'Inbox Signature' settings.") + settingsPage.clickOnSettingsItem("Inbox Signature") + + Log.d(ASSERTION_TAG, "Assert that by default the 'Inbox Signature' toggle is turned off.") + inboxSignatureSettingsPage.assertSignatureEnabledState(false) + + val secondSignatureText = "Loyal member of Instructure" + Log.d(STEP_TAG, "Turn on the 'Inbox Signature' and set the inbox signature text to: '$secondSignatureText'. Save the changes.") + inboxSignatureSettingsPage.toggleSignatureEnabledState() + inboxSignatureSettingsPage.changeSignatureText(secondSignatureText) + inboxSignatureSettingsPage.saveChanges() + + Log.d(STEP_TAG, "Refresh the Settings page.") + settingsPage.refresh() + + Log.d(ASSERTION_TAG, "Assert that the Inbox Signature became 'Enabled'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Enabled") + + Log.d(STEP_TAG, "Navigate back to the Dashboard.") + Espresso.pressBack() + + Log.d(STEP_TAG, "Select course: '${course.name}'.") + dashboardPage.selectCourse(course) + + Log.d(STEP_TAG, "Navigate to People page.") + courseBrowserPage.selectPeople() + + Log.d(STEP_TAG, "Click on teacher: '${teacher.name}' to open People Details Page.") + peopleListPage.selectPerson(teacher) + + Log.d(ASSERTION_TAG, "Assert that People Details Page displays correct: '${teacher.name}'.") + personDetailsPage.assertIsPerson(teacher.name) + + Log.d(STEP_TAG, "Click on the 'Compose' button on People Details Page.") + personDetailsPage.clickCompose() + + Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from People Details page FAB.") + inboxComposePage.assertBodyText("\n\n---\nLoyal member of Instructure") + } + } \ No newline at end of file diff --git a/apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/classic/SettingsE2ETest.kt b/apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/classic/SettingsE2ETest.kt index 71cf81e941..196408a926 100644 --- a/apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/classic/SettingsE2ETest.kt +++ b/apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/classic/SettingsE2ETest.kt @@ -649,4 +649,177 @@ class SettingsE2ETest : TeacherComposeTest() { Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature text is displayed by default since we logged back with '${teacher.name}' teacher.") inboxComposePage.assertBodyText("\n\n---\nPresident of AC Milan\nVice President of Ferencvaros") } + + @E2E + @Test + @TestMetaData(Priority.BUG_CASE, FeatureCategory.INBOX, TestCategory.E2E, SecondaryFeatureCategory.INBOX_SIGNATURE) + fun testInboxSignaturesFABButtonWithDifferentUsersE2E() { + + //Bug Ticket: MBL-18929 + Log.d(PREPARATION_TAG, "Seeding data.") + val data = seedData(teachers = 2, students = 1, courses = 1) + val teacher = data.teachersList[0] + val teacher2 = data.teachersList[1] + val student = data.studentsList[0] + val course = data.coursesList[0] + + Log.d(STEP_TAG, "Click 'Find My School' button.") + loginLandingPage.clickFindMySchoolButton() + + Log.d(STEP_TAG, "Enter domain: '${CanvasNetworkAdapter.canvasDomain}'") + loginFindSchoolPage.enterDomain(CanvasNetworkAdapter.canvasDomain) + + Log.d(STEP_TAG, "Click on 'Next' button on the toolbar.") + loginFindSchoolPage.clickToolbarNextMenuItem() + + Log.d(STEP_TAG, "Login with user: '${teacher.name}', login id: '${teacher.loginId}'.") + loginSignInPage.loginAs(teacher) + dashboardPage.waitForRender() + + Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.") + dashboardPage.openLeftSideMenu() + + Log.d(STEP_TAG, "Navigate to Settings Page on the left-side menu.") + leftSideNavigationDrawerPage.clickSettingsMenu() + + Log.d(ASSERTION_TAG, "Assert that by default the Inbox Signature is 'Not Set'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Not Set") + + Log.d(STEP_TAG, "Click on the 'Inbox Signature' settings.") + settingsPage.clickOnSettingsItem("Inbox Signature") + + Log.d(ASSERTION_TAG, "Assert that by default the 'Inbox Signature' toggle is turned off.") + inboxSignatureSettingsPage.assertSignatureEnabledState(false) + + val signatureText = "Best Regards\nCanvas Teacher" + Log.d(STEP_TAG, "Turn on the 'Inbox Signature' and set the inbox signature text to: '$signatureText'. Save the changes.") + inboxSignatureSettingsPage.toggleSignatureEnabledState() + inboxSignatureSettingsPage.changeSignatureText(signatureText) + inboxSignatureSettingsPage.saveChanges() + + Log.d(ASSERTION_TAG, "Assert that the 'Inbox settings saved!' toast message is displayed.") + checkToastText(R.string.inboxSignatureSettingsUpdated, activityRule.activity) + + Log.d(STEP_TAG, "Refresh the Settings page.") + settingsPage.refresh() + + Log.d(ASSERTION_TAG, "Assert that the Inbox Signature became 'Enabled'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Enabled") + + Log.d(STEP_TAG, "Navigate back to the Dashboard.") + Espresso.pressBack() + + Log.d(STEP_TAG, "Select course: '${course.name}'.") + dashboardPage.selectCourse(course) + + Log.d(STEP_TAG, "Navigate to People page.") + courseBrowserPage.openPeopleTab() + + Log.d(STEP_TAG, "Click on student: '${student.name}' to open Student Context Page.") + peopleListPage.clickPerson(student) + + Log.d(ASSERTION_TAG, "Assert that Student Context Page displays correct student.") + studentContextPage.assertDisplaysStudentInfo(student.shortName, student.loginId) + + Log.d(STEP_TAG, "Click on the 'Compose' button on Student Context Page.") + studentContextPage.clickOnNewMessageButton() + + Log.d(ASSERTION_TAG, "Assert that the inbox signature: '${signatureText}' text is displayed when composing message from Student Context page FAB.") + inboxComposePage.assertBodyText("\n\n---\nBest Regards\nCanvas Teacher") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Navigate back to Dashboard.") + pressBackButton(3) + + Log.d(STEP_TAG, "Click on 'Change User' button on the Left Side Navigation Drawer menu.") + leftSideNavigationDrawerPage.clickChangeUserMenu() + + Log.d(STEP_TAG, "Click on the 'Find another school' button.") + loginLandingPage.clickFindAnotherSchoolButton() + + Log.d(STEP_TAG, "Enter domain: '${CanvasNetworkAdapter.canvasDomain}'") + loginFindSchoolPage.enterDomain(CanvasNetworkAdapter.canvasDomain) + + Log.d(STEP_TAG, "Click on 'Next' button on the toolbar.") + loginFindSchoolPage.clickToolbarNextMenuItem() + + Log.d(STEP_TAG, "Login with the other user: '${teacher2.name}', login id: '${teacher2.loginId}'.") + loginSignInPage.loginAs(teacher2) + dashboardPage.waitForRender() + + Log.d(STEP_TAG, "Select course: '${course.name}'.") + dashboardPage.selectCourse(course) + + Log.d(STEP_TAG, "Navigate to People page.") + courseBrowserPage.openPeopleTab() + + Log.d(STEP_TAG, "Click on student: '${student.name}' to open Student Context Page.") + peopleListPage.clickPerson(student) + + Log.d(ASSERTION_TAG, "Assert that Student Context Page displays correct student.") + studentContextPage.assertDisplaysStudentInfo(student.shortName, student.loginId) + + Log.d(STEP_TAG, "Click on the 'Compose' button on Student Context Page.") + studentContextPage.clickOnNewMessageButton() + + Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature text is NOT displayed since it was set for another user.") + inboxComposePage.assertBodyText("") + + Log.d(STEP_TAG, "Click on the 'Close' (X) button on the Compose New Message Page.") + inboxComposePage.clickOnCloseButton() + + Log.d(STEP_TAG, "Navigate back to Dashboard.") + pressBackButton(3) + + Log.d(STEP_TAG, "Open the Left Side Navigation Drawer menu.") + dashboardPage.openLeftSideMenu() + + Log.d(STEP_TAG, "Navigate to Settings Page on the Left Side Navigation Drawer menu.") + leftSideNavigationDrawerPage.clickSettingsMenu() + + Log.d(ASSERTION_TAG, "Assert that by default the Inbox Signature is 'Not Set'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Not Set") + + Log.d(STEP_TAG, "Click on the 'Inbox Signature' settings.") + settingsPage.clickOnSettingsItem("Inbox Signature") + + Log.d(ASSERTION_TAG, "Assert that by default the 'Inbox Signature' toggle is turned off.") + inboxSignatureSettingsPage.assertSignatureEnabledState(false) + + val secondSignatureText = "Loyal member of Instructure" + Log.d(STEP_TAG, "Turn on the 'Inbox Signature' and set the inbox signature text to: '$secondSignatureText'. Save the changes.") + inboxSignatureSettingsPage.toggleSignatureEnabledState() + inboxSignatureSettingsPage.changeSignatureText(secondSignatureText) + inboxSignatureSettingsPage.saveChanges() + + Log.d(STEP_TAG, "Refresh the Settings page.") + settingsPage.refresh() + + Log.d(ASSERTION_TAG, "Assert that the Inbox Signature became 'Enabled'.") + settingsPage.assertSettingsItemDisplayed("Inbox Signature", "Enabled") + + Log.d(STEP_TAG, "Navigate back to the Dashboard.") + Espresso.pressBack() + + Log.d(STEP_TAG, "Select course: '${course.name}'.") + dashboardPage.selectCourse(course) + + Log.d(STEP_TAG, "Navigate to People page.") + courseBrowserPage.openPeopleTab() + + Log.d(STEP_TAG, "Click on student: '${student.name}' to open Student Context Page.") + peopleListPage.clickPerson(student) + + Log.d(ASSERTION_TAG, "Assert that Student Context Page displays correct student.") + studentContextPage.assertDisplaysStudentInfo(student.shortName, student.loginId) + + Log.d(STEP_TAG, "Click on the 'Compose' button on Student Context Page.") + studentContextPage.clickOnNewMessageButton() + + Log.d(ASSERTION_TAG, "Assert that the previously set inbox signature: '$secondSignatureText' text is displayed when composing message from People Details page FAB.") + inboxComposePage.assertBodyText("\n\n---\nLoyal member of Instructure") + } + } \ No newline at end of file