Skip to content

Commit

Permalink
Merge pull request #2664 from instructure/release/parent-3.14.0-54
Browse files Browse the repository at this point in the history
Release Parent 3.14.0 (54)
  • Loading branch information
hermannakos authored Dec 11, 2024
2 parents 18710ff + a7594d8 commit 2de6630
Show file tree
Hide file tree
Showing 1,052 changed files with 34,086 additions and 8,269 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ App | Description
Module | Description
--- | ---
annotations | A wrapper for the PSPDFKit library and logic for annotation handling and converting in PDF documents.
blueprint | An MVP Architecture that depends on PandaRecyclerView. (deprecated)
buildSrc | Library for common gradle dependencies and gradle transformers that are used by the project.
canvas-api-2 | Canvas for Android Api used to talk to the Canvas LMS and is testable.
dataseedingapi | gRPC wrapper for Canvas that enables creating data to test the apps.
Expand Down
2 changes: 1 addition & 1 deletion apps/flutter_parent/lib/l10n/res/intl_fr_CA.arb
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
"placeholders_order": [],
"placeholders": {}
},
"Syllabus": "Programme",
"Syllabus": "Plan de cours",
"@Syllabus": {
"description": "Label for the \"Syllabus\" tab in course details",
"type": "text",
Expand Down
5 changes: 3 additions & 2 deletions apps/flutter_parent/lib/screens/login_landing_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class LoginLandingScreen extends StatelessWidget {
// TODO: needs test
locator<QuickNav>().push(
context,
WebLoginScreen(snicker.domain,
WebLoginScreen(
snicker.domain,
user: snicker.username,
pass: snicker.password),
);
Expand Down Expand Up @@ -361,7 +362,7 @@ class LoginLandingScreen extends StatelessWidget {
locator<QuickNav>().pushRoute(
context,
PandaRouter.loginWeb(lastAccount.item1.domain,
accountName: lastAccount.item1.name!, loginFlow: lastAccount.item2));
accountName: lastAccount.item1.name!, authenticationProvider: lastAccount.item1.authenticationProvider, loginFlow: lastAccount.item2));
}

void _changeLoginFlow(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ class _WebLoginScreenState extends State<WebLoginScreen> {
);
final lastAccount = new SchoolDomain((builder) =>
builder
..authenticationProvider = widget.authenticationProvider
..domain = widget.domain
..name = widget.accountName);
ApiPrefs.setLastAccount(lastAccount, widget.loginFlow);
Expand Down
2 changes: 1 addition & 1 deletion apps/flutter_parent/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ description: Canvas Parent
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.13.0+53
version: 3.14.0+54

module:
androidX: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ package com.instructure.parentapp.ui.compose.courses.details
import androidx.compose.ui.test.assertHasClickAction
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.hasAnyAncestor
import androidx.compose.ui.test.hasContentDescription
import androidx.compose.ui.test.hasParent
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithTag
Expand Down Expand Up @@ -50,6 +52,7 @@ class CourseDetailsScreenTest {
isLoading = true
),
actionHandler = {},
applyOnWebView = {},
navigationActionClick = {}
)
}
Expand All @@ -67,6 +70,7 @@ class CourseDetailsScreenTest {
isError = true
),
actionHandler = {},
applyOnWebView = {},
navigationActionClick = {}
)
}
Expand All @@ -86,9 +90,10 @@ class CourseDetailsScreenTest {
isLoading = false,
isError = false,
courseName = "Course 1",
tabs = listOf(TabType.SYLLABUS, TabType.SUMMARY)
tabs = listOf(TabType.SYLLABUS)
),
actionHandler = {},
applyOnWebView = {},
navigationActionClick = {}
)
}
Expand All @@ -100,21 +105,13 @@ class CourseDetailsScreenTest {
.assertHasClickAction()
composeTestRule.onNodeWithText("Course 1")
.assertIsDisplayed()
composeTestRule.onNodeWithText("SYLLABUS")
.assertIsDisplayed()
composeTestRule.onNodeWithText("SUMMARY")
.assertIsDisplayed()
composeTestRule.onNodeWithTag("courseDetailsTabRow")
.assertIsDisplayed()
composeTestRule.onNodeWithTag("courseDetailsPager")
.assertIsDisplayed()
composeTestRule.onNodeWithContentDescription("Send a message about this course")
.assertIsDisplayed()
.assertHasClickAction()
}

@Test
fun assertCourseDetailsContentWithJustOnTab() {
fun assertCourseDetailsContentWithJustOneTab() {
composeTestRule.setContent {
CourseDetailsScreen(
uiState = CourseDetailsUiState(
Expand All @@ -124,6 +121,7 @@ class CourseDetailsScreenTest {
tabs = listOf(TabType.SYLLABUS)
),
actionHandler = {},
applyOnWebView = {},
navigationActionClick = {}
)
}
Expand All @@ -138,4 +136,25 @@ class CourseDetailsScreenTest {
.assertIsDisplayed()
.assertHasClickAction()
}

@Test
fun assertSnackbarText() {
composeTestRule.setContent {
CourseDetailsScreen(
uiState = CourseDetailsUiState(
isLoading = false,
isError = false,
courseName = "Course 1",
tabs = listOf(TabType.SYLLABUS),
snackbarMessage = "Snackbar message"
),
actionHandler = {},
applyOnWebView = {},
navigationActionClick = {}
)
}

val snackbarText = composeTestRule.onNode(hasText("Snackbar message").and(hasAnyAncestor(hasTestTag("snackbarHost"))))
snackbarText.assertIsDisplayed()
}
}
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()
}
}
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()
}
}
Loading

0 comments on commit 2de6630

Please sign in to comment.