Keycloak
17 строк · 519.0 Байт
1import { Page } from "@playwright/test";
2import { DEFAULT_REALM } from "../src/constants";
3import { getRootPath } from "../src/utils/getRootPath";
4
5export const login = async (
6page: Page,
7username: string,
8password: string,
9realm = DEFAULT_REALM,
10) => {
11const rootPath = getRootPath(realm);
12
13await page.goto(rootPath);
14await page.getByLabel("Username").fill(username);
15await page.getByLabel("Password", { exact: true }).fill(password);
16await page.getByRole("button", { name: "Sign In" }).click();
17};
18