Use this skill to reproduce and fix flaky and disabled tests.
76%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
Fix and improve this skill with Tessl
tessl review fix ./.agents/skills/fix-tests/SKILL.mdThis skill outlines the workflow for reproducing and fixing a flaky test in the DevTools codebase. The work should be divided into sub-agents that should only be started when certain criteria are met.
crbug.com/1234567), or a name of a test file and (optionally) the test name.I will attempt to reproduce the flakiness (simultaneously) locally and using the 'stressor bots'. Once issues are discovered, I will attempt to fix them.First, create and start two sub-agents simultaneously. One called 'local-repro' (that should attempt to reproduce the problem locally) and one called 'bot-repro' (that attempts to use the stressor bots to reproduce).
./dt test --repeat=<count> path/to/foo.test.ts:exact_test_id to locally run the tests repeatedly. Both E2E and unit tests support this. Use the exact test ID printed in the test runner output (usually the suite and test names with spaces replaced by underscores). Do not use --grep or a bash script with a for loop.local-repro runs in parallel on the same host (local-repro and bot-repro can run concurrently because bot-repro runs on remote LUCI builders, whereas parallel local Headless Chrome E2E runs contend for CPU and cause artificial timeouts).Test: Runs Sec Failures
"Recorder/should be able to start a replay..." 30 180 0 (0.00%)
"The Debugger Language Plugins/shows sensible..." 60 180 1 (1.67%)If problems were detected, list the different problems found and how often they occurred. Ask the user if the errors match the ones they are trying to get rid of.
The second bot should do the following:
Create a branch with a meaningful name, such as deflake_<test_name>.
Ensure you use the instructions from the devtools-version-control skill to create and switch branches appropriately.
Make a minor, harmless modification directly to the test file being investigated (e.g., adding a comment // Trigger stressor bot) to ensure the commit is not empty.
Add this file (with git add) and commit it using a meaningful commit message (Deflake <test name>) with a Bug: <bug number> Git trailer in the footer (ask the user which bug number to use; never use BUG= or Piper KEY=VALUE tags).
Upload this change as a Work-in-Progress CL using git cl upload -f -o wip --commit-description=+ (always pass -f so the upload runs non-interactively, and never pass -m "<subject>" on initial upload, which drops the commit body and Bug: trailer). This creates a debugging CL that all agents (like the fix agent) will continue to work on.
Note the created during upload.
To start the stressor bot, run this command (substituting <test file>:exact_test_id with the actual file and exact test ID):
git cl try -B devtools-frontend/try -b e2e_stressor_linux -b e2e_stressor_win64 -b e2e_stressor_mac -p runner_args='<test file>:exact_test_id --repeat=100'
assertScreenshot), it should ONLY be run on the Linux stressor bot (-b e2e_stressor_linux), because screenshot assertions are not supported on Mac or Windows. Furthermore, they cannot be reproduced locally on a Mac.git cl try fails with a login error (e.g., Login required: run bb auth-login), inform the user so they can resolve the auth issue and ask you to retry.Note that the test file name needs to be relative to the root, so use test/e2e/foo.test.ts instead of e2e/foo.test.ts.
Check the results of the stressor tests with git cl try-results --issue=<issue number> --patchset=<patchset number>. You can dive into each result by id using bb get <id>.
scripts/tools/get_cl_test_results.py --cl <issue number> --output-dir <OUTPUT_DIR> (see devtools-verification).Once a test run completes, always report to the user how often the tests ran and what the failure rate was.
Critical: Make sure that at least one test ran to completion on the bot (to catch incorrect syntax for git cl try or incorrect test IDs).
While we wait for the bots to complete their run, would you like to:
1) Continue trying to reproduce locally
2) Start investigating the testIf they opt for investigating the test, start a new agent called 'fix-test'.
The test fixing sub-agent should do the following:
requestUpdate() transitions: Bare waitFor('.selector') on an already-mounted element resolves before requestAnimationFrame runs performUpdate(); wait on a compound state selector such as waitFor('.selector.expected-class') or waitFor('.selector:not(.old-class)').<devtools-split-view> hidden sidebars: <devtools-split-view> hides collapsed sidebars via hideWidget() (.hidden) instead of detach(); include :not(.hidden) in waitFor / waitForNone sidebar or drawer selectors (e.g., .drawer-tabbed-pane:not(.hidden)).git commit --amend, or run git commit only if no commit exists on the branch yet) so the branch keeps a single commit. Make sure to list (in the changelist description) the test name, the fix, reasoning for why the test failed, why the fix fixes the issue, the failure rate (if non-zero; if you were not able to reproduce the error, state that the fix is speculative), and a Bug: <bug number> (or Fixed: <bug number>) Git trailer.git cl upload -f --cq-dry-run -o wip --commit-description=+ -t "<patchset summary>", and complete the ChromiumCodeReviewAgent WIP review pass from devtools-version-control before marking the CL Ready for Review.ChromeDevTools/devtools-frontend
9d90722
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.