From b72d0fe1af2bf8bd7a1afcc116e48132627b1a8f Mon Sep 17 00:00:00 2001 From: Alex Vanyo Date: Thu, 2 Feb 2023 11:27:54 -0800 Subject: [PATCH 01/19] Fix settings dialog dismissed test on non-portrait phones Change-Id: I15ed475915fdef198029db2713b6f619da374cc7 --- .../samples/apps/nowinandroid/ui/NavigationTest.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt b/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt index 17dd28ac7..a37eb7a77 100644 --- a/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt +++ b/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt @@ -19,9 +19,11 @@ package com.google.samples.apps.nowinandroid.ui import androidx.compose.ui.test.assertCountEquals import androidx.compose.ui.test.assertIsOn import androidx.compose.ui.test.assertIsSelected +import androidx.compose.ui.test.hasAnyAncestor +import androidx.compose.ui.test.hasTestTag +import androidx.compose.ui.test.hasText import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.onAllNodesWithText -import androidx.compose.ui.test.onLast import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick @@ -213,7 +215,12 @@ class NavigationTest { onNodeWithText(ok).performClick() // Check that the saved screen is still visible and selected. - onAllNodesWithText(saved).onLast().assertIsSelected() + onNode( + hasText(saved) and + hasAnyAncestor( + hasTestTag("NiaBottomBar") or hasTestTag("NiaNavRail"), + ), + ).assertIsSelected() } } From 437df27d4c64c82aff0360ce4267049d264b0dbc Mon Sep 17 00:00:00 2001 From: Lawrence Gimenez Date: Fri, 3 Feb 2023 20:54:49 +0800 Subject: [PATCH 02/19] Update AGP to v7.4.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 828e38f12..dd5e4677e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] accompanist = "0.28.0" androidDesugarJdkLibs = "1.2.2" -androidGradlePlugin = "7.4.0" +androidGradlePlugin = "7.4.1" androidxActivity = "1.6.1" androidxAppCompat = "1.5.1" androidxBrowser = "1.4.0" From 5c1bd0ff6678e3693d14fd6062b9eb5f6ce90249 Mon Sep 17 00:00:00 2001 From: alteredworlds Date: Fri, 3 Feb 2023 16:37:49 +0000 Subject: [PATCH 03/19] Update docs/ArchitectureLearningJourney.md - Writing data --- docs/ArchitectureLearningJourney.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ArchitectureLearningJourney.md b/docs/ArchitectureLearningJourney.md index 6b6fa4420..9b5a0e6aa 100644 --- a/docs/ArchitectureLearningJourney.md +++ b/docs/ArchitectureLearningJourney.md @@ -192,9 +192,9 @@ Whenever the list of topics changes (for example, when a new topic is added), th To write data, the repository provides suspend functions. It is up to the caller to ensure that their execution is suitably scoped. -_Example: Follow a topic_ +_Example: Follow a set of topics_ -Simply call `TopicsRepository.setFollowedTopicId` with the ID of the topic which the user wishes to follow. +Simply call `UserDataRepository.setFollowedTopicIds` with the set of IDs of the topics the user wishes to follow. ### Data sources From 8e7a65027f02ddbc37ff3922ec10862eeaf70e21 Mon Sep 17 00:00:00 2001 From: alteredworlds Date: Fri, 3 Feb 2023 16:53:43 +0000 Subject: [PATCH 04/19] Update docs/ArchitectureLearningJourney.md - User action follow topic --- docs/ArchitectureLearningJourney.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ArchitectureLearningJourney.md b/docs/ArchitectureLearningJourney.md index 9b5a0e6aa..741c5c424 100644 --- a/docs/ArchitectureLearningJourney.md +++ b/docs/ArchitectureLearningJourney.md @@ -309,7 +309,7 @@ User actions are communicated from UI elements to ViewModels using regular metho **Example: Following a topic** -The `InterestsScreen` takes a lambda expression named `followTopic` which is supplied from `InterestsViewModel.followTopic`. Each time the user taps on a topic to follow this method is called. The ViewModel then processes this action by informing the topics repository. +The `InterestsScreen` takes a lambda expression named `followTopic` which is supplied from `InterestsViewModel.followTopic`. Each time the user taps on a topic to follow this method is called. The ViewModel then processes this action by informing the user data repository. ## Further reading From 6146dd55769bcd67e8365190510a0babee67a04b Mon Sep 17 00:00:00 2001 From: Alex Vanyo Date: Fri, 3 Feb 2023 15:38:48 -0800 Subject: [PATCH 05/19] Switch GMD to use a convention plugin Change-Id: Ia4f94cd7533c9168752ee39e3f960108fe802ab4 --- .github/workflows/AndroidCIWithGmd.yaml | 5 +- .run/Generate Demo Baseline Profile.run.xml | 2 +- benchmarks/build.gradle.kts | 13 ---- .../AndroidApplicationConventionPlugin.kt | 2 + .../kotlin/AndroidFeatureConventionPlugin.kt | 3 + .../kotlin/AndroidLibraryConventionPlugin.kt | 2 + .../kotlin/AndroidTestConventionPlugin.kt | 2 + .../apps/nowinandroid/GradleManagedDevices.kt | 62 +++++++++++++++++++ feature/bookmarks/build.gradle.kts | 14 ----- feature/foryou/build.gradle.kts | 14 ----- feature/interests/build.gradle.kts | 14 ----- feature/settings/build.gradle.kts | 14 ----- feature/topic/build.gradle.kts | 14 ----- 13 files changed, 76 insertions(+), 85 deletions(-) create mode 100644 build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/GradleManagedDevices.kt diff --git a/.github/workflows/AndroidCIWithGmd.yaml b/.github/workflows/AndroidCIWithGmd.yaml index 6721d3aa0..eb890c4d5 100644 --- a/.github/workflows/AndroidCIWithGmd.yaml +++ b/.github/workflows/AndroidCIWithGmd.yaml @@ -10,6 +10,9 @@ jobs: android-ci: runs-on: macos-12 + strategy: + matrix: + device-config: [ "pixel4api30aospatd" ] steps: - uses: actions/setup-java@v3 @@ -23,7 +26,7 @@ jobs: - name: Run instrumented tests with GMD run: ./gradlew cleanManagedDevices --unused-only && - ./gradlew pixel4api30DemoDebugAndroidTest -Dorg.gradle.workers.max=1 + ./gradlew ${{ matrix.device-config }}DemoDebugAndroidTest -Dorg.gradle.workers.max=1 -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true --info - name: Upload test reports diff --git a/.run/Generate Demo Baseline Profile.run.xml b/.run/Generate Demo Baseline Profile.run.xml index 4c34e5a76..a4b0de892 100644 --- a/.run/Generate Demo Baseline Profile.run.xml +++ b/.run/Generate Demo Baseline Profile.run.xml @@ -34,7 +34,7 @@