I like a lot about Playwright, but I constantly hit abstraction ceiling issues because you’re not allowed to write something like “click button, if text is A do this if text is B do this” at the top level.
Playwright docs argue about flakiness, but you can actually have a thing that has two different interaction models depending on things! Makes me sad every time I hit that issue because now I’m spending time futzing around in tests instead of improving confidence in my systems.
I do really appreciate that Playwright makes flaky tests more consistently fail though. Great stuff
One thing you can try is to wait for either of the texts to appear (something like cost text = page.getByText("A").or(page.getByText("B")), and then check text to see which one turned up.
This won’t work in some situations, for example if A starts on the page, and when the button is clicked might be replaced by B. In this case, there’s no way for Playwright (or indeed a real life human) to distinguish between “this A is leftover from before, I should wait for B”, and “there is no B coming, this A is the final result”.
I like a lot about Playwright, but I constantly hit abstraction ceiling issues because you’re not allowed to write something like “click button, if text is A do this if text is B do this” at the top level.
Playwright docs argue about flakiness, but you can actually have a thing that has two different interaction models depending on things! Makes me sad every time I hit that issue because now I’m spending time futzing around in tests instead of improving confidence in my systems.
I do really appreciate that Playwright makes flaky tests more consistently fail though. Great stuff
One thing you can try is to wait for either of the texts to appear (something like
cost text = page.getByText("A").or(page.getByText("B")), and then checktextto see which one turned up.This won’t work in some situations, for example if A starts on the page, and when the button is clicked might be replaced by B. In this case, there’s no way for Playwright (or indeed a real life human) to distinguish between “this A is leftover from before, I should wait for B”, and “there is no B coming, this A is the final result”.