chore(e2e): simplify authentication setup (#6400)

Replaced manual login and context loading across tests with Playwright's `test.use` configuration for user authentication. This simplifies test setup, improves readability, and reduces repetition.

For #6362

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6400
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Julian Schlarb <julian.schlarb@denktmit.de>
Co-committed-by: Julian Schlarb <julian.schlarb@denktmit.de>
This commit is contained in:
Julian Schlarb 2025-01-05 05:17:04 +00:00 committed by Gusted
parent a2eb249766
commit 68d690b6b9
19 changed files with 327 additions and 254 deletions

View file

@ -5,13 +5,11 @@
// @watch end
import {expect} from '@playwright/test';
import {test, save_visual, login_user, load_logged_in_context} from './utils_e2e.ts';
import {save_visual, test} from './utils_e2e.ts';
test('Follow actions', async ({browser}, workerInfo) => {
await login_user(browser, workerInfo, 'user2');
const context = await load_logged_in_context(browser, workerInfo, 'user2');
const page = await context.newPage();
test.use({user: 'user2'});
test('Follow actions', async ({page}) => {
await page.goto('/user1');
// Check if following and then unfollowing works.