-
Notifications
You must be signed in to change notification settings - Fork 107
[MBL-18703][Student][Teacher][Parent] Implement E2E tests for Calendar event/todo reminders #3385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adamNagy56
wants to merge
6
commits into
master
Choose a base branch
from
MBL-18703-Implement-E2E-test-for-Calendar-event-todo-reminder
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4bc805d
Implement E2E tests for Calendar event and To Do reminders.
adam1014-ai 510a7d9
Merge branch 'master' into MBL-18703-Implement-E2E-test-for-Calendar-…
adam1014-ai d88bcc8
PR findings fix
adam1014-ai c0a7e74
Merge branch 'master' into MBL-18703-Implement-E2E-test-for-Calendar-…
adam1014-ai a041c3b
PR fix
adam1014-ai 5d0b621
Merge branch 'master' into MBL-18703-Implement-E2E-test-for-Calendar-…
adam1014-ai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
509 changes: 509 additions & 0 deletions
509
apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/CalendarE2ETest.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
521 changes: 521 additions & 0 deletions
521
apps/student/src/androidTest/java/com/instructure/student/ui/e2e/compose/CalendarE2ETest.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
521 changes: 521 additions & 0 deletions
521
apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/CalendarE2ETest.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...esso/src/main/kotlin/com/instructure/canvas/espresso/common/pages/CalendarReminderPage.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| /* | ||
| * Copyright (C) 2024 - present Instructure, Inc. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, version 3 of the License. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
| package com.instructure.canvas.espresso.common.pages | ||
|
|
||
| import android.widget.DatePicker | ||
| import android.widget.TimePicker | ||
| import androidx.compose.ui.test.hasContentDescription | ||
| import androidx.compose.ui.test.isDisplayed | ||
| import androidx.compose.ui.test.junit4.ComposeTestRule | ||
| import androidx.compose.ui.test.onNodeWithContentDescription | ||
| import androidx.compose.ui.test.onNodeWithText | ||
| import androidx.compose.ui.test.performClick | ||
| import androidx.test.espresso.Espresso.onData | ||
| import androidx.test.espresso.Espresso.onView | ||
| import androidx.test.espresso.action.ViewActions.click | ||
| import androidx.test.espresso.assertion.ViewAssertions.doesNotExist | ||
| import androidx.test.espresso.contrib.PickerActions | ||
| import androidx.test.espresso.matcher.RootMatchers.isDialog | ||
| import androidx.test.espresso.matcher.ViewMatchers.withClassName | ||
| import androidx.test.espresso.matcher.ViewMatchers.withId | ||
| import androidx.test.espresso.matcher.ViewMatchers.withText | ||
| import com.instructure.espresso.click | ||
| import com.instructure.espresso.matchers.WaitForViewMatcher.waitForView | ||
| import com.instructure.espresso.scrollTo | ||
| import com.instructure.pandautils.R | ||
| import org.hamcrest.Matchers | ||
| import org.hamcrest.Matchers.anything | ||
| import java.util.Calendar | ||
|
|
||
| class CalendarReminderPage(private val composeTestRule: ComposeTestRule) { | ||
adamNagy56 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private val reminderTitle = "Reminder" | ||
| private val reminderDescription = "Add due date reminder notifications about this assignment on this device." | ||
adamNagy56 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private val reminderAdd = "Add reminder" | ||
|
|
||
| fun assertReminderSectionDisplayed() { | ||
| composeTestRule.onNodeWithText(reminderTitle).isDisplayed() | ||
| composeTestRule.onNodeWithText(reminderDescription).isDisplayed() | ||
| composeTestRule.onNodeWithContentDescription(reminderAdd).isDisplayed() | ||
| } | ||
|
|
||
| fun clickBeforeReminderOption(text: String) { | ||
| waitForView(withText(text)).scrollTo().click() | ||
| composeTestRule.waitForIdle() | ||
| } | ||
|
|
||
| fun clickCustomReminderOption() { | ||
| onData(anything()).inRoot(isDialog()).atPosition(6).perform(click()) | ||
| } | ||
|
|
||
| fun clickAddReminder() { | ||
| composeTestRule.onNodeWithContentDescription(reminderAdd).performClick() | ||
| } | ||
|
|
||
| fun assertReminderDisplayedWithText(text: String) { | ||
adamNagy56 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| composeTestRule.onNodeWithText(text).isDisplayed() | ||
| } | ||
|
|
||
| fun removeReminder() { | ||
| composeTestRule.onNode( | ||
| hasContentDescription("Remove") | ||
| ).performClick() | ||
| Thread.sleep(1000) | ||
adamNagy56 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| onView(withText(R.string.yes)).scrollTo().click() | ||
| } | ||
|
|
||
| fun assertReminderNotDisplayedWithText(text: String) { | ||
adamNagy56 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| onView(withText(text)).check(doesNotExist()) | ||
| } | ||
|
|
||
| fun selectDate(calendar: Calendar) { | ||
| onView(withClassName(Matchers.equalTo(DatePicker::class.java.name))) | ||
| .perform(PickerActions.setDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH))) | ||
|
|
||
| onView(withId(android.R.id.button1)).perform(click()) | ||
| } | ||
|
|
||
| fun selectTime(calendar: Calendar) { | ||
| onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))) | ||
| .perform(PickerActions.setTime(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE))) | ||
|
|
||
| onView(withId(android.R.id.button1)).perform(click()) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.