test: Migrate form trigger test from cypress -> playwright (#19453)

This commit is contained in:
Elias Meire
2025-09-15 13:59:58 +02:00
committed by GitHub
parent 2b0203ef54
commit 7ded694ce7
5 changed files with 99 additions and 116 deletions

View File

@@ -0,0 +1,10 @@
import type { Locator } from '@playwright/test';
/**
* Returns a locator for a specific element by index, or the original locator if no index is provided.
* Without an index, Playwright throws an error when multiple matching elements are found.
* @see https://playwright.dev/docs/locators#strictness
*/
export function locatorByIndex(locator: Locator, index?: number) {
return typeof index === 'number' ? locator.nth(index) : locator;
}