Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading
Loading