2023-07-07 14:34:54 +00:00
|
|
|
import { Page } from "@playwright/test";
|
|
|
|
|
2023-08-18 12:18:28 +00:00
|
|
|
export const login = async (
|
|
|
|
page: Page,
|
|
|
|
username: string,
|
|
|
|
password: string,
|
|
|
|
realm?: string,
|
|
|
|
) => {
|
|
|
|
if (realm)
|
|
|
|
await page.goto(
|
|
|
|
process.env.CI ? `/realms/${realm}/account` : `/?realm=${realm}`,
|
|
|
|
);
|
2023-08-14 14:41:58 +00:00
|
|
|
await page.getByLabel("Username").fill(username);
|
2023-07-07 14:34:54 +00:00
|
|
|
await page.getByLabel("Password").fill(password);
|
|
|
|
await page.getByRole("button", { name: "Sign In" }).click();
|
|
|
|
};
|