mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-22 17:33:16 +01:00
Remove the Go test harness that compiled test binaries and bootstrapped a full Gitea server with fixtures. Replace with a bash script that runs Playwright directly against an already-running Gitea instance. - Remove Go e2e test files (e2e_test.go, utils_e2e_test.go) - Add tools/test-e2e.sh that detects server URL, creates e2e user, runs Playwright - Simplify Makefile to single test-e2e target - Rewrite playwright.config.ts with chromium-only, no file outputs - Rewrite tests using semantic Playwright locators (getByLabel, getByRole, getByText) - Add login/logout utilities in tests/e2e/utils.ts - Add CI workflow for e2e tests (.github/workflows/pull-e2e-tests.yml) - Install only chromium in playwright install step Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 lines
866 B
TypeScript
25 lines
866 B
TypeScript
import {expect} from '@playwright/test';
|
|
import type {Browser, Page} from '@playwright/test';
|
|
|
|
const LOGIN_PASSWORD = 'password';
|
|
|
|
export async function login(page: Page, user: string = 'e2e') {
|
|
await page.goto('/user/login');
|
|
await page.getByLabel('Username or Email Address').fill(user);
|
|
await page.getByLabel('Password').fill(LOGIN_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();
|
|
}
|
|
|
|
export async function login_user(browser: Browser, user: string) {
|
|
const context = await browser.newContext();
|
|
const page = await context.newPage();
|
|
await login(page, user);
|
|
return context;
|
|
}
|