2023-10-30 00:54:53 +00:00
|
|
|
import { expect, type PlaywrightTestArgs } from '@playwright/test';
|
2022-09-14 18:18:57 +00:00
|
|
|
|
|
|
|
export function login(route: string) {
|
|
|
|
return async ({ page }: PlaywrightTestArgs) => {
|
2022-11-06 07:03:01 +00:00
|
|
|
await page.setViewportSize({ width: 800, height: 600 });
|
2023-09-30 18:56:55 +00:00
|
|
|
await page.goto('http://localhost:8080/index.php/apps/memories' + route);
|
2022-09-14 18:18:57 +00:00
|
|
|
|
2023-09-30 18:56:55 +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');
|
2022-10-10 23:57:11 +00:00
|
|
|
await page.locator('button[type="submit"]').click();
|
2023-09-30 18:56:55 +00:00
|
|
|
await expect(page).toHaveURL('http://localhost:8080/index.php/apps/memories' + route);
|
2022-11-06 07:03:01 +00:00
|
|
|
};
|
|
|
|
}
|