Add browser E2E tests for the scenario pages (Playwright, iw-support-e2e-testing) #18
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/scalatags-webawesome#18
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The 3.12.0 work verified all 87 components by hand in a browser, and it recorded the result in
COMPONENTS.md. That check is not repeatable.ConformanceTestcatches a missing tag or attribute against the Web Awesome manifest, but nothing catches a page that renders wrongly, a component that does not upgrade, or a console error. The next Web Awesome upgrade needs a check that CI can run.What exists today
scenarios/src/Server.scala:object Server extends cask.MainRoutes,override def port: Int = 8086(hard-coded),initialize()at the end, 84 routes.scenarios/src/Layout.scala: 79 nav items;private val waCdn = "/wa-pro", served by@cask.staticFiles("/wa-pro")fromnode_modules/@awesome.me/webawesome-pro/dist-cdn.webawesome/jvm/testandwebawesome/js/test, both utest. Thescenariosmodule has no test module..github/workflows/ci.yml, Forgejo Actions): compile, format, lint, test on JDK 21. No Node, no npm install, no browser.The support module to use
works.iterative.support::iw-support-e2e-testing, version0.2.1(verified in the forge registry: POM and jar both answer 200).It brings Playwright Java 1.49.0, cucumber-scala 8.23.1, cucumber-junit 7.20.1, Typesafe Config 1.4.3, iw-support-core 0.2.1 and zio 2.1.24, on Scala 3.3.7. Our build already uses Scala 3.3.7 and Mill 1.1.2, so there is no version friction. The suite adds JUnit4 as a second test framework in a new module; it does not change the utest modules.
The build needs the forge repository:
Entry points (package
works.iterative.testing.e2e):PlaywrightCucumberRunnerpage,freshPage(),baseUrl,config,testDataCommonStepDefinitionsPlaywrightCucumberRunnerCucumberLifecycleHooksBeforeAll/AfterAll/After; it MUST be in the Cucumber glue packagesPlaywrightTestContextPageObject/BasePageObjectModel to copy:
iw-support/forms/scenarios/jvm/src/e2e/(suite entry point, server hooks, step definitions, feature files,application.conf).Work to do
Server.portreads the port from the same place as the tests. In the iw-support pattern,baseUrlinapplication.confis the single source, and the hooks derive the port from it.Layout.waCdnbecomes configurable, so a page can load Web Awesome either from/wa-pro(local Pro package) or fromhttps://cdn.jsdelivr.net/npm/@awesome.me/webawesome@<version>/dist-cdn(free, public).build.mill, following the iw-support convention:BeforeAllstartsServerin a thread, polls a page until it answers HTTP 200 with a deadline, andAfterAllstops it. Model:ScenariosServerHooks.scalain the iw-support suite.wa-*element on it reports:defined, and the console has no error. This alone replaces most of the manual review.toast.create(), tabs, tree, accordion, pagination, combobox filtering andallowCreate, data grid sort and search, slider, colour picker, carousel.npx playwright install --with-deps chromium) and runs the module. Decide whether the module belongs inside./mill __.testor outside it, because a browser job is slower and needs more setup than the other jobs.Decision: which runtime does CI render?
.npmrc) and annpm cistep.Evidence:
@awesome.me/webawesome@3.12.0is public (registry.npmjs.orgserves the tarball, and jsdelivr answers 200 fordist-cdn/webawesome.loader.js). The Pro package needs the token.Traps in the support module
e2e-testing/EXAMPLE.mddocuments a ZIO API (E2ETestLayers,ZIOPageObject,withPage) that does not exist in the source. UseREADME.mdandUSAGE_GUIDE.md.gluearray must containworks.iterative.testing.e2e, or the lifecycle hooks never run.headlessdefaults to true.channel = "chrome"(with aPLAYWRIGHT_CHANNELoverride) is needed on hosts where the downloaded chromium cannot run, for example nix-profile machines.Afterhook must add the screenshot if we want one.E2ETestConfig.timeoutis read from the config but never applied to the page.Definition of done
./mill scenarios.e2epasses locally, headless.CONTRIBUTING.mdtells how to run the suite and how to add a scenario.COMPONENTS.mdstates which check is automatic now, so the manual Review column stops being the only evidence.