germsvel / phoenix_test

PhoenixTest provides a unified way of writing feature tests -- regardless of whether you're testing LiveView pages or static (non-LiveView) pages.
https://hex.pm/packages/phoenix_test
MIT License
178 stars 23 forks source link

Add Playwright driver (no deps) #145

Open ftes opened 3 weeks ago

ftes commented 3 weeks ago

Add Playwright test driver. It communicates with the playwright node.js server via a Port. No additional dependencies.

Details

Out of scope (just document how to)

ftes commented 3 weeks ago

In my eyes this is the most promising approach of the three so far (#136 , #74 #145).

The amount of code required to interface with playwright via a Port is fairly small. And this gives us the flexibility to tailor the exact behaviour to PhoenixTest.

@germsvel If you have time I'd appreciate hearing your thoughts.

ftes commented 3 weeks ago

New Idea: Performant assertions + helpful and consistent error messages in case of failure:

Happy path (test succeeds): Assert using playwright primitives. Test fails: Generate error by calling PhoenixTest.Assertions or PhoenixTest.Element.*.find* function.

ftes commented 3 weeks ago

Replaced also_test_js macro with ExUnit 1.18 parameterized tests. As a side effect, playwright tests only run for the CI test matrix elixir=main1.18 (1.18) entry. And not for the older versions.

Given this would be a driver in "beta" state anyway, I think that's fine.

image