r/webdev • u/TranslatorRude4917 • Oct 30 '26
Resource quality time - posting one small e2e test fix a day
Hey all!
I’m a FE dev / SDET. Years ago a QA colleague introduced me to e2e testing and Page Objects, and I’ve been hooked ever since.
I’m thinking of starting a small series with one e2e practice a day, the kind an agent won’t pick up just from reading the Playwright docs. Each one is plain Playwright with a before/after, plus a prompt you can hand to your agent.
Topics range from basics (structuring page objects, moving setup into fixtures) to more advanced ones, like using Dave Farley’s four-layer architecture so the same spec can run through different drivers (UI, API, MCP…).
Why bother? Testing isn’t most devs’ favourite thing, and agents writing every test for us isn’t helping. But the more decisions we hand to AI, the more it matters that we own the ones closest to how users experience the product - and e2e tests happen to be the closest thing protecting those decisions.
So: would this be useful here, or should I f*** off? :D
Full disclosure: I’m building a fair-source dev tool around testing, so being active in this space matters to me. Some concepts come from articles on my blog, and when they do, I’d link them for anyone who wants more.
Looking forward to your answer - here goes the first one!
----------------------------
This test is supposed to check adding a bank account. But it also signs up and signs in through the UI, so a sign-up form redesign breaks a bank account test, and every extra UI step is one more chance to flake.
The fix: create the user through the API (a tiny fixture, two POST calls) and use the UI only for what the test checks. 16 UI steps become 7, and there's one reason left for the test to break instead of three.
It's not a rule to apply blindly. If the test is about sign-up, click through sign-up.
Paste this to your agent:
Find e2e tests that use UI steps to get the app into its starting state (ex. users, sign-in, existing records) when that flow isn't what the test is about. Move that setup to the API and keep UI steps for the behavior under test.
5
u/Chenipan Oct 30 '26
This is so bad, please don't give advice if your posts are gonna be worse than what the playwright docs show
1
u/PositiveLog1928 Oct 30 '26
The #1 fix being "don't do your setup through the UI" is basically page one of the Cypress docs, but I've opened suites this year that still sign up a fresh user through the form before every single test, so sure. What got me is Page Objects getting name-dropped and then left out of the actual example, that's the plot twist I want from #2.
0
u/Wrong-Expression-669 Oct 30 '26
The "#1" slide already annoys me. "you're not testing sign-up so why click through it" ok so what are you testing then, the fact that the form submits? that's not a test that's a prayer with extra steps. and honestly the "kind an agent won't pick up from reading documentation" thing, most of these practices are in a 2016 blog post about Page Objects that your old QA colleague probably read too. one a day is a nice promise until day 4 when the test you want to post needs a fixture that takes an hour to write
1
u/[deleted] Oct 30 '26
[removed] — view removed comment