uptime-kuma/test/e2e/util-test.js
James Cocker 8456912ae3
Corrected "Login" & "Logout" to verbs (EN) (#4320)
Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
2024-01-14 05:35:11 +08:00

28 lines
824 B
JavaScript

/**
* @param {TestInfo} testInfo Test info
* @param {Page} page Page
* @returns {Promise<void>}
*/
export async function screenshot(testInfo, page) {
const screenshot = await page.screenshot();
await testInfo.attach("screenshot", {
body: screenshot,
contentType: "image/png"
});
}
/**
* @param {Page} page Page
* @returns {Promise<void>}
*/
export async function login(page) {
// Login
await page.getByPlaceholder("Username").click();
await page.getByPlaceholder("Username").fill("admin");
await page.getByPlaceholder("Username").press("Tab");
await page.getByPlaceholder("Password").fill("admin123");
await page.getByLabel("Remember me").check();
await page.getByRole("button", { name: "Log in" }).click();
await page.isVisible("text=Add New Monitor");
}