feat(skills): reworked skills and rules
CI / CI configuration security checks (push) Successful in 3s
CI / Capabilities and shell quality (push) Successful in 14s
CI / Python tests and compilation (push) Successful in 26s
CI / QMD unit tests (push) Successful in 5s
CI / Build and inspect generated packages (push) Successful in 14s
CI / PowerShell tests on Ubuntu (push) Successful in 1m4s
CI / Installed client configuration smoke tests (push) Successful in 33s
CI / Bash integration and installation guards (push) Successful in 1m1s

This commit is contained in:
Julian Lechner committed 2026-11-18 14:17:49 +01:00
1 parent 29632ff0ce
commit f5d8f6f11b
124 files changed
+1250 -8138

No files matched your search

@@ -0,0 +1,39 @@
---
name: e2e-test-write
description: Use when adding, changing, or fixing end-to-end or UI tests that drive a running app's interface (Playwright, FlaUI, Appium), including flaky UI tests.
---
# E2E and UI Test Write
Use when a test must drive the real interface of a running application. For isolated logic use `unit-test-write`; for service boundaries without a UI use `integration-test-write`. When Superpowers `test-driven-development` applies, it sets the order (failing test first); this skill decides what deserves an end-to-end test and how to make it reliable.
## Decide what to test
* Keep end-to-end tests few. Cover the critical user journeys that carry the product's value, such as sign-in, the main create or checkout flow, and one important failure path.
* Push every check as far down as it can go. Validation rules, edge cases, and calculations belong in unit or component tests; an end-to-end test proves that the layers work together for a real user.
* Do not duplicate lower-level coverage, and delete end-to-end tests that add nothing beyond it.
* Test what you control. Mock or stub third-party services at the network or service boundary instead of driving external sites.
## Write the test
1. Use the project's existing UI test framework and patterns. Without one, prefer Playwright for web apps (including Angular and Blazor), FlaUI over UI Automation for WPF, and Appium with the MAUI UI testing setup for .NET MAUI. Do not introduce a second framework.
2. Inspect the running UI before writing locators: open the page or window, look at the rendered state and its accessible tree, then choose locators from what is actually there.
3. Locate elements the way users find them: role and accessible name first (`getByRole`, `getByLabel`), then visible text, then a dedicated test ID. On desktop and mobile use `AutomationId`, and add `AutomationProperties.Name` or `AutomationId` to the app when an element has none. Never rely on CSS classes, XPath, DOM structure, or element index.
4. Assert what the user can observe, with assertions that wait and retry until the condition holds (Playwright `expect(locator).toBeVisible()`, FlaUI `Retry`). Never use fixed sleeps such as `waitForTimeout` or `Thread.Sleep`, and do not wait for network idle as a readiness signal.
5. Keep each test independent: its own browser context or app session, its own data, created through an API or seed step, and no dependence on test order. Share setup such as sign-in through fixtures or stored authentication state, not through a previous test.
6. Use synthetic, non-personal test data and test accounts with minimal rights. Never point tests at production or real customer data.
7. Use page objects or screen helpers only where several tests share a flow; keep assertions in the test.
## Make it reliable
* Treat a flaky test as a defect with a root cause: timing, shared state, test order, animations, unstable data, or environment. Fix that cause instead of adding sleeps or retries.
* Use automatic retries only to collect diagnostics in CI, such as a trace on the first retry, and report tests that pass only on retry. Quarantine a flaky test only with an owner and a tracking item.
* Disable or shorten animations in the test environment where the framework allows it.
* For visual comparisons, pin the operating system, browser, fonts, viewport, and scale factor, and mask dynamic content.
* Run an automated accessibility scan, such as axe-core, on the key screens of web journeys where the project allows it.
## Run and report
* Run the new or changed tests locally and record the command and result. In CI, keep traces, screenshots, or videos for failures, and run tests in parallel or shards when the suite is large.
* Confirm a new test fails when the feature is broken, for example by reverting the change or asserting on the missing behavior, so it is not a test that always passes.
* Report which journeys are covered, which checks were pushed down to lower-level tests, anything not run (no browser, emulator, device, or desktop session available), and any remaining flakiness risk.
@@ -0,0 +1,67 @@
{
"skill_name": "e2e-test-write",
"evals": [
{
"id": 1,
"prompt": "Add an end-to-end test for our Angular shop: a signed-in user adds a product to the cart and completes checkout. We already use Playwright in e2e/.",
"expected_output": "Uses the existing Playwright setup. Inspects the rendered checkout before choosing locators, uses role and label locators instead of CSS or XPath, and web-first assertions instead of sleeps. Signs in through a fixture or stored authentication state, creates its own test data, stubs the external payment provider at the network boundary, and keeps the test independent. Runs the test and confirms it fails when checkout is broken. Reports what was run.",
"assertions": [
"Uses the existing Playwright framework instead of adding another one",
"Uses role or label based locators, not CSS classes or XPath",
"Uses waiting web-first assertions and no fixed sleeps or networkidle waits",
"Creates isolated test data and sign-in state through fixtures or setup",
"Stubs the third-party payment provider instead of driving it",
"Reports the run command and result or states why it could not run"
],
"files": []
},
{
"id": 2,
"prompt": "Our Playwright test for the reports page fails about one run in ten on CI. Just add page.waitForTimeout(3000) before the assertion and enable 3 retries so the pipeline goes green.",
"expected_output": "Does not add a fixed sleep or rely on retries to hide the failure. Investigates the root cause (timing, shared data, test order, animation, or environment) using the CI trace, replaces the timing assumption with a waiting assertion or a deterministic readiness condition, and explains why. If retries stay, they only collect diagnostics, and tests that pass only on retry are reported. Names the trade-off to the user rather than silently following the request.",
"assertions": [
"Does not add waitForTimeout or another fixed sleep",
"Does not use retries to hide the failure",
"Looks for the root cause using traces or test isolation",
"Replaces the timing assumption with a waiting assertion or deterministic condition",
"Explains the trade-off to the user"
],
"files": []
},
{
"id": 3,
"prompt": "Write E2E tests for every validation rule of our registration form: empty email, invalid email, short password, password without digit, mismatched confirmation, and 12 more cases.",
"expected_output": "Pushes the individual validation rules down to unit or component tests and keeps at most one or two end-to-end tests for the journey, such as a successful registration and one representative validation failure shown to the user. Explains why per-rule end-to-end tests would be slow and duplicate lower-level coverage.",
"assertions": [
"Does not write one end-to-end test per validation rule",
"Moves the individual rules to unit or component tests",
"Keeps a small number of end-to-end tests for the journey",
"Explains the test pyramid reasoning"
],
"files": []
},
{
"id": 4,
"prompt": "Add a UI test for our WPF app: the user opens Settings, changes the language to German, saves, and the main window title changes. The project has no UI tests yet.",
"expected_output": "Proposes FlaUI over UI Automation for the WPF app without introducing more than one framework. Locates elements by AutomationId and adds AutomationProperties or AutomationId to the controls that lack them. Uses FlaUI retry helpers instead of Thread.Sleep, starts and closes the app per test, and states that the test needs an interactive Windows desktop session and whether it could be run.",
"assertions": [
"Chooses FlaUI or an equivalent UI Automation library for WPF",
"Locates elements by AutomationId, adding it to the app where missing",
"Uses retry or wait helpers instead of Thread.Sleep",
"Keeps each test independent with its own app session",
"States the desktop session requirement and whether the test was run"
],
"files": []
},
{
"id": 5,
"prompt": "Add a unit test for the PriceCalculator.ApplyDiscount method.",
"expected_output": "This is isolated logic, not a user interface test. Should not apply this skill's end-to-end workflow; route to unit-test-write instead.",
"assertions": [
"Does not write an end-to-end or UI test",
"Routes the task to unit-test-write"
],
"files": []
}
]
}