-
Notifications
You must be signed in to change notification settings - Fork 715
NO-JIRA: Remove redundant waitFor calls in Playwright e2e tests #16583
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,17 @@ module.exports = { | |||||||||||
| rules: { | ||||||||||||
| 'no-console': 'off', | ||||||||||||
| 'no-empty-pattern': 'off', | ||||||||||||
| 'no-restricted-syntax': [ | ||||||||||||
| 'warn', | ||||||||||||
| { | ||||||||||||
| selector: 'CallExpression[callee.property.name="waitFor"]', | ||||||||||||
| message: | ||||||||||||
| 'Playwright actions (click, fill, check, clear) auto-wait for actionability. ' + | ||||||||||||
| 'Do not call waitFor() before an action on the same locator. ' + | ||||||||||||
| 'If this waitFor() is intentional (waiting for state without a subsequent action), ' + | ||||||||||||
| 'add // eslint-disable-next-line no-restricted-syntax', | ||||||||||||
|
Comment on lines
+19
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could add another alternative to the the eslint disable rule, which is to use web assertions (it's suggested also by Playwright documentation: either use web assertions or
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||
| }, | ||||||||||||
| ], | ||||||||||||
| 'playwright/no-conditional-in-test': 'off', | ||||||||||||
| 'playwright/no-skipped-test': ['warn', { allowConditional: true }], | ||||||||||||
| }, | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also add another stronger alternative, which is to add it in conjunction with
or(). Let's say we have a modal with either error or success (so there are two possible locators):