-
Book Overview & Buying
-
Table Of Contents
Hands-On Automated Testing with Playwright
By :
When you write tests, aim for one unified suite that runs smoothly on every browser without constantly troubleshooting browser-specific issues. And when you’re writing your assertions, put yourself in the user’s shoes and focus on what they actually see and do.It’s better to validate outcomes that are visible or meaningful to the end user rather than internal details that might behave differently between browsers. For example, checking that a button is visible is more robust than checking its exact CSS color value (unless that color is a specific requirement).Playwright’s expect API is a great tool for this. It comes with built-in auto-retrying, which helps with minor timing differences between browsers. If you’re asserting something like await expect(locator).toBeVisible(), Playwright will automatically keep checking until the condition is met or the timeout is reached.Also, keep in mind that visual rendering...