Skip to content

Commit 9f39ce5

Browse files
committed
Merge branch 'master' into MBL-19803-Implement-E2E-test-for-send-message-from-All-Submissions-page
2 parents 699f436 + 489552c commit 9f39ce5

78 files changed

Lines changed: 934 additions & 390 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/LoginE2ETest.kt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
*/
1717
package com.instructure.parentapp.ui.e2e.compose
1818

19+
import android.app.Instrumentation
1920
import android.util.Log
2021
import androidx.test.espresso.Espresso
22+
import androidx.test.espresso.intent.Intents
23+
import androidx.test.espresso.intent.matcher.IntentMatchers
2124
import com.instructure.canvas.espresso.FeatureCategory
2225
import com.instructure.canvas.espresso.Priority
2326
import com.instructure.canvas.espresso.SecondaryFeatureCategory
@@ -449,4 +452,34 @@ class LoginE2ETest : ParentComposeTest() {
449452
loginSignInPage.assertPageObjects()
450453
}
451454

455+
@E2E
456+
@Test
457+
@TestMetaData(Priority.NICE_TO_HAVE, FeatureCategory.LOGIN, TestCategory.E2E)
458+
fun testLoginHowDoIFindMySchoolE2E() {
459+
460+
Log.d(STEP_TAG, "Click 'Find My School' button.")
461+
loginLandingPage.clickFindMySchoolButton()
462+
463+
Log.d(STEP_TAG, "Enter and invalid domain to trigger the 'Tap here for login help.' link to be displayed.")
464+
loginFindSchoolPage.enterDomain("invalid-domain")
465+
466+
Log.d(ASSERTION_TAG, "Assert that the 'Tap here for login help.' link is displayed.")
467+
loginFindSchoolPage.assertHowDoIFindMySchoolLinkDisplayed()
468+
469+
val expectedUrl = "https://community.instructure.com/en/kb/articles/662717-where-do-i-find-my-institutions-url-to-access-canvas"
470+
val expectedIntent = IntentMatchers.hasData(expectedUrl)
471+
Intents.init()
472+
try {
473+
Intents.intending(expectedIntent).respondWith(Instrumentation.ActivityResult(0, null))
474+
475+
Log.d(STEP_TAG, "Click on the 'Tap here for login help.' link.")
476+
loginFindSchoolPage.clickOnHowDoIFindMySchoolLink()
477+
478+
Log.d(ASSERTION_TAG, "Assert that an intent with the correct URL was fired.")
479+
Intents.intended(expectedIntent)
480+
} finally {
481+
Intents.release()
482+
}
483+
}
484+
452485
}

