Hello.. I'm testing lots of small SPAs, and I'm struggling to come up with a strong pattern to handle loading/error/success states. Currently I have a pretty simple approach where I check for an error state:
error_dialog = page.locator('.error-dialog')
if error_dialog.is_visible():
# handle specific error state
What would be a strong pattern to handle loading and error states throughout a playwright script run? Ideally with a way to just wait for the loading state to clear before then checking for error or success states? Do I wrap the entire script in a giant try/except block?
Curious to see how others are handling what must be a pretty common use case.
EDIT: This is for an automation script, not a pytest script.
Thanks in advance!
This thread is trying to answer question "What would be a strong pattern to handle loading and error states throughout a playwright script run?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].