diff --git a/playwright/support/commands.ts b/playwright/support/commands.ts index ab4351d81f..48a2c29727 100644 --- a/playwright/support/commands.ts +++ b/playwright/support/commands.ts @@ -605,22 +605,22 @@ export async function createTextLinkColumn( .click() await expect(page.getByText('Allowed types')).toBeVisible() - await setCheckboxState( - page.getByRole('checkbox', { name: /^URL$/i }), - false, - ) - await setCheckboxState( - page.getByRole('checkbox', { name: /^Files$/i }), - false, - ) + const providerSwitches = page.locator('.typeSelection').getByRole('switch') + await expect(providerSwitches.first()).toBeVisible() + + const providerCount = await providerSwitches.count() + for (let index = 0; index < providerCount; index++) { + await setCheckboxState(providerSwitches.nth(index), false) + } for (const provider of ressourceProvider) { - await setCheckboxState( - page.getByRole('checkbox', { + const providerSwitch = page + .locator('.typeSelection') + .getByRole('switch', { name: new RegExp(`^${escapeRegExp(provider)}$`, 'i'), - }), - true, - ) + }) + await expect(providerSwitch).toHaveCount(1) + await setCheckboxState(providerSwitch, true) } await page .locator('.modal-container button')