From 109ffab8c4ba21476693201dc721d6c036771ad8 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 20 Feb 2026 06:55:20 +0100 Subject: [PATCH] tweak vars --- tests/e2e/env.d.ts | 1 + tests/e2e/register.test.ts | 8 ++++---- tools/test-e2e.sh | 13 ++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/e2e/env.d.ts b/tests/e2e/env.d.ts index ff8898ef0e..71887f4048 100644 --- a/tests/e2e/env.d.ts +++ b/tests/e2e/env.d.ts @@ -1,5 +1,6 @@ declare namespace NodeJS { interface ProcessEnv { + GITEA_TEST_E2E_DOMAIN: string; GITEA_TEST_E2E_USER: string; GITEA_TEST_E2E_EMAIL: string; GITEA_TEST_E2E_PASSWORD: string; diff --git a/tests/e2e/register.test.ts b/tests/e2e/register.test.ts index dd42d5113e..425fc7e40c 100644 --- a/tests/e2e/register.test.ts +++ b/tests/e2e/register.test.ts @@ -24,7 +24,7 @@ test('register with empty fields shows error', async ({page}) => { test('register with mismatched passwords shows error', async ({page}) => { await page.getByLabel('Username').fill('e2e-register-mismatch'); - await page.getByLabel('Email Address').fill('e2e-register-mismatch@e2e.gitea.com'); + await page.getByLabel('Email Address').fill(`e2e-register-mismatch@${env.GITEA_TEST_E2E_DOMAIN}`); await page.getByLabel('Password', {exact: true}).fill('password123!'); await page.getByLabel('Confirm Password').fill('different123!'); await page.getByRole('button', {name: 'Register Account'}).click(); @@ -33,7 +33,7 @@ test('register with mismatched passwords shows error', async ({page}) => { test('register then login', async ({page}) => { const username = `e2e-register-${Date.now()}`; - const email = `${username}@e2e.gitea.com`; + const email = `${username}@${env.GITEA_TEST_E2E_DOMAIN}`; const password = 'password123!'; await page.getByLabel('Username').fill(username); @@ -57,8 +57,8 @@ test('register then login', async ({page}) => { }); test('register with existing username shows error', async ({page}) => { - await page.getByLabel('Username').fill('e2e-user'); - await page.getByLabel('Email Address').fill('e2e-duplicate@e2e.gitea.com'); + await page.getByLabel('Username').fill(env.GITEA_TEST_E2E_USER); + await page.getByLabel('Email Address').fill(`e2e-duplicate@${env.GITEA_TEST_E2E_DOMAIN}`); await page.getByLabel('Password', {exact: true}).fill('password123!'); await page.getByLabel('Confirm Password').fill('password123!'); await page.getByRole('button', {name: 'Register Account'}).click(); diff --git a/tools/test-e2e.sh b/tools/test-e2e.sh index 889d5a6f44..d8608a85bb 100755 --- a/tools/test-e2e.sh +++ b/tools/test-e2e.sh @@ -71,20 +71,23 @@ done echo "Gitea server is ready at $E2E_URL" -# Create admin test user -GITEA_TEST_E2E_USER="e2e-user" -GITEA_TEST_E2E_EMAIL="e2e-user@e2e.gitea.com" +GITEA_TEST_E2E_DOMAIN="e2e.gitea.com" +GITEA_TEST_E2E_USER="e2e-admin" GITEA_TEST_E2E_PASSWORD="password" +GITEA_TEST_E2E_EMAIL="$GITEA_TEST_E2E_USER@$GITEA_TEST_E2E_DOMAIN" + +# Create admin test user "./$EXECUTABLE" admin user create \ --username "$GITEA_TEST_E2E_USER" \ - --email "$GITEA_TEST_E2E_EMAIL" \ --password "$GITEA_TEST_E2E_PASSWORD" \ + --email "$GITEA_TEST_E2E_EMAIL" \ --must-change-password=false \ --admin export GITEA_TEST_E2E_URL="$E2E_URL" +export GITEA_TEST_E2E_DOMAIN export GITEA_TEST_E2E_USER -export GITEA_TEST_E2E_EMAIL export GITEA_TEST_E2E_PASSWORD +export GITEA_TEST_E2E_EMAIL pnpm exec playwright test "$@"