Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split up screenshots #2197

Merged
merged 12 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
**/build/reports/*
**/out/*

screenshot:
screenshot1:
# Skip build if head commit contains 'skip ci'
if: "!contains(github.event.head_commit.message, 'skip ci')"

Expand All @@ -72,16 +72,55 @@ jobs:
uses: gradle/gradle-build-action@v3
id: screenshotsverify
with:
arguments: verifyRoborazziDebug
arguments: --no-daemon verifyRoborazziDebug -x composables:verifyRoborazziDebug -x sample:verifyRoborazziDebug

- name: screenshot-test-results
- name: screenshot-test-results-1
if: always()
uses: actions/upload-artifact@v4
with:
name: build-results
name: screenshot-results-1
path: |
**/build/test-results/*
**/build/reports/*
**/build/outputs/roborazzi/*
**/out/*

screenshot2:
# Skip build if head commit contains 'skip ci'
if: "!contains(github.event.head_commit.message, 'skip ci')"

runs-on: ubuntu-latest
timeout-minutes: 40

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
lfs: 'true'

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Unit Tests 2
uses: gradle/gradle-build-action@v3
id: screenshotsverify2
with:
arguments: --no-daemon composables:verifyRoborazziDebug sample:verifyRoborazziDebug

- name: screenshot-test-results-2
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshot-results-2
path: |
**/build/test-results/*
**/build/reports/*
**/build/outputs/roborazzi/*
**/out/*

compiletests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalWearFoundationApi::class)

package com.google.android.horologist.composables

import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.wear.compose.foundation.ExperimentalWearFoundationApi
import androidx.wear.compose.foundation.LocalReduceMotion
import androidx.wear.compose.foundation.ReduceMotion
import androidx.wear.compose.material.ChipDefaults
import com.google.android.horologist.screenshots.rng.WearLegacyComponentTest
import org.junit.Test
Expand All @@ -35,4 +42,15 @@ class PlaceholderChipTest : WearLegacyComponentTest() {
PlaceholderChip(colors = ChipDefaults.secondaryChipColors())
}
}

@Composable
override fun ComponentScaffold(content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalReduceMotion provides ReduceMotion {
true
},
) {
super.ComponentScaffold(content)
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalWearFoundationApi::class)

package com.google.android.horologist.media.ui.components

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.Color
import androidx.wear.compose.foundation.ExperimentalWearFoundationApi
import androidx.wear.compose.foundation.LocalReduceMotion
import androidx.wear.compose.foundation.ReduceMotion
import com.google.android.horologist.media.ui.components.animated.MarqueeTextMediaDisplay
import com.google.android.horologist.media.ui.components.display.LoadingMediaDisplay
import com.google.android.horologist.media.ui.components.display.TextMediaDisplay
Expand Down Expand Up @@ -96,4 +102,15 @@ class LoadingMediaDisplayTest : WearLegacyComponentTest() {
content()
}
}

@Composable
override fun ComponentScaffold(content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalReduceMotion provides ReduceMotion {
true
},
) {
super.ComponentScaffold(content)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalCoilApi::class, ExperimentalWearFoundationApi::class)

package com.google.android.horologist.media.ui.screens.entity

import androidx.compose.foundation.background
Expand All @@ -22,21 +24,52 @@ import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MusicNote
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.core.content.ContextCompat
import androidx.wear.compose.foundation.ExperimentalWearFoundationApi
import androidx.wear.compose.foundation.LocalReduceMotion
import androidx.wear.compose.foundation.ReduceMotion
import androidx.wear.compose.material.MaterialTheme
import coil.annotation.ExperimentalCoilApi
import coil.decode.DataSource
import coil.request.SuccessResult
import coil.test.FakeImageLoaderEngine
import com.google.android.horologist.compose.layout.AppScaffold
import com.google.android.horologist.compose.layout.ResponsiveTimeText
import com.google.android.horologist.compose.pager.PagerScreen
import com.google.android.horologist.images.base.util.rememberVectorPainter
import com.google.android.horologist.images.coil.FakeImageLoader
import com.google.android.horologist.media.ui.state.model.DownloadMediaUiModel
import com.google.android.horologist.media.ui.state.model.PlaylistUiModel
import com.google.android.horologist.screenshots.FixedTimeSource
import com.google.android.horologist.screenshots.rng.WearLegacyA11yTest
import org.junit.Ignore
import org.junit.Test

@Ignore("Flaky in CI")
class PlaylistDownloadScreenA11yScreenshotTest :
WearLegacyA11yTest() {

override val imageLoader = FakeImageLoaderEngine.Builder()
.intercept(
predicate = {
it == FakeImageLoader.TestIconResourceUri
},
interceptor = {
SuccessResult(
drawable = ContextCompat.getDrawable(
it.request.context,
FakeImageLoader.TestIconResource,
)!!,
request = it.request,
dataSource = DataSource.DISK,
)
},
)
.build()

@Test
fun playlistDownloadScreenPreviewLoading() {
runScreenTest {
Expand Down Expand Up @@ -217,6 +250,12 @@ class PlaylistDownloadScreenA11yScreenshotTest :

@Composable
override fun TestScaffold(content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalReduceMotion provides ReduceMotion {
true
},
) {
}
AppScaffold(
modifier = Modifier
.fillMaxSize()
Expand Down Expand Up @@ -246,13 +285,13 @@ private val notDownloaded = listOf(
id = "id",
title = "Song name",
artist = "Artist name",
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
DownloadMediaUiModel.NotDownloaded(
id = "id 2",
title = "Song name 2",
artist = "Artist name 2",
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
)

Expand All @@ -261,14 +300,14 @@ private val notDownloadedAndDownloading = listOf(
id = "id",
title = "Song name",
artist = "Artist name",
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
DownloadMediaUiModel.Downloading(
id = "id 2",
title = "Song name 2",
progress = DownloadMediaUiModel.Progress.InProgress(78f),
size = DownloadMediaUiModel.Size.Known(sizeInBytes = 123456L),
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
)

Expand All @@ -277,14 +316,14 @@ private val downloadedAndDownloadingUnknown = listOf(
id = "id",
title = "Song name",
artist = "Artist name",
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
DownloadMediaUiModel.Downloading(
id = "id 2",
title = "Song name 2",
progress = DownloadMediaUiModel.Progress.InProgress(78f),
size = DownloadMediaUiModel.Size.Unknown,
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
)

Expand All @@ -293,14 +332,14 @@ private val downloadedAndDownloadingWaiting = listOf(
id = "id",
title = "Song name",
artist = "Artist name",
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
DownloadMediaUiModel.Downloading(
id = "id 2",
title = "Song name 2",
progress = DownloadMediaUiModel.Progress.Waiting,
size = DownloadMediaUiModel.Size.Unknown,
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
)

Expand All @@ -309,13 +348,13 @@ private val downloadedNotDownloaded = listOf(
id = "id",
title = "Song name",
artist = "Artist name",
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
DownloadMediaUiModel.NotDownloaded(
id = "id 2",
title = "Song name 2",
artist = "Artist name 2",
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
)

Expand All @@ -324,12 +363,12 @@ private val downloaded = listOf(
id = "id",
title = "Song name",
artist = "Artist name",
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
DownloadMediaUiModel.Downloaded(
id = "id 2",
title = "Song name 2",
artist = "Artist name 2",
artworkUri = "artworkUri",
artworkUri = FakeImageLoader.TestIconResourceUri,
),
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading