coed
coed copied to clipboard
Add Playwright tests for all examples using gweld server
Converts all 10 examples in the examples folder into automated Playwright tests, replacing Parcel with @eeue56/gweld as the server.
Changes
-
Replaced Parcel with gweld: Updated all example
package.jsonfiles to usenpx @eeue56/gweld ./ 3000for serving -
Added esbuild bundling: Examples now bundle with esbuild (
--bundle src/index.ts --outfile=src/index.js --format=esm) to resolve browser module imports -
Playwright infrastructure:
- Added
playwright.config.tswith gweld webServer configuration - Created 10 test specs in
tests/directory validating each example's core functionality - Added
test:playwrightandtest:servenpm scripts
- Added
- Updated .gitignore: Excludes Playwright test results and generated JS bundles
Example Test
test("counter example loads and works", async ({ page }) => {
await page.goto("/examples/counter/");
await page.waitForSelector("#root button", { timeout: 10000 });
const initialText = await page.locator("#root").textContent();
expect(initialText).toContain("0");
await page.click(".button-add");
const afterAddText = await page.locator("#root").textContent();
expect(afterAddText).toContain("1");
});
Run tests with npm run test:playwright.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.giphy.com
- Triggering command:
/home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD(dns block)elm-lang.org
- Triggering command:
/home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
Original prompt
This section details on the original issue you should resolve
<issue_title>Turn all the examples into automated tests</issue_title> <issue_description>- Make every example in the examples folder a test via Playwright
- Ensure each example uses
@eeue56/gweldas the server rather than parcel or other tools </issue_description>Comments on the Issue (you are @copilot in this section)
- Fixes eeue56/coed#6
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.