apps/parent/src/main/java/com/instructure/parentapp/features/alerts/list/AlertsScreen.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import androidx.compose.foundation.background
2323
import androidx.compose.foundation.clickable
2424
import androidx.compose.foundation.layout.Box
2525
import androidx.compose.foundation.layout.Column
26-
import androidx.compose.foundation.layout.PaddingValues
2726
import androidx.compose.foundation.layout.Row
2827
import androidx.compose.foundation.layout.Spacer
2928
import androidx.compose.foundation.layout.fillMaxSize
@@ -39,6 +38,7 @@ import androidx.compose.foundation.verticalScroll
3938
import androidx.compose.material.ExperimentalMaterialApi
4039
import androidx.compose.material.Icon
4140
import androidx.compose.material.IconButton
41+
import androidx.compose.material.Scaffold
4242
import androidx.compose.material.Text
4343
import androidx.compose.material.pullrefresh.PullRefreshIndicator
4444
import androidx.compose.material.pullrefresh.pullRefresh
@@ -66,7 +66,6 @@ import com.instructure.canvasapi2.utils.ContextKeeper
6666
import com.instructure.canvasapi2.utils.DateHelper
6767
import com.instructure.pandautils.R
6868
import com.instructure.pandautils.compose.CanvasTheme
69-
import com.instructure.pandautils.compose.composables.CanvasScaffold
7069
import com.instructure.pandautils.compose.composables.EmptyContent
7170
import com.instructure.pandautils.compose.composables.ErrorContent
7271
import com.instructure.pandautils.compose.composables.Loading
@@ -83,7 +82,7 @@ fun AlertsScreen(
8382
lazyListState: LazyListState = LazyListState()
8483
) {
8584
CanvasTheme {
86-
CanvasScaffold(
85+
Scaffold(
8786
backgroundColor = colorResource(id = R.color.backgroundLightest),
8887
content = { padding ->
8988
val pullRefreshState = rememberPullRefreshState(
@@ -129,8 +128,9 @@ fun AlertsScreen(
129128
uiState = uiState,
130129
actionHandler = actionHandler,
131130
lazyListState = lazyListState,
132-
scaffoldPadding = padding,
133-
modifier = Modifier.fillMaxSize()
131+
modifier = Modifier
132+
.padding(padding)
133+
.fillMaxSize()
134134
)
135135
}
136136
}
@@ -155,13 +155,11 @@ fun AlertsListContent(
155155
uiState: AlertsUiState,
156156
actionHandler: (AlertsAction) -> Unit,
157157
lazyListState: LazyListState,
158-
modifier: Modifier = Modifier,
159-
scaffoldPadding: PaddingValues = PaddingValues(0.dp)
158+
modifier: Modifier = Modifier
160159
) {
161160
LazyColumn(
162161
state = lazyListState,
163-
modifier = modifier.testTag("alertsList"),
164-
contentPadding = scaffoldPadding
162+
modifier = modifier.testTag("alertsList")
165163
) {
166164
items(uiState.alerts, key = { it.alertId }) { alert ->
167165
AlertsListItem(

apps/parent/src/main/java/com/instructure/parentapp/features/alerts/settings/AlertSettingsScreen.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ import com.instructure.canvasapi2.models.ThresholdWorkflowState
7676
import com.instructure.canvasapi2.models.User
7777
import com.instructure.canvasapi2.utils.ContextKeeper
7878
import com.instructure.pandautils.compose.CanvasTheme
79-
import com.instructure.pandautils.compose.composables.CanvasAppBar
8079
import com.instructure.pandautils.compose.composables.CanvasScaffold
8180
import com.instructure.pandautils.compose.composables.CanvasSwitch
81+
import com.instructure.pandautils.compose.composables.CanvasThemedAppBar
8282
import com.instructure.pandautils.compose.composables.ErrorContent
8383
import com.instructure.pandautils.compose.composables.Loading
8484
import com.instructure.pandautils.compose.composables.OverflowMenu
@@ -103,13 +103,13 @@ fun AlertSettingsScreen(
103103
CanvasScaffold(
104104
backgroundColor = colorResource(id = R.color.backgroundLightest),
105105
topBar = {
106-
CanvasAppBar(
106+
CanvasThemedAppBar(
107107
title = stringResource(id = R.string.alertSettingsTitle),
108108
navIconRes = R.drawable.ic_back_arrow,
109109
navIconContentDescription = stringResource(id = R.string.back),
110110
navigationActionClick = navigationActionClick,
111111
backgroundColor = Color(uiState.userColor),
112-
textColor = colorResource(id = R.color.textLightest),
112+
contentColor = colorResource(id = R.color.textLightest),
113113
actions = {
114114
var showMenu by rememberSaveable { mutableStateOf(false) }
115115
var showConfirmationDialog by rememberSaveable { mutableStateOf(false) }

apps/parent/src/main/java/com/instructure/parentapp/features/courses/details/grades/ParentGradesScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ internal fun ParentGradesScreen(
4747
}
4848
}
4949

50-
GradesScreen(gradesUiState, gradesViewModel::handleAction, ParentPrefs.currentStudent.studentColor)
50+
GradesScreen(gradesUiState, gradesViewModel::handleAction, ParentPrefs.currentStudent.studentColor, applyInsets = false)
5151
}

apps/parent/src/main/java/com/instructure/parentapp/features/courses/list/CoursesScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import androidx.compose.foundation.lazy.items
2929
import androidx.compose.foundation.rememberScrollState
3030
import androidx.compose.foundation.verticalScroll
3131
import androidx.compose.material.ExperimentalMaterialApi
32+
import androidx.compose.material.Scaffold
3233
import androidx.compose.material.Text
3334
import androidx.compose.material.pullrefresh.PullRefreshIndicator
3435
import androidx.compose.material.pullrefresh.pullRefresh
@@ -48,7 +49,6 @@ import androidx.compose.ui.unit.dp
4849
import androidx.compose.ui.unit.sp
4950
import com.instructure.pandautils.R
5051
import com.instructure.pandautils.compose.CanvasTheme
51-
import com.instructure.pandautils.compose.composables.CanvasScaffold
5252
import com.instructure.pandautils.compose.composables.EmptyContent
5353
import com.instructure.pandautils.compose.composables.ErrorContent
5454

@@ -62,7 +62,7 @@ internal fun CoursesScreen(
6262
lazyListState: LazyListState = LazyListState()
6363
) {
6464
CanvasTheme {
65-
CanvasScaffold(
65+
Scaffold(
6666
backgroundColor = colorResource(id = R.color.backgroundLightest),
6767
content = { padding ->
6868
val pullRefreshState = rememberPullRefreshState(

apps/parent/src/main/java/com/instructure/parentapp/features/main/MainActivity.kt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import android.os.Build
2727
import android.os.Bundle
2828
import android.util.Log
2929
import androidx.activity.result.contract.ActivityResultContracts
30+
import androidx.core.graphics.Insets
3031
import androidx.core.view.ViewCompat
3132
import androidx.core.view.WindowInsetsCompat
3233
import androidx.lifecycle.lifecycleScope
@@ -114,7 +115,28 @@ class MainActivity : BaseCanvasActivity(), OnUnreadCountInvalidated, Masqueradin
114115
rightPadding,
115116
0
116117
)
117-
insets
118+
119+
// Consume horizontal insets so child ComposeViews don't apply them again
120+
WindowInsetsCompat.Builder(insets)
121+
.setInsets(
122+
WindowInsetsCompat.Type.navigationBars(),
123+
Insets.of(
124+
0, // Consume left
125+
navigationBars.top,
126+
0, // Consume right
127+
navigationBars.bottom
128+
)
129+
)
130+
.setInsets(
131+
WindowInsetsCompat.Type.displayCutout(),
132+
Insets.of(
133+
0, // Consume left
134+
displayCutout.top,
135+
0, // Consume right
136+
displayCutout.bottom
137+
)
138+
)
139+
.build()
118140
}
119141
}
120142

apps/student/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ android {
3838
applicationId "com.instructure.candroid"
3939
minSdkVersion Versions.MIN_SDK
4040
targetSdkVersion Versions.TARGET_SDK
41-
versionCode = 287
42-
versionName = '8.5.0'
41+
versionCode = 289
42+
versionName = '8.6.1'
4343

4444
vectorDrawables.useSupportLibrary = true
4545
testInstrumentationRunner 'com.instructure.student.espresso.StudentHiltTestRunner'

apps/student/src/androidTest/java/com/instructure/student/ui/e2e/classic/LoginE2ETest.kt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
*/
1717
package com.instructure.student.ui.e2e.classic
1818

19+
import android.app.Instrumentation
1920
import android.util.Log
2021
import androidx.test.espresso.Espresso
22+
import androidx.test.espresso.intent.Intents
23+
import androidx.test.espresso.intent.matcher.IntentMatchers
2124
import com.instructure.canvas.espresso.FeatureCategory
2225
import com.instructure.canvas.espresso.Priority
2326
import com.instructure.canvas.espresso.SecondaryFeatureCategory
@@ -37,6 +40,7 @@ import com.instructure.dataseeding.model.EnrollmentTypes.STUDENT_ENROLLMENT
3740
import com.instructure.dataseeding.model.EnrollmentTypes.TEACHER_ENROLLMENT
3841
import com.instructure.dataseeding.util.CanvasNetworkAdapter
3942
import com.instructure.espresso.withIdlingResourceDisabled
43+
import com.instructure.student.R
4044
import com.instructure.student.ui.utils.StudentTest
4145
import com.instructure.student.ui.utils.extensions.enterDomain
4246
import com.instructure.student.ui.utils.extensions.seedData
@@ -416,6 +420,58 @@ class LoginE2ETest : StudentTest() {
416420
loginSignInPage.assertPageObjects()
417421
}
418422

423+
@E2E
424+
@Test
425+
@TestMetaData(Priority.NICE_TO_HAVE, FeatureCategory.LOGIN, TestCategory.E2E)
426+
fun testLoginHowDoIFindMySchoolE2E() {
427+
428+
Log.d(STEP_TAG, "Click 'Find My School' button.")
429+
loginLandingPage.clickFindMySchoolButton()
430+
431+
Log.d(STEP_TAG, "Enter and invalid domain to trigger the 'Tap here for login help.' link to be displayed.")
432+
loginFindSchoolPage.enterDomain("invalid-domain")
433+
434+
Log.d(ASSERTION_TAG, "Assert that the 'Tap here for login help.' link is displayed.")
435+
loginFindSchoolPage.assertHowDoIFindMySchoolLinkDisplayed()
436+
437+
val expectedUrl = "https://community.instructure.com/en/kb/articles/662717-where-do-i-find-my-institutions-url-to-access-canvas"
438+
val expectedIntent = IntentMatchers.hasData(expectedUrl)
439+
Intents.init()
440+
try {
441+
Intents.intending(expectedIntent).respondWith(Instrumentation.ActivityResult(0, null))
442+
443+
Log.d(STEP_TAG, "Click on the 'Tap here for login help.' link.")
444+
loginFindSchoolPage.clickOnHowDoIFindMySchoolLink()
445+
446+
Log.d(ASSERTION_TAG, "Assert that an intent with the correct URL was fired.")
447+
Intents.intended(expectedIntent)
448+
} finally {
449+
Intents.release()
450+
}
451+
}
452+
453+
@E2E
454+
@Test
455+
@TestMetaData(Priority.MANDATORY, FeatureCategory.LOGIN, TestCategory.E2E)
456+
fun testLoginCanFindSchoolE2E() {
457+
458+
Log.d(STEP_TAG, "Click 'Find My School' button.")
459+
loginLandingPage.clickFindMySchoolButton()
460+
461+
Log.d(ASSERTION_TAG, "Assert that the Find School Page has been displayed properly.")
462+
loginFindSchoolPage.assertPageObjects()
463+
464+
Log.d(ASSERTION_TAG, "Assert that the hint text is correct based on the device type.")
465+
if(isTabletDevice()) loginFindSchoolPage.assertHintText(R.string.schoolInstructureCom)
466+
else loginFindSchoolPage.assertHintText(R.string.loginHint)
467+
468+
Log.d(STEP_TAG, "Enter domain: 'harvest'.")
469+
loginFindSchoolPage.enterDomain("harvest")
470+
471+
Log.d(ASSERTION_TAG, "Assert that the 'City Harvest Church (Singapore)' school is displayed among the search results.")
472+
loginFindSchoolPage.assertSchoolSearchResults("City Harvest Church (Singapore)")
473+
}
474+
419475
private fun loginWithUser(user: CanvasUserApiModel, lastSchoolSaved: Boolean = false) {
420476

421477
Thread.sleep(5100) //Need to wait > 5 seconds before each login attempt because of new 'too many attempts' login policy on web.

apps/student/src/androidTest/java/com/instructure/student/ui/interaction/LoginInteractionTest.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import com.instructure.canvas.espresso.FeatureCategory
1919
import com.instructure.canvas.espresso.Priority
2020
import com.instructure.canvas.espresso.TestCategory
2121
import com.instructure.canvas.espresso.TestMetaData
22-
import com.instructure.student.R
2322
import com.instructure.student.ui.utils.StudentTest
2423
import dagger.hilt.android.testing.HiltAndroidTest
2524
import org.junit.Test
@@ -29,19 +28,6 @@ class LoginInteractionTest : StudentTest() {
2928

3029
override fun displaysPageObjects() = Unit // Not used for interaction tests
3130

32-
@Test
33-
@TestMetaData(Priority.MANDATORY, FeatureCategory.LOGIN, TestCategory.INTERACTION)
34-
fun testLogin_canFindSchool() {
35-
loginLandingPage.clickFindMySchoolButton()
36-
loginFindSchoolPage.assertPageObjects()
37-
38-
if(isTabletDevice()) loginFindSchoolPage.assertHintText(R.string.schoolInstructureCom)
39-
else loginFindSchoolPage.assertHintText(R.string.loginHint)
40-
41-
loginFindSchoolPage.enterDomain("harvest")
42-
loginFindSchoolPage.assertSchoolSearchResults("City Harvest Church (Singapore)")
43-
}
44-
4531
@Test
4632
@TestMetaData(Priority.MANDATORY, FeatureCategory.LOGIN, TestCategory.INTERACTION)
4733
fun testLogin_qrTutorialPageLoads() {

apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentListFragment.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*
1616
*/ package com.instructure.student.AnnotationComments
1717

18+
import android.content.res.Configuration
1819
import android.os.Bundle
1920
import android.view.LayoutInflater
2021
import android.view.View
@@ -146,6 +147,11 @@ class AnnotationCommentListFragment : ParentFragment() {
146147
assigneeId))
147148
}
148149

150+
override fun onConfigurationChanged(newConfig: Configuration) {
151+
super.onConfigurationChanged(newConfig)
152+
ViewStyler.setStatusBarLightDelayed(requireActivity())
153+
}
154+
149155
fun configureRecyclerView() {
150156
val layoutManager = LinearLayoutManager(requireContext())
151157
layoutManager.orientation = RecyclerView.VERTICAL

0 commit comments

Comments
 (0)