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

[New Rule] Add a rule to verify that a locator has an action verb / method / assertion #197

Closed
unlikelyzero opened this issue Jan 12, 2024 · 5 comments

Comments

@unlikelyzero
Copy link

We're in process of migrating from page.click('badlocator') to page.goodlocatorstrategy().click() and are finding it difficult to be precise when changing 700+ references. It would be great if we could ensure that the locator had an action verb / method / assertion at the end of a locator

@python012
Copy link

python012 commented Jan 17, 2024

do you mean the rule to make sure every locator variable is used/called in a function? So that no locator variable is not used

@mskelton
Copy link
Member

This feels like quite an edge case. I've been thinking about this for a bit and I don't think it really makes sense to include in the plugin. Going to close as not planned.

@mskelton mskelton closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2024
@unlikelyzero
Copy link
Author

@mskelton understood

@unlikelyzero
Copy link
Author

@mskelton so, I just found out that playwright/no-useless-await actually detects these:

    await page.getByRole('searchbox', { name: 'Search Input' });

Was missed in the conversion from page.click()

@unlikelyzero
Copy link
Author

@mskelton this ticket was implicitly closed by #315

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

3 participants