ワンクリックで
build-screenshot-tests
A skill for building instrumented screenshot tests in Remote Compose using RemoteComposeScreenshotTestRule.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
A skill for building instrumented screenshot tests in Remote Compose using RemoteComposeScreenshotTestRule.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | build_screenshot_tests |
| description | A skill for building instrumented screenshot tests in Remote Compose using RemoteComposeScreenshotTestRule. |
[!IMPORTANT] AI INSTRUCTION: Do not assume you should use
RemoteComposeScreenshotTestRulefor all tests. If the user asks you to write a screenshot test, you MUST first explicitly ask them: "Would you like me to use theRemoteComposeScreenshotTestRulefor this test?" Proceed with using this skill only if they confirm.
This skill provides guidelines for building screenshot tests in the @compose/remote/remote-creation-compose project.
RemoteComposeScreenshotTestRule is a JUnit rule that allows taking screenshots of Remote Compose components. It handles:
RemoteDocumentPlayer.Test Class Annotations:
Annotate the test class with @MediumTest, @SdkSuppress(minSdkVersion = 35, maxSdkVersion = 35), and @RunWith(AndroidJUnit4::class).
Add the Rule: Define the rule inside the test class.
@get:Rule
val composeTestRule: RemoteComposeScreenshotTestRule by lazy {
RemoteComposeScreenshotTestRule(
moduleDirectory = SCREENSHOT_GOLDEN_DIRECTORY,
matcher = MSSIMMatcher(threshold = 0.999),
)
}
Note: SCREENSHOT_GOLDEN_DIRECTORY is usually defined in the module, e.g., androidx.compose.remote.creation.compose.SCREENSHOT_GOLDEN_DIRECTORY.
RemoteComposeScreenshotTestRuleUse runScreenshotTest and provide a lambda with the Remote Composable content you want to test.
@Test
fun simpleTest() {
composeTestRule.runScreenshotTest {
RemoteBox(
modifier = RemoteModifier.fillMaxSize().background(Color.Red)
)
}
}
You can override profile, layout direction, or offer outer content if needed.
@Test
fun alignByBaseline() {
composeTestRule.runScreenshotTest(profile = TestProfiles.androidXExperimental) {
RemoteColumn(modifier = RemoteModifier.fillMaxSize()) {
RemoteRow(modifier = RemoteModifier.fillMaxWidth()) {
RemoteText(
text = "Large String",
fontSize = 40.rsp,
modifier = RemoteModifier.alignByBaseline(),
)
RemoteText(
text = "Small String",
fontSize = 14.rsp,
modifier = RemoteModifier.alignByBaseline(),
)
}
}
}
}
For testing multiple variations efficiently, you can combine this rule with GridScreenshotUI.
Refer to the build_grid_screenshot_tests skill for detailed instructions on using the grid utility.
MSSIMMatcher(threshold = 0.999) for high-precision matching.moduleDirectory points to the correct golden assets folder.runScreenshotTest lambda, you are in a @RemoteComposable @Composable scope. Make sure to use RemoteModifier and Remote components (e.g. RemoteBox, RemoteText).This skill should be used when the user asks about "running iOS tests", "iOS instrumented tests", "how to run ios tests", "launch specific ios test", "add new ios instrumented test" and these tests are located in the "compose/ui/ui/src/uikitInstrumentedTest" directory.
A skill for building instrumented tests in Remote Compose using GridScreenshotUI.
This skill should be used when the user asks to "update Kotlin version", "upgrade Kotlin", "change Kotlin to X.Y.Z", or mentions updating the Kotlin compiler version in the project.