-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2664 from instructure/release/parent-3.14.0-54
Release Parent 3.14.0 (54)
- Loading branch information
Showing
1,052 changed files
with
34,086 additions
and
8,269 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
95 changes: 95 additions & 0 deletions
95
...ava/com/instructure/parentapp/ui/compose/courses/details/frontpage/FrontPageScreenTest.kt
This file contains 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,95 @@ | ||
/* | ||
* Copyright (C) 2024 - present Instructure, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.instructure.parentapp.ui.compose.courses.details.frontpage | ||
|
||
import androidx.compose.ui.test.assertHasClickAction | ||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithTag | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import com.instructure.parentapp.features.courses.details.frontpage.FrontPageContent | ||
import com.instructure.parentapp.features.courses.details.frontpage.FrontPageUiState | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
|
||
@RunWith(AndroidJUnit4::class) | ||
class FrontPageScreenTest { | ||
|
||
@get:Rule | ||
val composeTestRule = createComposeRule() | ||
|
||
@Test | ||
fun assertLoadingContent() { | ||
composeTestRule.setContent { | ||
FrontPageContent( | ||
uiState = FrontPageUiState( | ||
isLoading = true | ||
), | ||
actionHandler = {}, | ||
applyOnWebView = {}, | ||
onLtiButtonPressed = {} | ||
) | ||
} | ||
|
||
composeTestRule.onNodeWithTag("loading") | ||
.assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun assertErrorContent() { | ||
composeTestRule.setContent { | ||
FrontPageContent( | ||
uiState = FrontPageUiState( | ||
isLoading = false, | ||
isError = true | ||
), | ||
actionHandler = {}, | ||
applyOnWebView = {}, | ||
onLtiButtonPressed = {} | ||
) | ||
} | ||
|
||
composeTestRule.onNodeWithText("An unexpected error occurred.") | ||
.assertIsDisplayed() | ||
composeTestRule.onNodeWithText("Retry") | ||
.assertIsDisplayed() | ||
.assertHasClickAction() | ||
} | ||
|
||
@Test | ||
fun assertCourseDetailsContent() { | ||
composeTestRule.setContent { | ||
FrontPageContent( | ||
uiState = FrontPageUiState( | ||
isLoading = false, | ||
isError = false, | ||
htmlContent = "Front page content" | ||
), | ||
actionHandler = {}, | ||
applyOnWebView = {}, | ||
onLtiButtonPressed = {} | ||
) | ||
} | ||
|
||
composeTestRule.onNodeWithTag("CourseDetailsWebViewScreen") | ||
.assertIsDisplayed() | ||
} | ||
} |
132 changes: 132 additions & 0 deletions
132
...st/java/com/instructure/parentapp/ui/compose/courses/details/summary/SummaryScreenTest.kt
This file contains 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,132 @@ | ||
/* | ||
* 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.parentapp.ui.compose.courses.details.summary | ||
|
||
import androidx.compose.ui.test.assertHasClickAction | ||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithTag | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import com.instructure.canvasapi2.models.ScheduleItem | ||
import com.instructure.canvasapi2.utils.toApiString | ||
import com.instructure.canvasapi2.utils.toSimpleDate | ||
import com.instructure.pandautils.utils.toFormattedString | ||
import com.instructure.parentapp.features.courses.details.summary.ScreenState | ||
import com.instructure.parentapp.features.courses.details.summary.SummaryContent | ||
import com.instructure.parentapp.features.courses.details.summary.SummaryUiState | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import java.util.Calendar | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class SummaryScreenTest { | ||
@get:Rule | ||
val composeTestRule = createComposeRule() | ||
|
||
@Test | ||
fun assertLoadingContent() { | ||
composeTestRule.setContent { | ||
SummaryContent( | ||
uiState = SummaryUiState( | ||
state = ScreenState.Loading | ||
), | ||
onRefresh = {}, | ||
navigateToAssignmentDetails = { _, _ ->}, | ||
navigateToCalendarEvent = { _, _, _ ->} | ||
) | ||
} | ||
|
||
composeTestRule.onNodeWithTag("Loading") | ||
.assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun assertErrorContent() { | ||
composeTestRule.setContent { | ||
SummaryContent( | ||
uiState = SummaryUiState( | ||
state = ScreenState.Error | ||
), | ||
onRefresh = {}, | ||
navigateToAssignmentDetails = { _, _ ->}, | ||
navigateToCalendarEvent = { _, _, _ ->} | ||
) | ||
} | ||
|
||
composeTestRule.onNodeWithText("Failed to load summary") | ||
.assertIsDisplayed() | ||
composeTestRule.onNodeWithText("Retry") | ||
.assertIsDisplayed() | ||
.assertHasClickAction() | ||
} | ||
|
||
@Test | ||
fun assertEmptyContent() { | ||
composeTestRule.setContent { | ||
SummaryContent( | ||
uiState = SummaryUiState( | ||
state = ScreenState.Empty | ||
), | ||
onRefresh = {}, | ||
navigateToAssignmentDetails = { _, _ ->}, | ||
navigateToCalendarEvent = { _, _, _ ->} | ||
) | ||
} | ||
|
||
composeTestRule.onNodeWithText("No summary items to display") | ||
.assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun assertSuccessContent() { | ||
val assignmentDueDate = Calendar.getInstance().apply { add(Calendar.DAY_OF_MONTH, 1) } | ||
composeTestRule.setContent { | ||
SummaryContent( | ||
uiState = SummaryUiState( | ||
state = ScreenState.Content, | ||
courseId = 1, | ||
items = listOf( | ||
ScheduleItem( | ||
title = "Assignment 1", | ||
startAt = assignmentDueDate.time.toApiString(), | ||
type = "assignment" | ||
), | ||
ScheduleItem( | ||
title = "Calendar 1", | ||
type = "event" | ||
) | ||
) | ||
), | ||
onRefresh = {}, | ||
navigateToAssignmentDetails = { _, _ ->}, | ||
navigateToCalendarEvent = { _, _, _ ->} | ||
) | ||
} | ||
|
||
composeTestRule.onNodeWithText("Assignment 1") | ||
.assertIsDisplayed() | ||
composeTestRule.onNodeWithText(assignmentDueDate.time.toApiString().toSimpleDate()?.toFormattedString().orEmpty()) | ||
.assertIsDisplayed() | ||
|
||
composeTestRule.onNodeWithText("Calendar 1") | ||
.assertIsDisplayed() | ||
composeTestRule.onNodeWithText("No Due Date") | ||
.assertIsDisplayed() | ||
} | ||
} |
Oops, something went wrong.