keycloak-scim/js/apps/account-ui/test/login.ts
Jon Koops 7afd75ba08
Use browser router for Account Console (#22192)
Closes #27442

Signed-off-by: Jon Koops <jonkoops@gmail.com>
2024-03-04 12:38:28 +00:00

17 lines
519 B
TypeScript

import { Page } from "@playwright/test";
import { DEFAULT_REALM } from "../src/constants";
import { getRootPath } from "../src/utils/getRootPath";
export const login = async (
page: Page,
username: string,
password: string,
realm = DEFAULT_REALM,
) => {
const rootPath = getRootPath(realm);
await page.goto(rootPath);
await page.getByLabel("Username").fill(username);
await page.getByLabel("Password", { exact: true }).fill(password);
await page.getByRole("button", { name: "Sign In" }).click();
};