mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-06 14:58:32 +02:00
Stabilize issue-project e2e test, increase timeout factor (#37297)
1. stabilize flaky e2e test from
2f5b5a9e9c
2. increase ci timeout factor to 4 as 3 was not enough
3. add a `e2e` category to files-changed so e2e-test-only changes
trigger ci
---
This PR was written with the help of Claude Opus 4.7
---------
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
This commit is contained in:
parent
284298f2a9
commit
b31eef2828
8
.github/workflows/files-changed.yml
vendored
8
.github/workflows/files-changed.yml
vendored
@ -21,6 +21,8 @@ on:
|
|||||||
value: ${{ jobs.detect.outputs.yaml }}
|
value: ${{ jobs.detect.outputs.yaml }}
|
||||||
json:
|
json:
|
||||||
value: ${{ jobs.detect.outputs.json }}
|
value: ${{ jobs.detect.outputs.json }}
|
||||||
|
e2e:
|
||||||
|
value: ${{ jobs.detect.outputs.e2e }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
detect:
|
detect:
|
||||||
@ -38,6 +40,7 @@ jobs:
|
|||||||
swagger: ${{ steps.changes.outputs.swagger }}
|
swagger: ${{ steps.changes.outputs.swagger }}
|
||||||
yaml: ${{ steps.changes.outputs.yaml }}
|
yaml: ${{ steps.changes.outputs.yaml }}
|
||||||
json: ${{ steps.changes.outputs.json }}
|
json: ${{ steps.changes.outputs.json }}
|
||||||
|
e2e: ${{ steps.changes.outputs.e2e }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dorny/paths-filter@v4
|
- uses: dorny/paths-filter@v4
|
||||||
@ -107,3 +110,8 @@ jobs:
|
|||||||
|
|
||||||
json:
|
json:
|
||||||
- "**/*.json"
|
- "**/*.json"
|
||||||
|
|
||||||
|
e2e:
|
||||||
|
- "tests/e2e/**"
|
||||||
|
- "tools/test-e2e.sh"
|
||||||
|
- "playwright.config.ts"
|
||||||
|
|||||||
2
.github/workflows/pull-e2e-tests.yml
vendored
2
.github/workflows/pull-e2e-tests.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
test-e2e:
|
test-e2e:
|
||||||
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
|
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.e2e == 'true'
|
||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
|
|||||||
@ -151,7 +151,7 @@ Here's how to run the test suite:
|
|||||||
| :-------------------------------- | :---------------------------------------------------------- |
|
| :-------------------------------- | :---------------------------------------------------------- |
|
||||||
| ``GITEA_TEST_E2E_DEBUG`` | When set, show Gitea server output |
|
| ``GITEA_TEST_E2E_DEBUG`` | When set, show Gitea server output |
|
||||||
| ``GITEA_TEST_E2E_FLAGS`` | Additional flags passed to Playwright, for example ``--ui`` |
|
| ``GITEA_TEST_E2E_FLAGS`` | Additional flags passed to Playwright, for example ``--ui`` |
|
||||||
| ``GITEA_TEST_E2E_TIMEOUT_FACTOR`` | Timeout multiplier (default: 3 on CI, 1 locally) |
|
| ``GITEA_TEST_E2E_TIMEOUT_FACTOR`` | Timeout multiplier (default: 4 on CI, 1 locally) |
|
||||||
|
|
||||||
## Translation
|
## Translation
|
||||||
|
|
||||||
|
|||||||
@ -1,67 +1,30 @@
|
|||||||
import {env} from 'node:process';
|
import {env} from 'node:process';
|
||||||
import {test, expect} from '@playwright/test';
|
import {test, expect} from '@playwright/test';
|
||||||
import {login, apiCreateRepo, apiCreateIssue, apiDeleteRepo, createProjectColumn, randomString, timeoutFactor} from './utils.ts';
|
import {login, apiCreateRepo, apiCreateIssue, apiDeleteRepo, createProjectColumn, randomString} from './utils.ts';
|
||||||
|
|
||||||
test('assign issue to project and change column', async ({page}) => {
|
test('assign issue to project and change column', async ({page}) => {
|
||||||
const repoName = `e2e-issue-project-${randomString(8)}`;
|
const repoName = `e2e-issue-project-${randomString(8)}`;
|
||||||
const user = env.GITEA_TEST_E2E_USER;
|
const user = env.GITEA_TEST_E2E_USER;
|
||||||
await Promise.all([login(page), apiCreateRepo(page.request, {name: repoName})]);
|
await Promise.all([login(page), apiCreateRepo(page.request, {name: repoName})]);
|
||||||
|
|
||||||
await page.goto(`/${user}/${repoName}/projects/new`);
|
await page.goto(`/${user}/${repoName}/projects/new`);
|
||||||
await page.locator('input[name="title"]').fill('Kanban Board');
|
await page.locator('input[name="title"]').fill('Kanban Board');
|
||||||
await page.getByRole('button', {name: 'Create Project'}).click();
|
await page.getByRole('button', {name: 'Create Project'}).click();
|
||||||
|
|
||||||
const projectLink = page.locator('.milestone-list a', {hasText: 'Kanban Board'}).first();
|
const projectLink = page.locator('.milestone-list a', {hasText: 'Kanban Board'}).first();
|
||||||
await expect(projectLink).toBeVisible();
|
await expect(projectLink).toBeVisible();
|
||||||
const href = await projectLink.getAttribute('href');
|
const href = await projectLink.getAttribute('href');
|
||||||
const projectID = href!.split('/').pop();
|
const projectID = href!.split('/').pop()!;
|
||||||
|
|
||||||
// columns created via POST because the web UI uses modals that are hard to drive
|
// columns created via POST because the web UI uses modals that are hard to drive
|
||||||
await Promise.all(['Backlog', 'In Progress', 'Done'].map((title) =>
|
await Promise.all([
|
||||||
createProjectColumn(page.request, user, repoName, projectID!, title),
|
...['Backlog', 'In Progress', 'Done'].map((title) => createProjectColumn(page.request, user, repoName, projectID, title)),
|
||||||
));
|
apiCreateIssue(page.request, user, repoName, {title: 'Column picker test'}),
|
||||||
|
]);
|
||||||
await apiCreateIssue(page.request, user, repoName, {title: 'Column picker test'});
|
|
||||||
|
|
||||||
// Same ceiling as tests/e2e/events.test.ts; Playwright defaults are 5000*factor (see playwright.config.ts).
|
|
||||||
const slowTimeout = 15_000 * timeoutFactor;
|
|
||||||
|
|
||||||
await page.goto(`/${user}/${repoName}/issues/1`);
|
await page.goto(`/${user}/${repoName}/issues/1`);
|
||||||
await page.locator('.sidebar-project-combo .ui.dropdown').click();
|
await page.locator('.sidebar-project-combo .ui.dropdown').click();
|
||||||
await Promise.all([
|
await page.locator('.sidebar-project-combo .menu a.item', {hasText: 'Kanban Board'}).click();
|
||||||
page.waitForResponse(
|
|
||||||
(resp) => resp.url().includes('/issues/projects') && resp.status() === 200,
|
|
||||||
{timeout: slowTimeout},
|
|
||||||
),
|
|
||||||
page.locator('.sidebar-project-combo .menu .item', {hasText: 'Kanban Board'}).click(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
const columnCombo = page.locator('.sidebar-project-column-combo');
|
const columnCombo = page.locator('.sidebar-project-column-combo');
|
||||||
await expect(columnCombo).toBeVisible({timeout: slowTimeout});
|
await expect(columnCombo).toBeVisible();
|
||||||
await columnCombo.locator('.ui.dropdown').click();
|
await columnCombo.locator('.ui.dropdown').click();
|
||||||
await columnCombo.locator('.menu').waitFor({state: 'visible', timeout: slowTimeout});
|
await columnCombo.locator('.menu a.item', {hasText: 'In Progress'}).click();
|
||||||
|
await expect(columnCombo.getByTestId('sidebar-project-column-text')).toHaveText('In Progress');
|
||||||
const inProgressItem = columnCombo.locator('a.item', {hasText: 'In Progress'});
|
|
||||||
await expect(inProgressItem).toBeVisible({timeout: slowTimeout});
|
|
||||||
await inProgressItem.scrollIntoViewIfNeeded();
|
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForResponse(
|
|
||||||
(resp) =>
|
|
||||||
resp.request().method() === 'POST' &&
|
|
||||||
resp.url().includes('/issues/projects/column') &&
|
|
||||||
resp.ok(),
|
|
||||||
{timeout: slowTimeout},
|
|
||||||
),
|
|
||||||
inProgressItem.click(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
await expect(columnCombo.getByTestId('sidebar-project-column-text')).toContainText('In Progress', {
|
|
||||||
timeout: slowTimeout,
|
|
||||||
});
|
|
||||||
await expect(page.locator('.timeline-item', {hasText: 'moved this to In Progress'})).toBeVisible({
|
|
||||||
timeout: slowTimeout,
|
|
||||||
});
|
|
||||||
|
|
||||||
await apiDeleteRepo(page.request, user, repoName);
|
await apiDeleteRepo(page.request, user, repoName);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -95,10 +95,11 @@ GITEA_TEST_E2E_EMAIL="$GITEA_TEST_E2E_USER@$GITEA_TEST_E2E_DOMAIN"
|
|||||||
--must-change-password=false \
|
--must-change-password=false \
|
||||||
--admin
|
--admin
|
||||||
|
|
||||||
# timeout multiplier, CI runners are slower
|
# timeout multiplier to make the tests pass on slow CI runners while using
|
||||||
|
# factor 1 on a fast local machine like a MacBook Pro M1+
|
||||||
if [ -z "${GITEA_TEST_E2E_TIMEOUT_FACTOR:-}" ]; then
|
if [ -z "${GITEA_TEST_E2E_TIMEOUT_FACTOR:-}" ]; then
|
||||||
if [ -n "${CI:-}" ]; then
|
if [ -n "${CI:-}" ]; then
|
||||||
GITEA_TEST_E2E_TIMEOUT_FACTOR=3
|
GITEA_TEST_E2E_TIMEOUT_FACTOR=4
|
||||||
else
|
else
|
||||||
GITEA_TEST_E2E_TIMEOUT_FACTOR=1
|
GITEA_TEST_E2E_TIMEOUT_FACTOR=1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user