2023-12-17 06:02:22 -05:00
|
|
|
/**
|
|
|
|
* @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();
|
2024-01-13 16:35:11 -05:00
|
|
|
await page.getByRole("button", { name: "Log in" }).click();
|
2023-12-17 06:02:22 -05:00
|
|
|
await page.isVisible("text=Add New Monitor");
|
|
|
|
}
|