Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package com.instructure.parentapp.utils
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import com.instructure.canvas.espresso.common.pages.AssignmentDetailsPage
import com.instructure.canvas.espresso.common.pages.AssignmentReminderPage
import com.instructure.canvas.espresso.common.pages.CalendarReminderPage
import com.instructure.canvas.espresso.common.pages.compose.CalendarEventCreateEditPage
import com.instructure.canvas.espresso.common.pages.compose.CalendarEventDetailsPage
import com.instructure.canvas.espresso.common.pages.compose.CalendarFilterPage
Expand Down Expand Up @@ -82,6 +83,7 @@ abstract class ParentComposeTest : ParentTest() {
protected val calendarToDoDetailsPage = CalendarToDoDetailsPage(composeTestRule)
protected val calendarFilterPage = CalendarFilterPage(composeTestRule)
protected val assignmentReminderPage = AssignmentReminderPage(composeTestRule)
protected val calendarReminderPage = CalendarReminderPage(composeTestRule)
protected val inboxSignatureSettingsPage = InboxSignatureSettingsPage(composeTestRule)
protected val assignmentDetailsPage = AssignmentDetailsPage(ModuleItemInteractions(), composeTestRule)

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package com.instructure.student.ui.utils

import androidx.compose.ui.test.junit4.createAndroidComposeRule
import com.instructure.canvas.espresso.common.pages.AssignmentReminderPage
import com.instructure.canvas.espresso.common.pages.CalendarReminderPage
import com.instructure.canvas.espresso.common.pages.compose.AssignmentListPage
import com.instructure.canvas.espresso.common.pages.compose.CalendarEventCreateEditPage
import com.instructure.canvas.espresso.common.pages.compose.CalendarEventDetailsPage
Expand Down Expand Up @@ -55,6 +56,7 @@ abstract class StudentComposeTest : StudentTest() {
val calendarFilterPage = CalendarFilterPage(composeTestRule)
val settingsPage = SettingsPage(composeTestRule)
val assignmentReminderPage = AssignmentReminderPage(composeTestRule)
val calendarReminderPage = CalendarReminderPage(composeTestRule)
val inboxDetailsPage = InboxDetailsPage(composeTestRule)
val inboxComposePage = InboxComposePage(composeTestRule)
val recipientPickerPage = RecipientPickerPage(composeTestRule)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.instructure.teacher.ui.utils

import androidx.compose.ui.test.junit4.createAndroidComposeRule
import com.instructure.canvas.espresso.common.pages.CalendarReminderPage
import com.instructure.canvas.espresso.common.pages.compose.AssignmentListPage
import com.instructure.canvas.espresso.common.pages.compose.CalendarEventCreateEditPage
import com.instructure.canvas.espresso.common.pages.compose.CalendarEventDetailsPage
Expand Down Expand Up @@ -52,6 +53,7 @@ abstract class TeacherComposeTest : TeacherTest() {
val calendarToDoCreateUpdatePage = CalendarToDoCreateUpdatePage(composeTestRule)
val calendarToDoDetailsPage = CalendarToDoDetailsPage(composeTestRule)
val calendarFilterPage = CalendarFilterPage(composeTestRule)
val calendarReminderPage = CalendarReminderPage(composeTestRule)
val progressPage = ProgressPage(composeTestRule)
val settingsPage = SettingsPage(composeTestRule)
val inboxDetailsPage = InboxDetailsPage(composeTestRule)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ enum class SecondaryFeatureCategory {
GROUPS_DASHBOARD, GROUPS_FILES, GROUPS_ANNOUNCEMENTS, GROUPS_DISCUSSIONS, GROUPS_PAGES, GROUPS_PEOPLE,
EVENTS_DISCUSSIONS, EVENTS_QUIZZES, EVENTS_ASSIGNMENTS, EVENTS_NOTIFICATIONS, SETTINGS_EMAIL_NOTIFICATIONS,
MODULES_ASSIGNMENTS, MODULES_DISCUSSIONS, MODULES_FILES, MODULES_PAGES, MODULES_QUIZZES, OFFLINE_MODE, ALL_COURSES, CHANGE_USER, ASSIGNMENT_REMINDER, ASSIGNMENT_DETAILS, SMART_SEARCH, ADD_STUDENT,
SYLLABUS, SUMMARY, FRONT_PAGE, CANVAS_NETWORK, INBOX_SIGNATURE, ACCESS_TOKEN_EXPIRATION, SECTIONS, HELP_MENU, DISCUSSION_CHECKPOINTS
SYLLABUS, SUMMARY, FRONT_PAGE, CANVAS_NETWORK, INBOX_SIGNATURE, ACCESS_TOKEN_EXPIRATION, SECTIONS, HELP_MENU, DISCUSSION_CHECKPOINTS,
CALENDAR_EVENT_REMINDER, CALENDAR_TODO_REMINDER
}

enum class TestCategory {
Expand Down
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) {
private val reminderTitle = "Reminder"
private val reminderDescription = "Add due date reminder notifications about this assignment on this device."
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) {
composeTestRule.onNodeWithText(text).isDisplayed()
}

fun removeReminder() {
composeTestRule.onNode(
hasContentDescription("Remove")
).performClick()
Thread.sleep(1000)
onView(withText(R.string.yes)).scrollTo().click()
}

fun assertReminderNotDisplayedWithText(text: String) {
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())
}
}
Loading