Repository navigation
Conversation
| conn = | ||
| context.conn | ||
| |> press("#theme-menu-trigger", "Enter") | ||
| |> unwrap(&Playwright.Page.press!(&1, "#theme-menu-trigger", "Enter")) |
There was a problem hiding this comment.
Note: the Playwright.Page.click!/press! calls through unwrap are non-strict, so they act on the first match. The phoenix_test_playwright calls they replace were strict and raised when a selector matched several elements. All tests pass as is; pass strict: true (or go through Page.locator/2) if you want that check back.
| context | ||
| # Cucumber creates the ExUnit modules, so no `use Playwright.Test` can | ||
| # register the scenario: run its per-test setup here. | ||
| Playwright.Test.__setup__(context) |
There was a problem hiding this comment.
Note: Playwright.Test.__setup__/1 is internal to playwright_ex. It's needed because cucumber generates its scenario modules with a hardcoded use ExUnit.Case, so nothing can use Playwright.Test. The proper fix belongs upstream in cucumber: letting compile_features! take a case template (e.g. case_template: HuddlzWeb.BrowserCase) would let a template use Playwright.Test, which also gives each scenario real results for its screenshots and traces. Until then, this call is the stop-gap.
ed91390 to
c0764ea
Compare
|
Thanks for doing the port, Fredrik. We’re waiting for stable releases before adopting it. We ran the proposed migration locally and all 60 browser scenarios passed on both the PR and its base. Three things came out of the comparison.
For a stable migration we’d also keep the old strict click and keypress behavior, as you flagged, so an accidentally duplicated control still fails the scenario. |
|
Thanks for the careful comparison Micah!
|
Steps act through Fluffy's strict locators, Keyboard and Mouse instead of the PhoenixTest facade and Playwright.Page calls with selectors, so a duplicated control fails the scenario again.
It combines the case_template and step_wrapper drafts (huddlz-hq/cucumber#84, huddlz-hq#85).
Cucumber now uses HuddlzWeb.BrowserCase in place of ExUnit.Case, so each scenario is a Playwright.Test test and the hook no longer runs its per-test setup. The template owns the sandbox, which stops after the contexts close.
Cucumber's step wrapper runs every step inside Playwright.Test.step, so a trace groups each step's actions under its Given/When/Then line. It is set in the browser suite's helper, as the fast suite's steps are no Playwright tests.
Playwright.Test now learns each scenario's result, so a passing run leaves no per-scenario artifacts and CI's failure upload holds just the failures.
Fluffy has no step/2, so excluding it did nothing.
Cucumber now takes it as an option, so it wraps only the browser features without setting the app env. Bumps the fork to d75ec023.
Move browser tests from
phoenix_test_playwrighttofluffy(RC), based on the new major version ofplaywright_ex(also RC).I'm the author of phoenix_test_playwright, playwright_ex and fluffy. I'm looking for some earlier adopters to validate everything in the new versions is working - and I thought the best way is to create PRs :).
I'd love to hear your feedback!