0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-02-22 13:15:23 +01:00

20388 Commits

Author SHA1 Message Date
silverwind
a2d1138d5c
Add Firefox to e2e test matrix on CI
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>
2026-02-20 04:16:37 +01:00
silverwind
6bc667d7d3
rename test 2026-02-20 04:11:30 +01:00
silverwind
d132030206
Fix markdown table alignment in CONTRIBUTING.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 04:06:23 +01:00
silverwind
f6037c90d3
Rework e2e test setup for full isolation
Always start an isolated ephemeral Gitea instance with its own temp
directory, SQLite database, and config file. This addresses review
feedback that using the developer's existing instance is unreliable.

- Rewrite test-e2e.sh to create a temp workdir, find a free port,
  write a minimal app.ini, start the server, and clean up on exit
- Build a separate gitea-e2e binary using TEST_TAGS (includes sqlite)
- Simplify CI workflow: remove manual app.ini, server start, and
  redundant build steps
- Rename all env vars to use GITEA_TEST_E2E_* prefix
- Rename test user from "e2e" to "e2e-user"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 03:59:33 +01:00
silverwind
6f0497a894
Merge remote-tracking branch 'origin/main' into e2eup
* origin/main:
  Clean up Makefile, tests and legacy code (#36638)

# Conflicts:
#	Makefile
#	tests/e2e/e2e_test.go
2026-02-20 03:44:32 +01:00
silverwind
5e9b9b33d1
Clean up Makefile, tests and legacy code (#36638)
This simplifies the Makefile by removing the whole-file wrapping that
creates a tempdir introduced by
https://github.com/go-gitea/gitea/pull/11126. REPO_TEST_DIR is removed
as well.

Also clean up a lot of legacy code: unnecessary XSS test, incorrect test
env init, unused "_old_uid" hack, etc

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-02-19 01:23:32 +00:00
silverwind
ff729c3435
Merge branch 'main' into e2eup 2026-02-19 02:04:04 +01:00
silverwind
147bdfce0d
Add actions.WORKFLOW_DIRS setting (#36619)
Fixes: https://github.com/go-gitea/gitea/issues/36612

This new setting controls which workflow directories are searched. The
default value matches the previous hardcoded behaviour.

This allows users for example to exclude `.github/workflows` from being
picked up by Actions in mirrored repositories by setting `WORKFLOW_DIRS
= .gitea/workflows`.

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 01:31:01 +01:00
silverwind
f8d03693e1
Merge branch 'main' into e2eup 2026-02-18 07:41:43 +01:00
silverwind
b9d323c3d8
Replace google/go-licenses with custom generation (#36575)
Rewrite `build/generate-go-licenses.go` to use `go list -m -json all`
and read license files directly from the Go module cache instead of
relying on the buggy `google/go-licenses` tool.

This removes the need for CGO, GOOS=linux, and the intermediate temp
directory, while being like 100 times faster than before:

```
$ rm assets/go-licenses.json && time make assets/go-licenses.json
go run build/generate-go-licenses.go assets/go-licenses.json
make assets/go-licenses.json  0.21s user 0.22s system 173% cpu 0.247 total

---------

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 04:13:26 +00:00
silverwind
2cb8f6a9a5
Remove redundant linter rules (#36658)
Clean up linter configs, removing redundant rules or dead disables. One
new rule enabled, no violations. Many revive rules had same or better
rules in staticcheck or govet.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2026-02-18 03:38:18 +00:00
silverwind
766ba0184a
Revert e2e repo create/delete to API calls, double timeouts
Revert createRepo/deleteRepo to API-based functions for test
reliability. The UI-based versions were flaky due to navigation
timing. Also double all playwright timeouts (local and CI), rename
API functions to apiX convention, and disable playwright/expect-expect
lint rule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:21:28 +01:00
silverwind
79b4b2e0d4
Revert e2e org/user deletion to API calls
The UI-based deleteOrg and deleteUser functions fail due to
form-fetch-action issues. Revert these to API calls while keeping
the working UI-based createRepo/deleteRepo functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:16 +01:00
silverwind
c63da125bb
Apply suggestion from @silverwind
Signed-off-by: silverwind <me@silverwind.io>
2026-02-18 03:03:16 +01:00
silverwind
aaad640397
cleanup 2026-02-18 03:03:16 +01:00
silverwind
530b86e244
Add ambient type declarations for e2e env variables
Declare E2E_USER, E2E_PASSWORD and E2E_URL as string in ProcessEnv so
non-null assertions are no longer needed throughout the e2e tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:16 +01:00
silverwind
799d525f64
Fix repo creation test by using direct input selector
Use locator('input[name="repo_name"]') instead of getByLabel which
can fail when Fomantic UI interferes with label-input association.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:16 +01:00
silverwind
408b2596ab
Reuse login helper in register test
Accept optional username/password in the login utility so the register
test can use it for the newly-created account instead of duplicating
the sign-in steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:16 +01:00
silverwind
6ce62bc545
Replace API calls in e2e tests with UI interactions
Use browser-based user actions for test setup and cleanup instead of
direct API/fetch calls, making tests exercise the same code paths as
real users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:16 +01:00
silverwind
1e010377f8
Pass TAGS to test-e2e to prevent binary rebuild without SQLite
The `make test-e2e` target depends on $(EXECUTABLE), and the Makefile
detects tag changes via TAGS_PREREQ. Without passing TAGS, the binary
gets rebuilt without SQLite support, causing the e2e user creation to
fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:16 +01:00
silverwind
5fcdd8589f
Apply suggestion from @silverwind
Signed-off-by: silverwind <me@silverwind.io>
2026-02-18 03:03:16 +01:00
silverwind
08a92e5859
add dependency on EXECUTABLE 2026-02-18 03:03:16 +01:00
silverwind
e9e676d553
Address e2e review feedback
- Add ENABLE_CAPTCHA=false to CI app.ini so the server starts with
  CAPTCHA disabled instead of relying on env var in test script
- Retry on 502/503 in addition to 500 in apiRetry helper
- Fix typo: workarkound → workaround
- Add comment about section-unaware INI parsing in test-e2e.sh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
6ea6c37762
enable color on CI 2026-02-18 03:03:15 +01:00
silverwind
76c0fff889
Rename test.gitea.io to e2e.gitea.com in e2e tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
2314ea3194
add 6 new e2e tests and tighten timeouts 2026-02-18 03:03:15 +01:00
silverwind
4af15206cd
Add register e2e test and disable CAPTCHA for e2e
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
e5b5bdafa3
skip installing playwright system deps on github actions 2026-02-18 03:03:15 +01:00
silverwind
5439c7ea2f
skip playwright --with-deps on actions 2026-02-18 03:03:15 +01:00
silverwind
764895407a
allow locators again 2026-02-18 03:03:15 +01:00
silverwind
9a70946124
add temp server for local development, misc tweaks 2026-02-18 03:03:15 +01:00
silverwind
a7af563050
Apply suggestion from @silverwind
Signed-off-by: silverwind <me@silverwind.io>
2026-02-18 03:03:15 +01:00
silverwind
4517e8a5dc
Use clearCookies for logout to avoid fomantic JS dependency
The fomantic dropdown JS does not reliably initialize on CI headless
Chromium, making dropdown-based Sign Out impossible. Use clearCookies
to destroy the session and verify logout state instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
20f96f7c1b
Wait for logout response before verifying sign-out
The link-action handler does an async fetch POST then a form-based
redirect chain which can be slow on CI. Wait for the /user/logout
response to confirm session destruction, then navigate to verify.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
5354352bee
Use server-rendered title attribute for dropdown locator
Replace JS-dependent getByLabel (aria-label set by Fomantic init) with
getByTitle targeting the avatar's server-rendered title attribute, scoped
to the navigation bar. Extract reusable clickDropdownItem helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
40446b8795
Use semantic click for logout instead of dispatchEvent
The dropdown already gets aria-label from data-tooltip-content via
the ARIA dropdown patch, so we can open it with getByLabel and then
click Sign Out normally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
30b9a05082
Fix flaky logout test by waiting for navigation
The dispatchEvent('click') on Sign Out triggers a navigation. Wait
for it to complete before checking for the Sign In link.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
4a0366d696
Split playwright install back into separate make target
Restore make playwright as a separate target so CI can run it as its
own step before test-e2e.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
03f05abb67
Remove leftover EXECUTABLE reassignment in test-e2e.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
cb1c0a9521
Use ./ prefix inline instead of rewriting EXECUTABLE
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
d91a8d886b
Move ./ prefix for EXECUTABLE into test-e2e.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
61b75540a5
Quote shell variable expansions in test-e2e.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
bbfa948f51
Remove EXECUTABLE fallback in test-e2e.sh
The Makefile always passes EXECUTABLE, so the fallback is unnecessary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
734be7e3b5
Fix e2e CI: use ./gitea path for executable, show user creation errors
The EXECUTABLE was passed as 'gitea' without ./ prefix, which fails
in CI where the current directory is not in PATH. Also remove
2>/dev/null from user creation to surface errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
83a448c498
Rename e2e env vars to E2E_URL, simplify URL detection
Rename GITEA_TEST_SERVER_URL and GITEA_URL to E2E_URL for consistency
with E2E_USER and E2E_PASSWORD. Simplify the if/else in test-e2e.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
aa8b0ad87e
Remove response status check from e2e homepage test
Playwright already fails on non-OK responses by default.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
7075f3ad4a
Remove redundant "logged in user" e2e test
The login and logout test already covers this functionality.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
af481926f4
Remove make playwright step from e2e CI workflow
The playwright target was inlined into test-e2e, so the separate
step is no longer needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
3dd69ecfc0
Add playwright/no-raw-locators eslint rule for e2e tests
Forbid page.locator() in favor of semantic locators like getByRole,
getByLabel, getByText.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 03:03:15 +01:00
silverwind
cbe336f466
cleanup 2026-02-18 03:03:15 +01:00