Skip to content

Rework e2e tests#36634

Merged
lunny merged 60 commits into
go-gitea:mainfrom
silverwind:e2eup
Feb 21, 2026
Merged

Rework e2e tests#36634
lunny merged 60 commits into
go-gitea:mainfrom
silverwind:e2eup

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Feb 15, 2026

  • Replace the e2e tests initialization with a simple bash script, removing the previous Go harness.
  • make test-e2e is 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.
  • A separate gitea-e2e binary is built via EXECUTABLE_E2E using TEST_TAGS (auto-includes sqlite with CGO_ENABLED=1), keeping the developer's regular gitea binary untouched.
  • No more split into database-specific e2e tests. Test timeouts are strict, can be relaxed later if needed.
  • Simplified and streamlined the playwright config and test files.
  • Remove all output generation of playwright and all references to visual testing.
  • Tests run on Chrome locally, Chrome + Firefox on CI.
  • Simplified CI workflow — visible separate steps for frontend, backend, and test execution.
  • All exported env vars use GITEA_TEST_E2E_* prefix.
  • Use GITEA_TEST_E2E_FLAGS to pass flags to playwright, e.g. GITEA_TEST_E2E_FLAGS="--ui" make test-e2e for UI mode or GITEA_TEST_E2E_FLAGS="--headed" make test-e2e for headed mode.
  • Use GITEA_TEST_E2E_DEBUG=1 make test-e2e to show Gitea server output.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh to locate the target Gitea URL, verify reachability, and ensure an e2e user exists before running Playwright.
  • Simplified Playwright configuration and replaced the previous *.test.e2e.ts structure/harness with new *.test.ts tests 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.

Comment thread tools/test-e2e.sh
Comment thread tools/test-e2e.sh Outdated
Comment thread tools/test-e2e.sh Outdated
Comment thread tests/e2e/utils.ts Outdated
Comment thread .github/workflows/pull-e2e-tests.yml
Comment thread CONTRIBUTING.md
Comment thread tests/e2e/utils.ts Outdated
Comment thread tests/e2e/login.test.ts Outdated
Comment thread Makefile Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 page fixture 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 the page fixture 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.

Comment thread .github/workflows/pull-e2e-tests.yml Outdated
@silverwind silverwind marked this pull request as draft February 15, 2026 11:20
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Feb 15, 2026

e2e tests pass now on CI, the logout code is a bit unclean because of complications related to fomantic dropdown.

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Feb 15, 2026

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.

@silverwind silverwind marked this pull request as ready for review February 15, 2026 12:35
Comment thread tests/e2e/utils.ts Outdated
@lunny
Copy link
Copy Markdown
Member

lunny commented Feb 15, 2026

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>
@silverwind
Copy link
Copy Markdown
Member Author

Everything addressed, e2e tests run in complete isolation now.

Playwright UI mode also working via:

GITEA_TEST_E2E_FLAGS="--ui" make test-e2e
image

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged labels Feb 20, 2026
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>
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Feb 20, 2026

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.

silverwind and others added 4 commits February 20, 2026 04:24
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>
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Feb 20, 2026

The binary build is split into separate make target and triggered on CI separatately so that the make test-e2e output is clean and contains no build log spam.

silverwind and others added 3 commits February 20, 2026 04:53
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>
@silverwind
Copy link
Copy Markdown
Member Author

This is ready, test-e2e output is now clean on CI. Failure is unrelated and needs #36680.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 20, 2026
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 20, 2026
@lunny lunny merged commit 18e0746 into go-gitea:main Feb 21, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Feb 21, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 21, 2026
@wxiaoguang wxiaoguang deleted the e2eup branch February 21, 2026 02:25
zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 23, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/code-linting type/testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants