difuse-playwright/tests/auth.setup.js
2024-02-07 05:59:45 +05:30

14 lines
655 B
JavaScript

import { test, expect } from '@playwright/test';
const authFile = 'playwright/.auth/user.json';
test('Authenticate', async ({ page }) => {
await page.goto('/login');
await page.waitForSelector('input[name="user"]', { timeout: 3000 });
await page.getByPlaceholder('Username').fill( process.env.ADMIN_USER);
await page.getByPlaceholder('Password').fill(process.env.ADMIN_PASS);
await page.getByRole('link', { name: 'Login' }).click();
await page.waitForSelector('span:has-text("Quick Actions")', { timeout: 3000 });
expect(await page.title()).toBe('Difuse - Dashboard - Router');
await page.context().storageState({ path: authFile });
});