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 })
|
2022-09-14 22:50:02 +00:00
|
|
|
await page.goto('http://localhost:8080/index.php/apps/memories' + route)
|
2022-09-14 18:18:57 +00:00
|
|
|
|
|
|
|
await page.locator('[placeholder="Username or email"]').click();
|
|
|
|
await page.locator('[placeholder="Username or email"]').fill('admin');
|
|
|
|
await page.locator('[placeholder="Username or email"]').press('Tab');
|
2022-09-14 22:50:02 +00:00
|
|
|
await page.locator('[placeholder="Password"]').fill('password');
|
2022-09-14 18:18:57 +00:00
|
|
|
await page.locator('input:has-text("Log in")').click();
|
2022-09-14 22:50:02 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|