Repository navigation
chore: Playwright e2e testing + CI (#46) - #49
Merged
Merged
Conversation
Set up end-to-end testing with @playwright/test for the existing site. - playwright.config.ts builds the static site and serves dist/ via a tiny zero-dependency Node static server (tests/static-server.mjs). The Netlify adapter does not support `astro preview`, and `astro dev` needs network access to Netlify, so serving the built static output is the hermetic option. - test:e2e script + .github/workflows/e2e.yml (install, build, browsers, run). - Specs cover: landing + key routes (smoke), hajnalig SimplePlay event screen (next/prev, language toggle, auto-hiding controls, ?q= start), per-question page + GameControls, and og:image/twitter:image meta resolving to real images. - Contact form spec is written but skipped: it is an SSR-only route (prerender=false) emitted as a Netlify function, not served by the static e2e server, and submitting would hit Postgres/Google Sheets. - TODO placeholder for #44 (generated card images) and #41 (new /play screen). Closes #46
✅ Deploy Preview for whocards-calmly ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- drop question-page.spec.ts (per-question pages removed; now 301 -> /play, covered by Netlify redirect-rules, not the static dist/ harness) - smoke: remove /:lang/question/:id routes (now redirects / SSR, not static) - og-images: replace question-page samples with static-page fallbacks; turn the #44 placeholder into real assertions that generated /og/{lang}/{id}.png cards resolve (incl. RTL he); add fixme noting /play SSR og needs a functions server - gitignore harness agent worktrees
The generalized <Play> control now has aria-label='change language' (the old hajnalig button had none), so locate it by accessible name instead of button:not([aria-label]).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Sets up end-to-end testing with Playwright for the existing site (Astro static output + React islands + Netlify adapter). There was no test framework and no CI before this PR.
Closes #46
What's included
@playwright/testdev dependency +test:e2escript.playwright.config.ts— singlechromiumproject,baseURLon port4321..github/workflows/e2e.yml— installs pnpm deps, installs the Playwright chromium browser (cached), builds, and runspnpm test:e2eon PRs and pushes tomain.Web server strategy (why not
astro preview)The original plan was
pnpm build && pnpm preview, but the Netlify adapter does not supportastro preview("The @astrojs/netlify adapter does not support the preview command."), andastro devboots Netlify Dev which requires network access toapi.netlify.com. Since the site isoutput: 'static', the config builds the site and serves the emitteddist/with a tiny zero-dependency Node static server (tests/static-server.mjs) on port4321. Port4321matches theSITE_URLbaked into non-prod builds, so absoluteog:imageURLs resolve back to the test server.Test coverage (existing functionality only)
smoke.spec.ts): landing page renders (hero, CTAs, title); key routes return200(/,/en,/mission,/print,/images,/en/question/1,/hu/question/1,/events/hajnalig,/events/hajnalig/play); unknown route serves the404page.event-play.spec.ts): theSimplePlayisland at/events/hajnalig/play— loads the?q=-selected question in the default (hu) language, next/previous navigation, language toggle (hu↔en), and the auto-hiding controls (fade out after 3s, reappear on mouse movement).question-page.spec.ts):/en/question/1renders the question text andGameControls; the next control navigates to another question page.og-images.spec.ts): for/,/en/question/1,/hu/question/1, assertsog:imageandtwitter:imageexist, point at the expected committed image (/social.pngor/images/{lang}/{id}.png), and that the image URL resolves (HTTP 200 +image/*content-type).Skipped / TODO follow-ups
contact.spec.ts) — skipped./contactis an SSR-only route (prerender = false) emitted as a Netlify function, so it is not served by the static e2e server; submitting a valid payload would also call Postgres (insertUser) and Google Sheets (createContactSheetRow). The spec is written out (render + native-validation checks) and can be enabled once the suite runs against a server that can execute SSR routes (e.g.netlify devwith network).test.fixmeplaceholder inog-images.spec.tsnoting that code-generated card images (Generate question card images via code instead of committing PNGs #44) and the new/playscreen (General play screen for the main site #41) get dedicated tests once they land.Local run
pnpm test:e2e→ 21 passed, 3 skipped (2 contact + 1 TODO).Note on
pnpm install+ sharpsharp's postinstall tries to build libvips from source (fails withoutnode-gyp), while the prebuilt platform binary it actually uses is installed from the lockfile. The CI workflow installs with--ignore-scriptsso this spurious build step doesn't fail the run; the site still builds correctly.