forked from CommitQuality/Playwright-dependency
-
Notifications
You must be signed in to change notification settings - Fork 0
/
global-setup.ts
21 lines (18 loc) · 827 Bytes
/
global-setup.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { expect, Browser, Page, chromium } from "@playwright/test";
async function globalSetup() {
const browser: Browser = await chromium.launch({
headless: false,
});
const context = await browser.newContext();
const page: Page = await context.newPage();
await page.goto("https://commitquality.com/login");
await page.locator('[data-testid="username-textbox"]').fill("test");
await page.locator('[data-testid="password-textbox"]').fill("test");
await page.locator('[data-testid="login-button"]').click();
await expect(page.locator('[data-testid="navbar-logout"]')).toBeVisible();
// Save the state of the webpage - meaning we are logged in
await page.context().storageState({ path: "./LoginAuthCQ.json" });
// Dont forget your clean up :)
await browser.close();
}
export default globalSetup;