15 lines
610 B
TypeScript
15 lines
610 B
TypeScript
import { test as setup } from '@playwright/test'
|
|
import { fileURLToPath } from 'url'
|
|
import path from 'path'
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
const authFile = path.join(__dirname, '.auth/user.json')
|
|
|
|
setup('autenticacion', async ({ page }) => {
|
|
await page.goto('/login')
|
|
await page.locator('input[id^="username"]').fill('demo')
|
|
await page.locator('input[id^="password"]').fill('demo123')
|
|
await page.click('button[type="submit"]')
|
|
await page.waitForURL(/dashboard/, { timeout: 60000 })
|
|
await page.context().storageState({ path: authFile })
|
|
}) |