Files
windmill/frontend/tests/global-setup.ts
Ádám Kovács f0435f5f81 fix(frontend): Playwright (#1108)
* fix(frontend): Playwright

* fix(frontend): Update test base url

* feat(ci): Add base url to playwright
2023-01-16 16:51:14 +01:00

28 lines
885 B
TypeScript

import { chromium } from '@playwright/test'
async function globalSetup() {
const browser = await chromium.launch()
// baseURL is set in the global config, but it doesn't affect the globalSetup script.
const page = await browser.newPage({ baseURL: process.env.BASE_URL || 'http://localhost' })
await page.goto('/user/login', { waitUntil: 'networkidle' })
if (await page.locator('#email').isHidden()) {
await page.locator('button', {
hasText: 'Login without third-party'
}).click()
}
const email = page.locator('input[type="email"]')
await email.fill('user@windmill.dev')
const password = page.locator('input[type="password"]')
await password.fill('changeme')
await page.locator('#login2').click()
await page.waitForResponse('/api/auth/login')
await page.context().storageState({ path: 'storageState.json' })
await browser.close()
}
export default globalSetup