From 3dfa07c756665dbc3a4e4b158589d87062c86ee6 Mon Sep 17 00:00:00 2001 From: Akos Hermann Date: Mon, 9 Dec 2024 12:16:46 +0100 Subject: [PATCH 1/4] fix consortia id resolution --- .../instructure/student/router/EnabledTabs.kt | 8 +++++++- .../student/router/EnabledTabsTest.kt | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/apps/student/src/main/java/com/instructure/student/router/EnabledTabs.kt b/apps/student/src/main/java/com/instructure/student/router/EnabledTabs.kt index f667dcdb85..af75ce51d5 100644 --- a/apps/student/src/main/java/com/instructure/student/router/EnabledTabs.kt +++ b/apps/student/src/main/java/com/instructure/student/router/EnabledTabs.kt @@ -43,7 +43,13 @@ class EnabledTabsImpl( } if (uri.pathSegments.contains("courses")) { val courseIdIndex = uri.pathSegments.indexOf("courses") + 1 - val courseId = uri.pathSegments[courseIdIndex] + var courseId = uri.pathSegments[courseIdIndex] + if (courseId.contains("~")) { + val parts = courseId.split("~") + val length = parts[0].length + parts[1].length + val padding = 18 - length + courseId = parts[0] + "0".repeat(padding) + parts[1] + } return !isPathTabEnabled(courseId.toLong(), uri) } diff --git a/apps/student/src/test/java/com/instructure/student/router/EnabledTabsTest.kt b/apps/student/src/test/java/com/instructure/student/router/EnabledTabsTest.kt index a867ee56ff..d089d9a07b 100644 --- a/apps/student/src/test/java/com/instructure/student/router/EnabledTabsTest.kt +++ b/apps/student/src/test/java/com/instructure/student/router/EnabledTabsTest.kt @@ -214,4 +214,20 @@ class EnabledTabsTest { result = enabledTabs.isPathTabNotEnabled(route) assertFalse(result) } + + @Test + fun `replace ~ in consortia courseId to 0s`() = runTest { + coEvery { courseApi.getFirstPageCourses(any()) } returns DataResult.Success( + listOf( + Course(id = 110000000000000012, tabs = listOf(Tab(tabId = "assignments", htmlUrl = "/courses/11~12/assignments"))), + ) + ) + enabledTabs.initTabs() + + val route = Route(uri = mockUri) + every { mockUri.path } returns "http://www.google.com/courses/11~12/assignments" + every { mockUri.pathSegments } returns listOf("courses", "11~12", "assignments") + val result = enabledTabs.isPathTabNotEnabled(route) + assert(result) + } } \ No newline at end of file From a3522d337af1d18576ddc42bb3ed85f7b25afdc3 Mon Sep 17 00:00:00 2001 From: Akos Hermann Date: Mon, 9 Dec 2024 12:17:43 +0100 Subject: [PATCH 2/4] version bump --- apps/student/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/student/build.gradle b/apps/student/build.gradle index 6068aeb8ac..1870e58b35 100644 --- a/apps/student/build.gradle +++ b/apps/student/build.gradle @@ -38,8 +38,8 @@ android { applicationId "com.instructure.candroid" minSdkVersion Versions.MIN_SDK targetSdkVersion Versions.TARGET_SDK - versionCode = 270 - versionName = '7.8.0' + versionCode = 271 + versionName = '7.8.1' vectorDrawables.useSupportLibrary = true testInstrumentationRunner 'com.instructure.student.espresso.StudentHiltTestRunner' From e5e526fb96bab6310b60a5831a4e070dadb4c5bb Mon Sep 17 00:00:00 2001 From: Akos Hermann Date: Mon, 9 Dec 2024 15:21:12 +0100 Subject: [PATCH 3/4] stub test --- .../student/ui/e2e/offline/OfflineAssignmentsE2ETest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineAssignmentsE2ETest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineAssignmentsE2ETest.kt index 94734038fa..4fd917a814 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineAssignmentsE2ETest.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/offline/OfflineAssignmentsE2ETest.kt @@ -21,6 +21,7 @@ import com.instructure.canvas.espresso.FeatureCategory import com.instructure.canvas.espresso.OfflineE2E import com.instructure.canvas.espresso.Priority import com.instructure.canvas.espresso.SecondaryFeatureCategory +import com.instructure.canvas.espresso.Stub import com.instructure.canvas.espresso.TestCategory import com.instructure.canvas.espresso.TestMetaData import com.instructure.dataseeding.api.AssignmentGroupsApi @@ -48,6 +49,7 @@ class OfflineAssignmentsE2ETest : StudentTest() { override fun enableAndConfigureAccessibilityChecks() = Unit + @Stub @OfflineE2E @Test @TestMetaData(Priority.MANDATORY, FeatureCategory.ASSIGNMENTS, TestCategory.E2E, SecondaryFeatureCategory.OFFLINE_MODE) From 27a082deb83dcd05c28386647c3e32c7e8cfc808 Mon Sep 17 00:00:00 2001 From: Akos Hermann Date: Tue, 10 Dec 2024 10:36:42 +0100 Subject: [PATCH 4/4] stub test --- .../java/com/instructure/student/ui/e2e/AssignmentsE2ETest.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/AssignmentsE2ETest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/AssignmentsE2ETest.kt index dd3447c0fd..7dfe268665 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/AssignmentsE2ETest.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/e2e/AssignmentsE2ETest.kt @@ -748,6 +748,7 @@ class AssignmentsE2ETest: StudentComposeTest() { submissionDetailsPage.assertSelectedAttempt("Attempt 1") } + @Stub @E2E @Test @TestMetaData(Priority.IMPORTANT, FeatureCategory.SUBMISSIONS, TestCategory.E2E)