diff --git a/e2e/tests/keycloak/tests.spec.ts b/e2e/tests/keycloak/tests.spec.ts index 466709b..2c1b398 100644 --- a/e2e/tests/keycloak/tests.spec.ts +++ b/e2e/tests/keycloak/tests.spec.ts @@ -213,10 +213,10 @@ http: expect(response.status()).toBe(200); - const authHeaderExists = await page.locator(`text=Authorization: Bearer: ey`).isVisible(); + const authHeaderExists = await page.getByText("Authorization: Bearer: ey").isVisible(); expect(authHeaderExists).toBeTruthy(); - const staticHeaderExists = await page.locator(`text=X-Static-Header: 42`).isVisible(); + const staticHeaderExists = await page.getByText("X-Static-Header: 42").isVisible(); expect(staticHeaderExists).toBeTruthy(); // Authorization cookie should not be present in the rendered contents @@ -760,12 +760,12 @@ http: //----------------------------------------------------------------------------- async function login(page: Page, username: string, password: string, waitForUrl: string): Promise { - await page.locator("#username").fill(username); - await page.locator("#password").fill(password); + await page.getByRole("textbox", { name: 'Username or email' }).fill(username); + await page.getByRole("textbox", { name: "Password" }).fill(password); const responsePromise = page.waitForResponse(waitForUrl); - await page.locator('#kc-login').click(); + await page.getByRole("button", { name: "Sign In" }).click(); const response = await responsePromise; diff --git a/e2e/utils.ts b/e2e/utils.ts index 0865340..94c14f4 100644 --- a/e2e/utils.ts +++ b/e2e/utils.ts @@ -13,6 +13,7 @@ export async function configureTraefik(yaml: string) { fs.writeFileSync(filePath, yaml); // Wait some time for traefik to reload the config - await new Promise(r => setTimeout(r, 2000)); + // Note: Traefik has a throttle duration of 2s. + await new Promise(r => setTimeout(r, 2500)); } }