difuse-playwright/tests/auth.setup.js

15 lines
654 B
JavaScript
Raw Normal View History

2024-02-07 00:02:43 +00:00
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 });
2024-06-02 12:55:31 +00:00
await page.getByPlaceholder('Username').fill(process.env.ADMIN_USER);
2024-02-07 00:29:45 +00:00
await page.getByPlaceholder('Password').fill(process.env.ADMIN_PASS);
await page.getByRole('link', { name: 'Login' }).click();
2024-02-07 00:02:43 +00:00
await page.waitForSelector('span:has-text("Quick Actions")', { timeout: 3000 });
expect(await page.title()).toBe('Difuse - Dashboard - Router');
await page.context().storageState({ path: authFile });
});