with one click
write-ui-tests
// Use when writing or modifying UI/Compose instrumented tests in the Alkaa project — triggers on tasks like "add a UI test", "test this composable", "add instrumented test", "test this screen behavior".
// Use when writing or modifying UI/Compose instrumented tests in the Alkaa project — triggers on tasks like "add a UI test", "test this composable", "add instrumented test", "test this screen behavior".
Use when writing or modifying end-to-end tests in the Alkaa project — triggers on tasks like "add an E2E test", "write a flow test", "test this feature end-to-end", "add a test to shared module", or "cover this user journey with a test".
Use when the user asks to commit changes, stage and commit, or says "commit my changes" — stages all uncommitted changes and creates a structured commit message with emoji, title, and summary
Use when adding, editing, or reviewing user-facing strings in the Alkaa project — UI labels, button text, content descriptions, empty states, error messages, plurals, or any text visible to the user.
Use when adding a new screen or modifying navigation in the Alkaa project — triggers on tasks like "add a new screen", "navigate to X", "add destination", "wire up navigation", or "create a navigation event". Also triggers when connecting UI actions to routes in NavGraph.
Use when creating a new Composable or modifying an existing one in the Alkaa project — screen structure, state handling, adaptive layouts, Kuvio usage, or previews.
Use when implementing a new Kuvio component for the Alkaa Design System after design spec and structure decisions are finalized
| name | write-ui-tests |
| description | Use when writing or modifying UI/Compose instrumented tests in the Alkaa project — triggers on tasks like "add a UI test", "test this composable", "add instrumented test", "test this screen behavior". |
UI tests in Alkaa test Compose and UI behavior in isolation — not integration tests. Composables must be stateless to make testing straightforward: pass all state and callbacks as parameters, then assert on the semantic tree.
Tests live in: features/<feature>/src/commonTest/kotlin/com/escodro/<feature>/presentation/instrumented/
AlkaaTest(), @OptIn(ExperimentalTestApi::class) on class → see references/SETUP.md= runComposeUiTest { } for each testComposeUiTest; always wrap with AlkaaThemePreview → see references/SETUP.md@AfterTest → see references/SETUP.mdreferences/SETUP.mdSnake_case, two accepted forms:
test_emptyViewIsShown()when_view_is_opened_then_empty_view_is_shown()No camelCase, no backtick names.
| Rule | Details |
|---|---|
| Always wrap | Wrap composable in AlkaaThemePreview |
| Resource strings | getString(Res.string.xyz) inside uiTest or runComposeUiTest — never hardcode |
| One scenario per test | Split different states into separate @Test functions |
useUnmergedTree = true | When nodes are inside merged semantics |
@IgnoreOnDesktop | For tests not applicable on desktop |
@AfterTest cleanup | Call clean() on every fake |
| Given/When/Then | Always add the three comment blocks |
| Mistake | Fix |
|---|---|
| Testing a stateful composable directly | Extract a stateless Content composable and test that |
| Using mocks for domain interfaces | Create a fake implementing the interface |
| Hardcoding UI strings | Use getString(...) inside uiTest or runComposeUiTest |
| Testing multiple scenarios in one test | Split into separate @Test functions |
Missing @AfterTest cleanup | Add tearDown() calling clean() on every fake |
Forgetting AlkaaThemePreview wrapper | Always wrap composable |
| Omitting Given/When/Then comments | Always add the three comment blocks |