eslint-plugin-playwright
eslint-plugin-playwright copied to clipboard
Warn about missing expect and locators being awaited pointlessly
Bad:
await page.locator('.hello-world')
The code above is wrong because it doesn't do anything. We just await a locator and then throw it away, but that doesn't test anything.
Good:
await expect(page.locator('.hello-world')).toBeVisible()
or
await page.locator('.hello-world').waitFor()
or anything else, as long as you actually use the locator for something.