Ballerina E2E Writer
Use this skill when adding new Ballerina extension user-flow E2E coverage in
packages/ballerina-extension.
Scope: work only inside packages/ballerina-extension. Do not edit the
submodules/ tree or shared/common libraries.
For user-facing instructions and prompt examples, see USER_GUIDE.md in this
skill directory.
Workflow
Read the requested scenario and existing tests in
packages/ballerina-extension/e2e-test/e2e-playwright-tests. Before writing
anything, check whether an existing spec already covers the scenario — the
tracking sheet can be out of date. If covered, document the real flow and
flag gaps instead of duplicating.
Ensure the Ballerina VSIX exists locally. The e2e harness installs from
packages/ballerina-extension/vsix/*.vsix. If none is found, build it:
rush build -t ballerina
Create scenario.md under the authoring scenario directory before writing
any step files:
packages/ballerina-extension/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. Keep it short: a prose paragraph describing one concrete, verifiable
end-to-end flow, optionally with a steps table and a "Gaps" section.
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 packages/ballerina-extension/e2e-test/e2e-authoring/scripts/run-steps.sh <scenario-name> packages/ballerina-extension/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
packages/*/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 reinstall it before rerunning steps:
rush build -t ballerina
Then reinstall the newly built VSIX into the test VS Code instance (the
harness installs from packages/ballerina-extension/vsix/). 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
packages/ballerina-extension/package.json by appending a timestamp suffix,
e.g. "5.12.0" → "5.12.0-20260520". Then rebuild and reinstall. 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:
packages/ballerina-extension/e2e-test/e2e-playwright-tests/<category>/<scenario-name>.spec.ts
Existing categories: api-integration, automation, configuration,
copilot, data, datamapper, diagram, event-integration,
expression-editor, file-integration, import-integration,
other-artifacts, project-explorer, project-overview, rundebug
(with debug/run/run-concurrent/run-conflict subfolders),
service-designer, test-function, tryit, type-editor. Check the
subdirectories and pick the closest match.
Register the promoted spec in
packages/ballerina-extension/e2e-test/e2e-playwright-tests/test.list.ts
(add the import and the matching test.describe(...)).
Verify with:
cd packages/ballerina-extension
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, Form/switchToIFrame, and feature utils (e.g.
GraphQLServiceUtils, TypeEditorUtils).
- 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 for a scenario:
cd packages/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:
cd packages/ballerina-extension
npm run e2e-test -- --grep "HTTP Upload"
1---2name: ballerina-e2e-writer3description: 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 in9`packages/ballerina-extension`.1011> Scope: work only inside `packages/ballerina-extension`. Do **not** edit the12> `submodules/` tree or shared/common libraries.1314For user-facing instructions and prompt examples, see `USER_GUIDE.md` in this15skill directory.1617## Workflow18191. Read the requested scenario and existing tests in20 `packages/ballerina-extension/e2e-test/e2e-playwright-tests`. Before writing21 anything, check whether an existing spec already covers the scenario — the22 tracking sheet can be out of date. If covered, document the real flow and23 flag gaps instead of duplicating.242. Ensure the Ballerina VSIX exists locally. The e2e harness installs from25 `packages/ballerina-extension/vsix/*.vsix`. If none is found, build it:2627 ```bash28 rush build -t ballerina29 ```30313. Create `scenario.md` under the authoring scenario directory before writing32 any step files:3334 ```text35 packages/ballerina-extension/e2e-test/e2e-authoring/scenarios/<scenario-name>/scenario.md36 ```3738 If the user only described the scenario in the prompt, derive the steps and39 write `scenario.md` now. If the user provided a `scenario.md` path, read it40 first. Keep it short: a prose paragraph describing one concrete, verifiable41 end-to-end flow, optionally with a steps table and a "Gaps" section.42434. Write small step files in `steps/*.step.js`. Keep each step focused and44 rerunnable. For diagram flows, steps must build the flow through the product45 UI: click the diagram plus button, open the node palette, search or select46 the node, fill the form, then save.475. Run the steps through the named daemon:4849 ```bash50 bash packages/ballerina-extension/e2e-test/e2e-authoring/scripts/run-steps.sh <scenario-name> packages/ballerina-extension/e2e-test/e2e-authoring/scenarios/<scenario-name>/steps51 ```52536. If a selector is unstable or an element cannot be found by `data-testid`, add54 a stable `data-testid` attribute to that element in the relevant55 `packages/*/src` UI package. Do not use dynamic/generated class names as56 selectors, including Emotion class names.57 After adding any `data-testid` — even a single attribute in one file — always58 rebuild the VSIX and reinstall it before rerunning steps:5960 ```bash61 rush build -t ballerina62 ```6364 Then reinstall the newly built VSIX into the test VS Code instance (the65 harness installs from `packages/ballerina-extension/vsix/`). If the VS Code66 instance is already running the old extension version, stop it, reinstall the67 VSIX, and restart before retrying.6869 **If the installed version looks unchanged** (VS Code loads the cached build70 because the version string is identical): bump the version in71 `packages/ballerina-extension/package.json` by appending a timestamp suffix,72 e.g. `"5.12.0"` → `"5.12.0-20260520"`. Then rebuild and reinstall. This forces73 VS Code to treat it as a genuinely new extension version, bypassing any cached74 install. Once the selector is confirmed working you can revert the version75 string.76777. Once the step flow is proven, promote the same UI flow into a new spec file.78 Place the spec in the subdirectory that best matches the integration category,79 following the existing layout:8081 ```text82 packages/ballerina-extension/e2e-test/e2e-playwright-tests/<category>/<scenario-name>.spec.ts83 ```8485 Existing categories: `api-integration`, `automation`, `configuration`,86 `copilot`, `data`, `datamapper`, `diagram`, `event-integration`,87 `expression-editor`, `file-integration`, `import-integration`,88 `other-artifacts`, `project-explorer`, `project-overview`, `rundebug`89 (with `debug`/`run`/`run-concurrent`/`run-conflict` subfolders),90 `service-designer`, `test-function`, `tryit`, `type-editor`. Check the91 subdirectories and pick the closest match.928. Register the promoted spec in93 `packages/ballerina-extension/e2e-test/e2e-playwright-tests/test.list.ts`94 (add the `import` and the matching `test.describe(...)`).959. Verify with:9697 ```bash98 cd packages/ballerina-extension99 npm run e2e-test -- --grep "<test name>"100 ```101102 A passing run prints each `logStep` line to the terminal and exits 0. If the103 extension fails to launch, check the VS Code host stderr for VSIX load errors104 — this means a stale build; rebuild and rerun.105106## Harness Rules107108- The authoring daemon is only for scenario discovery and fast iteration.109- The committed source of truth is the normal Playwright spec.110- Use `@wso2/playwright-vscode-tester` launch behavior through the authoring daemon.111- Prefer existing helpers: `initTest`, `getWebview`, `addArtifact`,112 `ProjectExplorer`, `Form`/`switchToIFrame`, and feature utils (e.g.113 `GraphQLServiceUtils`, `TypeEditorUtils`).114- Extension webview action selectors should be `data-testid`, stable roles, or115 stable accessible names. If an element has no `data-testid`, do not work around116 it with fragile selectors — add the `data-testid`, rebuild, reinstall, and retry.117- VS Code shell selectors may use stable workbench ARIA labels where needed.118- Do not create or modify Ballerina flow files directly to build the scenario.119 Source files may be read for final verification only.120- Build diagram flows top-to-bottom so each saved form leaves the project121 compilable for the next form.122- When a form input opens the helper panel, either use it intentionally to choose123 inputs/variables or press `Escape` to dismiss it before saving. The helper panel124 can cover the Save button.125- Fill form fields through stable labels, `data-testid`, CodeMirror helpers, or126 helper-panel selections. Never select extension UI by dynamic/generated class127 names such as Emotion CSS classes.128- Add terminal-visible progress logs for each major E2E step using `logStep` from129 `e2e-playwright-tests/utils/helpers`, so headless failures show the last130 completed action.131- Always use the authoring harness first, then promote the passing UI flow into132 `e2e-playwright-tests`, and verify with `npm run e2e-test -- --grep "<test name>"`.133134## Useful Commands135136Run all authoring steps for a scenario:137138```bash139cd packages/ballerina-extension140bash e2e-test/e2e-authoring/scripts/run-steps.sh http-upload e2e-test/e2e-authoring/scenarios/http-upload/steps141```142143Run a step range:144145```bash146bash e2e-test/e2e-authoring/scripts/run-steps.sh http-upload e2e-test/e2e-authoring/scenarios/http-upload/steps 02 03147```148149Run promoted test:150151```bash152cd packages/ballerina-extension153npm run e2e-test -- --grep "HTTP Upload"154```