mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-22 21:53:17 +01:00
Remove login_user helper and LOGIN_PASSWORD constant, pass E2E_USER and E2E_PASSWORD from the test script to playwright via env vars. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 lines
645 B
TypeScript
16 lines
645 B
TypeScript
import {expect} from '@playwright/test';
|
|
import type {Page} from '@playwright/test';
|
|
|
|
export async function login(page: Page, user: string = process.env.E2E_USER) {
|
|
await page.goto('/user/login');
|
|
await page.getByLabel('Username or Email Address').fill(user);
|
|
await page.getByLabel('Password').fill(process.env.E2E_PASSWORD);
|
|
await page.getByRole('button', {name: 'Sign In'}).click();
|
|
await expect(page.getByRole('link', {name: 'Sign In'})).toBeHidden();
|
|
}
|
|
|
|
export async function logout(page: Page) {
|
|
await page.getByText('Sign Out').dispatchEvent('click');
|
|
await expect(page.getByRole('link', {name: 'Sign In'})).toBeVisible();
|
|
}
|