Skip to content

Commit

Permalink
fix(e2e): Drop index, use last. Match by value without using fill()
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Dec 20, 2024
1 parent a24345a commit 710156f
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions e2e/tests/ui-driven/src/helpers/addComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit 710156f

Please sign in to comment.