diff --git a/e2e/tests/ui-driven/src/helpers/addComponent.ts b/e2e/tests/ui-driven/src/helpers/addComponent.ts index 9058eb1e08..e85252b715 100644 --- a/e2e/tests/ui-driven/src/helpers/addComponent.ts +++ b/e2e/tests/ui-driven/src/helpers/addComponent.ts @@ -394,20 +394,13 @@ async function createComponentOptionsWithDataValues( page: Page, options: OptionWithDataValues[], ) { - let index = 0; for (const option of options) { await page.locator("button").filter({ hasText: "add new" }).click(); - await page.getByPlaceholder("Option").nth(index).fill(option.optionText); - await page.getByRole("combobox", { name: "Data field" }).nth(index).click(); - await page - .getByRole("combobox", { name: "Data field" }) - .nth(index) - .fill(option.dataValue); + await page.getByPlaceholder("Option").last().fill(option.optionText); + await page.getByRole("combobox", { name: "Data field" }).last().click(); await page - .getByRole("combobox", { name: "Data field" }) - .nth(index) - .press("Enter"); - index++; + .getByRole("option", { name: option.dataValue, exact: true }) + .click() } }