memories/e2e/login.ts

16 lines
693 B
TypeScript
Raw Normal View History

2022-09-14 18:18:57 +00:00
import { expect, PlaywrightTestArgs } from '@playwright/test';
export function login(route: string) {
return async ({ page }: PlaywrightTestArgs) => {
await page.setViewportSize({ width: 800, height: 600 })
await page.goto('http://localhost:8080/index.php/apps/memories' + route)
2022-09-14 18:18:57 +00:00
2022-10-10 23:57:11 +00:00
await page.locator('#user').click();
await page.locator('#user').fill('admin');
await page.locator('#user').press('Tab');
await page.locator('#password').fill('password');
await page.locator('button[type="submit"]').click();
await expect(page).toHaveURL('http://localhost:8080/index.php/apps/memories' + route);
await page.waitForSelector('img[src*="core/preview"]');
2022-09-14 18:18:57 +00:00
}
}