Ballerina E2E Writer
Use this skill when adding new Ballerina extension user-flow E2E coverage in workspaces/ballerina/ballerina-extension.
For user-facing instructions and prompt examples, see USER_GUIDE.md in this skill directory.
Workflow
Read the requested scenario and existing tests in e2e-test/e2e-playwright-tests.
Ensure the Ballerina VSIX exists locally. Check for a file matching ballerina-*.vsix in the workspace root (e.g., ballerina-5.11.0.vsix). If none is found, ask the user to run:
rush build -t ballerina
Create scenario.md under the authoring scenario directory before writing any step files:
e2e-test/e2e-authoring/scenarios/<scenario-name>/scenario.md
If the user only described the scenario in the prompt, derive the steps and write scenario.md now. If the user provided a scenario.md path, read it first.
Write small step files in steps/*.step.js. Keep each step focused and rerunnable.
For diagram flows, steps must build the flow through the product UI:
click the diagram plus button, open the node palette, search or select the node, fill the form, then save.
Run the steps through the named daemon:
bash e2e-test/e2e-authoring/scripts/run-steps.sh <scenario-name> e2e-test/e2e-authoring/scenarios/<scenario-name>/steps
If a selector is unstable or an element cannot be found by data-testid, add a stable data-testid attribute to that element in the relevant workspaces/ballerina/*/src UI package. Do not use dynamic/generated class names as selectors, including Emotion class names.
After adding any data-testid — even a single attribute in one file — always rebuild the VSIX and install it before rerunning steps:
rush build -t ballerina
Then install the newly built VSIX into the test VS Code instance (the harness daemon picks up the VSIX from the workspace root). If the VS Code instance is already running the old extension version, stop it, reinstall the VSIX, and restart before retrying.
If the installed version looks unchanged (VS Code loads the cached build because the version string is identical): bump the version in workspaces/ballerina/ballerina-extension/package.json by appending a timestamp suffix, e.g. "5.12.0" → "5.12.0-20260520". Then rebuild and reinstall:
rush build -t ballerina
This forces VS Code to treat it as a genuinely new extension version, bypassing any cached install. Once the selector is confirmed working you can revert the version string.
Once the step flow is proven, promote the same UI flow into a new spec file. Place the spec in the subdirectory that best matches the integration category, following the existing layout:
e2e-test/e2e-playwright-tests/<category>/<scenario-name>.spec.ts
Existing categories: api-integration, file-integration, other-artifacts, diagram, configuration, type-editor. Check the subdirectories and pick the closest match.
Register the promoted spec in e2e-test/e2e-playwright-tests/test.list.ts.
Verify with:
npm run e2e-test -- --grep "<test name>"
A passing run prints each logStep line to the terminal and exits 0. If the extension fails to launch, check the VS Code host stderr for VSIX load errors — this means a stale build; rebuild and rerun.
Harness Rules
- The authoring daemon is only for scenario discovery and fast iteration.
- The committed source of truth is the normal Playwright spec.
- Use
@wso2/playwright-vscode-tester launch behavior through the authoring daemon.
- Prefer existing helpers:
initTest, getWebview, addArtifact, ProjectExplorer, and Diagram.
- Extension webview action selectors should be
data-testid, stable roles, or stable accessible names. If an element has no data-testid, do not work around it with fragile selectors — add the data-testid, rebuild, reinstall, and retry.
- VS Code shell selectors may use stable workbench ARIA labels where needed.
- Do not create or modify Ballerina flow files directly to build the scenario. Source files may be read for final verification only.
- Build diagram flows top-to-bottom so each saved form leaves the project compilable for the next form.
- When a form input opens the helper panel, either use it intentionally to choose inputs/variables or press
Escape to dismiss it before saving. The helper panel can cover the Save button.
- Fill form fields through stable labels,
data-testid, CodeMirror helpers, or helper-panel selections. Never select extension UI by dynamic/generated class names such as Emotion CSS classes.
- Add terminal-visible progress logs for each major E2E step using
logStep from e2e-playwright-tests/utils/helpers, so headless failures show the last completed action.
- Always use the authoring harness first, then promote the passing UI flow into
e2e-playwright-tests, and verify with npm run e2e-test -- --grep "<test name>".
Useful Commands
Run all authoring steps:
cd workspaces/ballerina/ballerina-extension
bash e2e-test/e2e-authoring/scripts/run-steps.sh http-upload e2e-test/e2e-authoring/scenarios/http-upload/steps
Run a step range:
bash e2e-test/e2e-authoring/scripts/run-steps.sh http-upload e2e-test/e2e-authoring/scenarios/http-upload/steps 02 03
Run promoted test:
npm run e2e-test -- --grep "HTTP Upload"
1---2name: ballerina-e2e-writer-23description: Use when adding or updating Ballerina extension E2E tests that need agent-assisted VS Code authoring before promotion into the Playwright suite.4---56# Ballerina E2E Writer78Use this skill when adding new Ballerina extension user-flow E2E coverage in `workspaces/ballerina/ballerina-extension`.910For user-facing instructions and prompt examples, see `USER_GUIDE.md` in this skill directory.1112## Workflow13141. Read the requested scenario and existing tests in `e2e-test/e2e-playwright-tests`.152. Ensure the Ballerina VSIX exists locally. Check for a file matching `ballerina-*.vsix` in the workspace root (e.g., `ballerina-5.11.0.vsix`). If none is found, ask the user to run:1617 ```bash18 rush build -t ballerina19 ```20213. Create `scenario.md` under the authoring scenario directory before writing any step files:2223 ```text24 e2e-test/e2e-authoring/scenarios/<scenario-name>/scenario.md25 ```2627 If the user only described the scenario in the prompt, derive the steps and write `scenario.md` now. If the user provided a `scenario.md` path, read it first.28294. Write small step files in `steps/*.step.js`. Keep each step focused and rerunnable.30 For diagram flows, steps must build the flow through the product UI:31 click the diagram plus button, open the node palette, search or select the node, fill the form, then save.325. Run the steps through the named daemon:3334 ```bash35 bash e2e-test/e2e-authoring/scripts/run-steps.sh <scenario-name> e2e-test/e2e-authoring/scenarios/<scenario-name>/steps36 ```37386. If a selector is unstable or an element cannot be found by `data-testid`, add a stable `data-testid` attribute to that element in the relevant `workspaces/ballerina/*/src` UI package. Do not use dynamic/generated class names as selectors, including Emotion class names.39 After adding any `data-testid` — even a single attribute in one file — always rebuild the VSIX and install it before rerunning steps:4041 ```bash42 rush build -t ballerina43 ```4445 Then install the newly built VSIX into the test VS Code instance (the harness daemon picks up the VSIX from the workspace root). If the VS Code instance is already running the old extension version, stop it, reinstall the VSIX, and restart before retrying.4647 **If the installed version looks unchanged** (VS Code loads the cached build because the version string is identical): bump the version in `workspaces/ballerina/ballerina-extension/package.json` by appending a timestamp suffix, e.g. `"5.12.0"` → `"5.12.0-20260520"`. Then rebuild and reinstall:4849 ```bash50 rush build -t ballerina51 ```5253 This forces VS Code to treat it as a genuinely new extension version, bypassing any cached install. Once the selector is confirmed working you can revert the version string.54557. Once the step flow is proven, promote the same UI flow into a new spec file. Place the spec in the subdirectory that best matches the integration category, following the existing layout:5657 ```text58 e2e-test/e2e-playwright-tests/<category>/<scenario-name>.spec.ts59 ```6061 Existing categories: `api-integration`, `file-integration`, `other-artifacts`, `diagram`, `configuration`, `type-editor`. Check the subdirectories and pick the closest match.628. Register the promoted spec in `e2e-test/e2e-playwright-tests/test.list.ts`.639. Verify with:6465 ```bash66 npm run e2e-test -- --grep "<test name>"67 ```6869 A passing run prints each `logStep` line to the terminal and exits 0. If the extension fails to launch, check the VS Code host stderr for VSIX load errors — this means a stale build; rebuild and rerun.7071## Harness Rules7273- The authoring daemon is only for scenario discovery and fast iteration.74- The committed source of truth is the normal Playwright spec.75- Use `@wso2/playwright-vscode-tester` launch behavior through the authoring daemon.76- Prefer existing helpers: `initTest`, `getWebview`, `addArtifact`, `ProjectExplorer`, and `Diagram`.77- Extension webview action selectors should be `data-testid`, stable roles, or stable accessible names. If an element has no `data-testid`, do not work around it with fragile selectors — add the `data-testid`, rebuild, reinstall, and retry.78- VS Code shell selectors may use stable workbench ARIA labels where needed.79- Do not create or modify Ballerina flow files directly to build the scenario. Source files may be read for final verification only.80- Build diagram flows top-to-bottom so each saved form leaves the project compilable for the next form.81- When a form input opens the helper panel, either use it intentionally to choose inputs/variables or press `Escape` to dismiss it before saving. The helper panel can cover the Save button.82- Fill form fields through stable labels, `data-testid`, CodeMirror helpers, or helper-panel selections. Never select extension UI by dynamic/generated class names such as Emotion CSS classes.83- Add terminal-visible progress logs for each major E2E step using `logStep` from `e2e-playwright-tests/utils/helpers`, so headless failures show the last completed action.84- Always use the authoring harness first, then promote the passing UI flow into `e2e-playwright-tests`, and verify with `npm run e2e-test -- --grep "<test name>"`.8586## Useful Commands8788Run all authoring steps:8990```bash91cd workspaces/ballerina/ballerina-extension92bash e2e-test/e2e-authoring/scripts/run-steps.sh http-upload e2e-test/e2e-authoring/scenarios/http-upload/steps93```9495Run a step range:9697```bash98bash e2e-test/e2e-authoring/scripts/run-steps.sh http-upload e2e-test/e2e-authoring/scenarios/http-upload/steps 02 0399```100101Run promoted test:102103```bash104npm run e2e-test -- --grep "HTTP Upload"105```