The Unified and Autonomous Development Platform
chore: Update e2e tests
Robin Shen352ec70ce1a0
diff --git a/e2e-test/playwright.config.js b/e2e-test/playwright.config.jsindex 5d0879ff6e..68cef831ad 100644--- a/e2e-test/playwright.config.js+++ b/e2e-test/playwright.config.js@@ -22,6 +22,10 @@ function getHostIp() {export default defineConfig({testDir: './tests',outputDir: './test-results',+ timeout: 3 * 60 * 1000,+ expect: {+ timeout: 30 * 1000,+ },fullyParallel: true,forbidOnly: Boolean(process.env.CI),retries: process.env.CI ? 2 : 0,@@ -30,6 +34,8 @@ export default defineConfig({workers: 1,use: {baseURL,+ actionTimeout: 30 * 1000,+ navigationTimeout: 2 * 60 * 1000,trace: 'on-first-retry',screenshot: 'only-on-failure',},diff --git a/e2e-test/tests/authorize-user.spec.js b/e2e-test/tests/authorize-user.spec.jsindex 6f3b629a93..a5ec12fdfa 100644--- a/e2e-test/tests/authorize-user.spec.js+++ b/e2e-test/tests/authorize-user.spec.js@@ -2,8 +2,6 @@ import { expect, test } from '@playwright/test';import { authorizeUser, createProject, createUser, login } from './helpers.js';test('admin can authorize a user to a project with Issue Reporter role', async ({ page }) => {- test.setTimeout(90_000);-const suffix = Date.now();await login(page, 'admin', 'admin');diff --git a/e2e-test/tests/confidential-issue.spec.js b/e2e-test/tests/confidential-issue.spec.jsindex d812698b59..bbfa17a9aa 100644--- a/e2e-test/tests/confidential-issue.spec.js+++ b/e2e-test/tests/confidential-issue.spec.js@@ -26,8 +26,6 @@ test.describe('confidential issue access', () => {let issueTitle;test('normal user can access confidential issue created by himself', async ({ page }) => {- test.setTimeout(180_000);-const suffix = Date.now();await login(page, 'admin', 'admin');@@ -53,8 +51,6 @@ test.describe('confidential issue access', () => {});test('normal user cannot access confidential issue created by others', async ({ page }) => {- test.setTimeout(60_000);-await login(page, other.userName, other.password);const response = await page.goto(issueUrl);@@ -67,8 +63,6 @@ test.describe('confidential issue access', () => {test('normal user authorized to a confidential issue created by others can access it', async ({page,}) => {- test.setTimeout(90_000);-await login(page, creator.userName, creator.password);await authorizeIssueUser(page, issueUrl, granted.userName);diff --git a/e2e-test/tests/create-project.spec.js b/e2e-test/tests/create-project.spec.jsindex 745a883c75..c52891b1c1 100644--- a/e2e-test/tests/create-project.spec.js+++ b/e2e-test/tests/create-project.spec.js@@ -2,8 +2,6 @@ import { expect, test } from '@playwright/test';import { createProject, login } from './helpers.js';test('admin can create a project', async ({ page }) => {- test.setTimeout(60_000);-await login(page, 'admin', 'admin');const projectName = await createProject(page);diff --git a/e2e-test/tests/create-user.spec.js b/e2e-test/tests/create-user.spec.jsindex ebfb127e54..5ee9ca4655 100644--- a/e2e-test/tests/create-user.spec.js+++ b/e2e-test/tests/create-user.spec.js@@ -2,8 +2,6 @@ import { expect, test } from '@playwright/test';import { createUser, login, logout } from './helpers.js';test('admin can create a user', async ({ page }) => {- test.setTimeout(60_000);-await login(page, 'admin', 'admin');const { userName, password } = await createUser(page);diff --git a/e2e-test/tests/edit-issue-field-from-list.spec.js b/e2e-test/tests/edit-issue-field-from-list.spec.jsindex 708159fb26..5d81a95b7c 100644--- a/e2e-test/tests/edit-issue-field-from-list.spec.js+++ b/e2e-test/tests/edit-issue-field-from-list.spec.js@@ -2,8 +2,6 @@ import { expect, test } from '@playwright/test';import { createProject, login, openIssue } from './helpers.js';test('admin can edit an issue field from the issue list', async ({ page }) => {- test.setTimeout(60_000);-const indicatorErrors = [];page.on('console', (message) => {if (message.type() === 'error' && message.text().includes('successIndicatorTimeout')) {diff --git a/e2e-test/tests/filter-users-by-type.spec.js b/e2e-test/tests/filter-users-by-type.spec.jsindex 221273a14d..51bd1f2301 100644--- a/e2e-test/tests/filter-users-by-type.spec.js+++ b/e2e-test/tests/filter-users-by-type.spec.js@@ -2,8 +2,6 @@ import { expect, test } from '@playwright/test';import { createUser, login } from './helpers.js';test('admin can filter users by type', async ({ page }) => {- test.setTimeout(120_000);-const suffix = Date.now();const prefix = `typefilter${suffix}`;const ordinaryName = `${prefix}-ordinary`;diff --git a/e2e-test/tests/helpers.js b/e2e-test/tests/helpers.jsindex 51f79919cd..071e161f26 100644--- a/e2e-test/tests/helpers.js+++ b/e2e-test/tests/helpers.js@@ -101,7 +101,8 @@ export async function createUser(page, options = {}) {await fillLabeledInput(page, 'Email Address', email);}await page.getByRole('button', { name: 'Create' }).click();- await expect(page.locator('#session-feedback')).toContainText('New user created');+ await expect(page).toHaveURL(/\/~users\/\d+\/basic-setting(?:\?|$)/);+ await expect(formGroup(page, 'Login Name').locator('input.form-control')).toHaveValue(userName);return { userName, password, email };}@@ -118,8 +119,8 @@ export async function createProject(page, projectName) {await page.goto('~projects/new');await fillLabeledInput(page, 'Name', name);await page.getByRole('button', { name: 'Create' }).click();- await expect(page.locator('#session-feedback')).toContainText('New project created');await expect(page).toHaveURL(new RegExp(`/${name}(/|$)`));+ await expect(page.locator('.sidebar')).toContainText(name);return name;}@@ -141,7 +142,11 @@ export async function authorizeUser(page, projectName, userName, roleName) {await select2Choose(page, authRow.locator('td').nth(1), userName);await select2Choose(page, authRow.locator('td').nth(2), roleName);await page.getByRole('button', { name: 'Save' }).click();- await expect(page.locator('#session-feedback')).toContainText('User authorizations updated');+ await page.goto(`${projectName}/~settings/user-authorizations`);+ const savedAuthRow = page+ .locator('.user-authorizations .bean-list tbody tr')+ .filter({ hasText: userName });+ await expect(savedAuthRow).toContainText(roleName);}/**@@ -180,7 +185,7 @@ export async function authorizeIssueUser(page, issueUrl, userName) {const authorizationsUrl = issueUrl.replace(/\/?$/, '') + '/authorizations';await page.goto(authorizationsUrl);await select2Choose(page, page.locator('.issue-authorization-list'), userName);- await expect(page.locator('#session-feedback')).toContainText('User authorized');+ await page.goto(authorizationsUrl);await expect(page.locator('.issue-authorization-list .authorizations')).toContainText(userName);}diff --git a/e2e-test/tests/open-issue.spec.js b/e2e-test/tests/open-issue.spec.jsindex 805d261e7c..ba36dee842 100644--- a/e2e-test/tests/open-issue.spec.js+++ b/e2e-test/tests/open-issue.spec.js@@ -2,8 +2,6 @@ import { expect, test } from '@playwright/test';import { createProject, login, openIssue } from './helpers.js';test('admin can open an issue', async ({ page }) => {- test.setTimeout(60_000);-await login(page, 'admin', 'admin');const projectName = await createProject(page);diff --git a/e2e-test/tests/render-mermaid.spec.js b/e2e-test/tests/render-mermaid.spec.jsindex 2b98125488..c0154ebf15 100644--- a/e2e-test/tests/render-mermaid.spec.js+++ b/e2e-test/tests/render-mermaid.spec.js@@ -2,8 +2,6 @@ import { expect, test } from '@playwright/test';import { createProject, login } from './helpers.js';test('renders Mermaid classes with numeric hex colors', async ({ page }) => {- test.setTimeout(60_000);-await login(page, 'admin', 'admin');const projectName = await createProject(page);@@ -20,6 +18,6 @@ test('renders Mermaid classes with numeric hex colors', async ({ page }) => {await page.getByRole('button', { name: 'Save' }).click();const styledNode = page.locator('.mermaid svg .node.oldError');- await expect(styledNode).toBeVisible({ timeout: 15_000 });+ await expect(styledNode).toBeVisible();await expect(styledNode).toContainText('Error Node');});diff --git a/e2e-test/tests/text-diff-expander.spec.js b/e2e-test/tests/text-diff-expander.spec.jsindex 0769c9e88e..96605ed6c6 100644--- a/e2e-test/tests/text-diff-expander.spec.js+++ b/e2e-test/tests/text-diff-expander.spec.js@@ -7,8 +7,6 @@ import { expect, test } from '@playwright/test';import { fillLabeledInput, login } from './helpers.js';test('expands text-diff gaps with directional arrows', async ({ page }) => {- test.setTimeout(120_000);-// 1. Open a commit containing two distant changesawait login(page, 'admin', 'admin');const projectName = `text-diff-expander-${Date.now()}`;