Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright #169

Open
coryhouse opened this issue May 15, 2023 · 0 comments
Open

Playwright #169

coryhouse opened this issue May 15, 2023 · 0 comments

Comments

@coryhouse
Copy link
Owner

coryhouse commented May 15, 2023

Locators can be chained to narrow down the search to a particular part of the page.

Use codegen to quickly write tests

const product = page.getByRole('listitem').filter({ hasText: 'Product 2' });

Set up watch mode to rerun the associated test upon save (this assumes the test file and the test are in the same dir)

Playwright automatically traverses the shadow DOM.

NOTE: If you call expect, but forget to import expect, it will fail the test, but won't tell you why. 🤬

Use project dependencies for running login once

Fail test if there's a console log

npm scripts

"start:codegen": "concurrently npm:start-mocked npm:codegen",
"codegen": "playwright codegen --load-storage=storageState.json http://localhost:3000",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant