Skip to content

Commit

Permalink
Switch to generating and validating Roborazzi screenshots on Mac (#1966)
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyfroehlich authored Jan 13, 2025
1 parent b2cc317 commit 7315dfa
Show file tree
Hide file tree
Showing 141 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
# These tests run on the local JVM and don't need the rust code,
# so it makes sense to put them in a seperate job
verify-roborazzi:
runs-on: "ubuntu-latest"
runs-on: "macos-latest"
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/roborazzi-compare-screenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ permissions:

jobs:
compare-with-base-branch:
runs-on: ubuntu-latest
runs-on: "macos-latest"
timeout-minutes: 20

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/roborazzi-record-screenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ permissions: {}

jobs:
record-current-screenshots:
runs-on: ubuntu-latest
runs-on: "macos-latest"
timeout-minutes: 20

permissions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ abstract class FeedbackImpl {
maxMessages = num
}

internal fun clearMessages() {
messages.clear()
}

fun addIgnoredDocument(docId: DesignDocId): Boolean {
ignoredDocuments.add(docId)
return true
Expand All @@ -69,8 +73,6 @@ abstract class FeedbackImpl {
}

// Message functions
// fun newDocServer(url: String){
// }

fun diskLoadFail(id: String, docId: DesignDocId) {
setStatus(
Expand Down
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 @@ -67,12 +67,16 @@ private static void clearDesignSettings() {
DesignSettings.INSTANCE.testOnlyClearFileFetchStatus();
DesignSettings.INSTANCE.clearRawResources();
}
private static void clearFeedback() {
Feedback.INSTANCE.clearMessages$common();
}


public static class ClearStateTestRule implements TestRule {

@Override
public Statement apply(Statement base, Description description) {
clearFeedback();
clearInteractionStates();
clearDocServer();
clearDesignSettings();
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ junit5 = "5.11.3"
truth = "1.4.4"
spotless = "6.25.0"
robolectric = "4.14.1"
roborazzi = "1.36.0"
roborazzi = "1.39.0"
androidx-material3 = "1.3.1"
# Keep in sync with the "Install Protoc" steps in .github/workflows
protoc = "4.29.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.android.designcompose.testapp.validation

import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onRoot
Expand All @@ -27,7 +26,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.designcompose.TestUtils
import com.android.designcompose.test.assertDoesNotHaveText
import com.android.designcompose.test.assertHasText
import com.android.designcompose.test.hasDesignText
import com.android.designcompose.test.internal.captureRootRoboImage
import com.android.designcompose.test.internal.designComposeRoborazziRule
import com.android.designcompose.test.onDCDocAnyNode
Expand Down Expand Up @@ -56,7 +54,6 @@ class InteractionTests {
with(composeTestRule) { setContent { InteractionTest() } }
}

@OptIn(ExperimentalTestApi::class)
@Test
fun whilePressedTimeoutTimesOut() {
with(composeTestRule) {
Expand All @@ -69,8 +66,9 @@ class InteractionTests {
onNodeWithTag("idle").performTouchInput { down(Offset.Zero) }
assertHasText("pressed")
captureRootRoboImage("whilePressed-pressed")
mainClock.advanceTimeBy(1000)

waitUntilDoesNotExist(hasDesignText("pressed"), 1000)
assertDoesNotHaveText("pressed")
assertHasText("timeout")
captureRootRoboImage("whilePressed-timedOut")

Expand Down
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.
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.
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.

0 comments on commit 7315dfa

Please sign in to comment.