Rework e2e tests#36634
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reworks the end-to-end (e2e) testing approach by removing the Go-based test harness and switching to a simpler Playwright-driven setup invoked via a Bash script, along with corresponding config/CI updates.
Changes:
- Added
tools/test-e2e.shto locate the target Gitea URL, verify reachability, and ensure ane2euser exists before running Playwright. - Simplified Playwright configuration and replaced the previous
*.test.e2e.tsstructure/harness with new*.test.tstests and helpers. - Added a dedicated GitHub Actions workflow to run e2e tests on pull requests.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/test-e2e.sh | New Bash runner for Playwright e2e tests (URL detection, reachability, user creation). |
| tests/e2e/utils_e2e_test.go | Removed Go helper that started/managed the in-process test server. |
| tests/e2e/utils_e2e.ts | Removed prior Playwright utilities (login/session state/visual helpers). |
| tests/e2e/utils.ts | New simplified Playwright helper utilities (login/logout/context creation). |
| tests/e2e/login.test.ts | New basic e2e tests for homepage and login/logout flows. |
| tests/e2e/example.test.e2e.ts | Removed old example e2e test file using the previous harness/utilities. |
| tests/e2e/e2e_test.go | Removed Go TestMain + TS test discovery/runner harness. |
| tests/e2e/README.md | Removed previous e2e documentation. |
| playwright.config.ts | Simplified Playwright config (single chromium project, new matching pattern, new timeouts). |
| eslint.config.ts | Narrowed Playwright ESLint rules application to tests/e2e/*.test.ts. |
| Makefile | Removed Go e2e targets; added test-e2e invoking the new script; adjusted Playwright install. |
| CONTRIBUTING.md | Updated e2e test command documentation to make test-e2e. |
| .gitignore | Removed ignored e2e artifact directories from the previous system. |
| .github/workflows/pull-e2e-tests.yml | New CI workflow to run Playwright e2e tests on PRs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
tests/e2e/login.test.ts:16
- This test creates a new browser context manually instead of using the provided
pagefixture like the other tests. While Playwright will clean up the context automatically when the test completes, this pattern is inconsistent with the other tests and adds unnecessary complexity. Consider using thepagefixture directly (like in the "login and logout" test) unless there's a specific reason to isolate this test in a separate context.
await login(page);
await logout(page);
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
e2e tests pass now on CI, the logout code is a bit unclean because of complications related to fomantic dropdown. |
|
I will keep it as-is for now. I will follow up with a migration off of fomantic dropdown later (likely using native details-summary based dropdowns that work without JS and which work well in playwright) to fully resolve the issue. |
|
Could you clarify why the previous e2e tests were removed and why they should be back in this PR? |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Locally only Chromium runs for fast feedback. On CI, tests also run on Firefox for broader coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I've re-added Firefox, only on CI right now, we will see if #21355 still applies. Not totally sure it's worth the potential trouble to test multiple browsers. |
The test-e2e target uses TEST_TAGS (not TAGS) so the Makefile's automatic CGO_ENABLED=1 detection for sqlite didn't trigger. Set CGO_ENABLED=1 explicitly in the build command. Also enable GITEA_TEST_E2E_DEBUG on CI to see server output on failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
FORCE_COLOR=1 on CI caused console.log to wrap the port number in ANSI color codes, breaking ROOT_URL parsing. Use process.stdout.write which bypasses color formatting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add EXECUTABLE_E2E variable alongside EXECUTABLE for the e2e binary - Make the e2e binary target non-phony, tracking $(GO_SOURCES) to avoid unnecessary rebuilds - Add separate make gitea-e2e step in CI for visibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The binary build is split into separate make target and triggered on CI separatately so that the |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move playwright install after backend build so all dependency/build steps run first, then browser install, then test execution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This is ready, |
* giteaofficial/main: (81 commits) Add keyboard shortcuts for repository file and code search (go-gitea#36416) Refactor text utility classes to Tailwind CSS (go-gitea#36703) Prevent redirect bypasses via backslash-encoded paths (go-gitea#36660) Fix force push time-line commit comments of pull request (go-gitea#36653) Fix get release draft permission check (go-gitea#36659) Move `X_FRAME_OPTIONS` setting from `cors` to `security` section (go-gitea#30256) Update JS and PY deps (go-gitea#36708) Move jobparser from act repository to Gitea (go-gitea#36699) Fix push time bug (go-gitea#36693) Add icon to buttons "Close with Comment", "Close Pull Request", "Close Issue" (go-gitea#36654) various fixes (go-gitea#36697) Add AI Contribution Policy to CONTRIBUTING.md (go-gitea#36651) Add some validation on values provided to USER_DISABLED_FEATURES and EXTERNAL_USER_DISABLED_FEATURES (go-gitea#36688) Rework e2e tests (go-gitea#36634) Remove unused functions (go-gitea#36672) Add migration http transport for push/sync mirror lfs (go-gitea#36665) Fix track time issue id (go-gitea#36664) Refactor inline style attributes (go-gitea#36652) Update Nix flake (go-gitea#36679) Upgrade gogit to 5.16.5 (go-gitea#36680) ... # Conflicts: # web_src/js/features/repo-issue-content.ts

make test-e2eis the single entry point. It always starts a fully isolated ephemeral Gitea instance with its own temp directory, SQLite database, and config — no interference with the developer's running instance.gitea-e2ebinary is built viaEXECUTABLE_E2EusingTEST_TAGS(auto-includes sqlite withCGO_ENABLED=1), keeping the developer's regulargiteabinary untouched.GITEA_TEST_E2E_*prefix.GITEA_TEST_E2E_FLAGSto pass flags to playwright, e.g.GITEA_TEST_E2E_FLAGS="--ui" make test-e2efor UI mode orGITEA_TEST_E2E_FLAGS="--headed" make test-e2efor headed mode.GITEA_TEST_E2E_DEBUG=1 make test-e2eto show Gitea server output.