-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
p2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)pr welcome
Description
Clear and concise description of the problem
Playwright supports an nth() method on its Locator which derives a new locator targeting a specific index in a multi-element set.
We can accomplish something similar in vitest using expect.poll of course:
await expect.poll( ()=> page.getByRole('button').elements()[3] ).toBeInTheDocument();
But this can get annoying if we want to perform an interaction e.g. click on the element -- we need to wrap the element in a locator again.
Suggested solution
- feat: Implement Locator.nth() #7137
- Implement other high-value Playwright locator methods
Alternative
As mentioned, there is always some way to accomplish what we need using expect.poll, but the Playwright idioms of nth, and, or etc are highly productive and readable in comparison.
Additional context
My testing team is interested in this feature and we may be willing to try implementing it, but I wanted to check on the maintainers' opinions first to make sure this is a reasonable direction for ivya + vitest to move in.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)pr welcome