Skip to content

[Docs]: Common Mistakes #3040

@cityjumper

Description

@cityjumper

Page(s)

https://playwright.dev/python/docs/release-notes would be great to have a new page under guides - Best Practices or Common Mistakes

Description

I love Playwright, however it is a bit of a journey to learn it. From my experience the only way to learn is to get your hands dirty, and by doing so unavoidably people will make mistakes. I would like to request to share best practices or having a place of common mistakes in the Docs. This serves 2 purposes: makes it easier for people to adopt the tools and reinforces that many mistakes are just lack of understanding of when / how sites are rendered. I believe a key part is the flaky tests which catches people off guard on a regular basis.

Here are some ideas for documents that I have used internally:

  • Use locators, not selectors
  • Avoid arbitrary waits
  • Run tests in parallel (easier to find flaky tests this way)
  • Use fixtures
  • Use Playwright assertions
  • Retry with intent
  • Avoid Long end-to-end flows (break them up)
  • Ignoring flaky failures (“just retry it”)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions