What are some recommended practices for using @playwright/test when testing copy changes made by a backend team?


Best Practices for Testing Copy Changes with @playwright/test

When testing copy changes made by a backend team, it's crucial to follow some best practices to ensure your tests are reliable and efficient.

Use Web First Assertions

Web first assertions are your best friend. They allow you to verify that the expected result matches the actual result. For example, if you're testing an alert message, you can use toBeVisible() to ensure the alert message is visible.


Avoid manual assertions that don't await the expect. Instead, use web first assertions like toBeVisible().

Debugging and CI/CD

For local debugging, use VSCode with the Playwright extension. You can pause at specific points in your code and inspect variables and states. For running tests on CI, set up CI/CD pipelines and run your tests frequently. Playwright comes with a GitHub Actions workflow that allows running tests on CI without any additional setup required.

Linting and Parallelism

Lint your tests to catch errors early. Tools like ESLint can help you ensure there are no missing await statements before asynchronous calls to the Playwright API.

Playwright provides built-in support for running tests in parallel. You can configure Playwright to run independent tests in parallel using the test.describe.configure({ mode: 'parallel' }) syntax.

test.describe.configure({ mode: 'parallel' })

Soft Assertions

Consider using soft assertions for improved productivity. They compile and display a list of failed assertions once the test ends, allowing you to make multiple checks without stopping the test at the first failure.

Remember, these best practices are specific to working with Playwright. Happy testing!


Thank you!
Was this helpful?
Still have questions?

If you still have questions, please ask a question and I will try to answer it.

Related Discord Threads

Related Questions

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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 luc@ray.run.