Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
f76c0ac
Rework e2e tests
silverwind Feb 15, 2026
625e46d
Pass e2e credentials via environment variables
silverwind Feb 15, 2026
68acbd3
Address review comments
silverwind Feb 15, 2026
f604702
Use env vars directly in e2e login helper, remove user parameter
silverwind Feb 15, 2026
cbe336f
cleanup
silverwind Feb 15, 2026
3dd69ec
Add playwright/no-raw-locators eslint rule for e2e tests
silverwind Feb 15, 2026
af48192
Remove make playwright step from e2e CI workflow
silverwind Feb 15, 2026
7075f3a
Remove redundant "logged in user" e2e test
silverwind Feb 15, 2026
aa8b0ad
Remove response status check from e2e homepage test
silverwind Feb 15, 2026
83a448c
Rename e2e env vars to E2E_URL, simplify URL detection
silverwind Feb 15, 2026
734be7e
Fix e2e CI: use ./gitea path for executable, show user creation errors
silverwind Feb 15, 2026
bbfa948
Remove EXECUTABLE fallback in test-e2e.sh
silverwind Feb 15, 2026
61b7554
Quote shell variable expansions in test-e2e.sh
silverwind Feb 15, 2026
d91a8d8
Move ./ prefix for EXECUTABLE into test-e2e.sh
silverwind Feb 15, 2026
cb1c0a9
Use ./ prefix inline instead of rewriting EXECUTABLE
silverwind Feb 15, 2026
03f05ab
Remove leftover EXECUTABLE reassignment in test-e2e.sh
silverwind Feb 15, 2026
4a0366d
Split playwright install back into separate make target
silverwind Feb 15, 2026
30b9a05
Fix flaky logout test by waiting for navigation
silverwind Feb 15, 2026
40446b8
Use semantic click for logout instead of dispatchEvent
silverwind Feb 15, 2026
5354352
Use server-rendered title attribute for dropdown locator
silverwind Feb 15, 2026
20f96f7
Wait for logout response before verifying sign-out
silverwind Feb 15, 2026
4517e8a
Use clearCookies for logout to avoid fomantic JS dependency
silverwind Feb 15, 2026
a7af563
Apply suggestion from @silverwind
silverwind Feb 15, 2026
9a70946
add temp server for local development, misc tweaks
silverwind Feb 15, 2026
7648954
allow locators again
silverwind Feb 15, 2026
5439c7e
skip playwright --with-deps on actions
silverwind Feb 15, 2026
e5b5bda
skip installing playwright system deps on github actions
silverwind Feb 15, 2026
4af1520
Add register e2e test and disable CAPTCHA for e2e
silverwind Feb 15, 2026
2314ea3
add 6 new e2e tests and tighten timeouts
silverwind Feb 15, 2026
76c0fff
Rename test.gitea.io to e2e.gitea.com in e2e tests
silverwind Feb 15, 2026
6ea6c37
enable color on CI
silverwind Feb 16, 2026
e9e676d
Address e2e review feedback
silverwind Feb 16, 2026
08a92e5
add dependency on EXECUTABLE
silverwind Feb 16, 2026
5fcdd85
Apply suggestion from @silverwind
silverwind Feb 16, 2026
1e01037
Pass TAGS to test-e2e to prevent binary rebuild without SQLite
silverwind Feb 16, 2026
6ce62bc
Replace API calls in e2e tests with UI interactions
silverwind Feb 17, 2026
408b259
Reuse login helper in register test
silverwind Feb 17, 2026
799d525
Fix repo creation test by using direct input selector
silverwind Feb 17, 2026
530b86e
Add ambient type declarations for e2e env variables
silverwind Feb 17, 2026
aaad640
cleanup
silverwind Feb 17, 2026
c63da12
Apply suggestion from @silverwind
silverwind Feb 17, 2026
79b4b2e
Revert e2e org/user deletion to API calls
silverwind Feb 18, 2026
766ba01
Revert e2e repo create/delete to API calls, double timeouts
silverwind Feb 18, 2026
f8d0369
Merge branch 'main' into e2eup
silverwind Feb 18, 2026
ff729c3
Merge branch 'main' into e2eup
silverwind Feb 19, 2026
6f0497a
Merge remote-tracking branch 'origin/main' into e2eup
silverwind Feb 20, 2026
f6037c9
Rework e2e test setup for full isolation
silverwind Feb 20, 2026
d132030
Fix markdown table alignment in CONTRIBUTING.md
silverwind Feb 20, 2026
6bc667d
rename test
silverwind Feb 20, 2026
a2d1138
Add Firefox to e2e test matrix on CI
silverwind Feb 20, 2026
6b5fa84
Fix CGO_ENABLED for e2e binary build, enable debug on CI
silverwind Feb 20, 2026
564b9f0
silence
silverwind Feb 20, 2026
a49aecf
Fix FORCE_COLOR corrupting port number in e2e script
silverwind Feb 20, 2026
50c30c8
Add EXECUTABLE_E2E variable and proper Make target
silverwind Feb 20, 2026
69b5c0b
update docs
silverwind Feb 20, 2026
a83dd45
Add separate playwright install step in CI
silverwind Feb 20, 2026
0156730
Reorder CI steps to match original order
silverwind Feb 20, 2026
109ffab
tweak vars
silverwind Feb 20, 2026
fa8727f
Merge branch 'main' into e2eup
lunny Feb 20, 2026
6942616
Merge branch 'main' into e2eup
GiteaBot Feb 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/pull-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: e2e-tests

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
files-changed:
uses: ./.github/workflows/files-changed.yml
permissions:
contents: read

test-e2e:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
needs: files-changed
runs-on: ubuntu-latest
permissions:
contents: read
Comment thread
silverwind marked this conversation as resolved.
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
check-latest: true
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- run: make deps-frontend
- run: make frontend
- run: make deps-backend
- run: make gitea-e2e
- run: make playwright
- run: make test-e2e
timeout-minutes: 10
env:
FORCE_COLOR: 1
GITEA_TEST_E2E_DEBUG: 1
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ cpu.out
*.log.*.gz

/gitea
/gitea-e2e
/gitea-vet
/debug
/integrations.test
Expand All @@ -67,13 +68,9 @@ cpu.out
/indexers
/log
/public/assets/img/avatar
/tests/e2e-output
/tests/integration/gitea-integration-*
/tests/integration/indexers-*
/tests/e2e/gitea-e2e-*
/tests/e2e/indexers-*
/tests/e2e/reports
/tests/e2e/test-artifacts
/tests/e2e/test-snapshots
/tests/*.ini
/tests/**/*.git/**/*.sample
/node_modules
Expand Down
9 changes: 8 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,14 @@ Here's how to run the test suite:
| :------------------------------------------ | :------------------------------------------------------- | ------------------------------------------- |
|``make test[\#SpecificTestName]`` | run unit test(s) | |
|``make test-sqlite[\#SpecificTestName]`` | run [integration](tests/integration) test(s) for SQLite | [More details](tests/integration/README.md) |
|``make test-e2e-sqlite[\#SpecificTestName]`` | run [end-to-end](tests/e2e) test(s) for SQLite | [More details](tests/e2e/README.md) |
|``make test-e2e`` | run [end-to-end](tests/e2e) test(s) using Playwright | |

- E2E test environment variables

| Variable | Description |
| :------------------------ | :---------------------------------------------------------------- |
| ``GITEA_TEST_E2E_DEBUG`` | When set, show Gitea server output |
| ``GITEA_TEST_E2E_FLAGS`` | Additional flags passed to Playwright, for example ``--ui`` |

## Translation

Expand Down
71 changes: 12 additions & 59 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ endif
ifeq ($(IS_WINDOWS),yes)
GOFLAGS := -v -buildmode=exe
EXECUTABLE ?= gitea.exe
EXECUTABLE_E2E ?= gitea-e2e.exe
else
GOFLAGS := -v
EXECUTABLE ?= gitea
EXECUTABLE_E2E ?= gitea-e2e
endif

ifeq ($(shell sed --version 2>/dev/null | grep -q GNU && echo gnu),gnu)
Expand Down Expand Up @@ -115,7 +117,7 @@ LDFLAGS := $(LDFLAGS) -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"

LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/riscv64

GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e,$(shell $(GO) list ./... | grep -v /vendor/))
GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration,$(shell $(GO) list ./... | grep -v /vendor/))
MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list code.gitea.io/gitea/models/migrations/...)

WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
Expand Down Expand Up @@ -153,10 +155,6 @@ GO_SOURCES := $(wildcard *.go)
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go")
GO_SOURCES += $(GENERATED_GO_DEST)

# Force installation of playwright dependencies by setting this flag
ifdef DEPS_PLAYWRIGHT
PLAYWRIGHT_FLAGS += --with-deps
endif

SWAGGER_SPEC := templates/swagger/v1_json.tmpl
SWAGGER_SPEC_INPUT := templates/swagger/v1_input.json
Expand Down Expand Up @@ -187,7 +185,7 @@ all: build
.PHONY: help
help: Makefile ## print Makefile help information.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m[TARGETS] default target: build\033[0m\n\n\033[35mTargets:\033[0m\n"} /^[0-9A-Za-z._-]+:.*?##/ { printf " \033[36m%-45s\033[0m %s\n", $$1, $$2 }' Makefile #$(MAKEFILE_LIST)
@printf " \033[36m%-46s\033[0m %s\n" "test-e2e[#TestSpecificName]" "test end to end using playwright"
@printf " \033[36m%-46s\033[0m %s\n" "test-e2e" "test end to end using playwright"
@printf " \033[36m%-46s\033[0m %s\n" "test[#TestSpecificName]" "run unit test"
@printf " \033[36m%-46s\033[0m %s\n" "test-sqlite[#TestSpecificName]" "run integration test for sqlite"

Expand All @@ -204,9 +202,8 @@ clean-all: clean ## delete backend, frontend and integration files

.PHONY: clean
clean: ## delete backend and integration files
rm -rf $(EXECUTABLE) $(DIST) $(BINDATA_DEST_WILDCARD) \
rm -rf $(EXECUTABLE) $(EXECUTABLE_E2E) $(DIST) $(BINDATA_DEST_WILDCARD) \
integrations*.test \
e2e*.test \
tests/integration/gitea-integration-* \
tests/integration/indexers-* \
tests/sqlite.ini tests/mysql.ini tests/pgsql.ini tests/mssql.ini man/ \
Expand Down Expand Up @@ -535,47 +532,12 @@ test-mssql-migration: migrations.mssql.test migrations.individual.mssql.test

.PHONY: playwright
playwright: deps-frontend
$(NODE_VARS) pnpm exec playwright install $(PLAYWRIGHT_FLAGS)

.PHONY: test-e2e%
test-e2e%: TEST_TYPE ?= e2e
# Clear display env variable. Otherwise, chromium tests can fail.
DISPLAY=
@# on GitHub Actions VMs, playwright's system deps are pre-installed
@$(NODE_VARS) pnpm exec playwright install $(if $(GITHUB_ACTIONS),,--with-deps) chromium $(if $(CI),firefox) $(PLAYWRIGHT_FLAGS)

.PHONY: test-e2e
test-e2e: test-e2e-sqlite

.PHONY: test-e2e-sqlite
test-e2e-sqlite: playwright e2e.sqlite.test generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini ./e2e.sqlite.test

.PHONY: test-e2e-sqlite\#%
test-e2e-sqlite\#%: playwright e2e.sqlite.test generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini ./e2e.sqlite.test -test.run TestE2e/$*

.PHONY: test-e2e-mysql
test-e2e-mysql: playwright e2e.mysql.test generate-ini-mysql
GITEA_TEST_CONF=tests/mysql.ini ./e2e.mysql.test

.PHONY: test-e2e-mysql\#%
test-e2e-mysql\#%: playwright e2e.mysql.test generate-ini-mysql
GITEA_TEST_CONF=tests/mysql.ini ./e2e.mysql.test -test.run TestE2e/$*

.PHONY: test-e2e-pgsql
test-e2e-pgsql: playwright e2e.pgsql.test generate-ini-pgsql
GITEA_TEST_CONF=tests/pgsql.ini ./e2e.pgsql.test

.PHONY: test-e2e-pgsql\#%
test-e2e-pgsql\#%: playwright e2e.pgsql.test generate-ini-pgsql
GITEA_TEST_CONF=tests/pgsql.ini ./e2e.pgsql.test -test.run TestE2e/$*

.PHONY: test-e2e-mssql
test-e2e-mssql: playwright e2e.mssql.test generate-ini-mssql
GITEA_TEST_CONF=tests/mssql.ini ./e2e.mssql.test

.PHONY: test-e2e-mssql\#%
test-e2e-mssql\#%: playwright e2e.mssql.test generate-ini-mssql
GITEA_TEST_CONF=tests/mssql.ini ./e2e.mssql.test -test.run TestE2e/$*
test-e2e: playwright $(EXECUTABLE_E2E)
@EXECUTABLE=$(EXECUTABLE_E2E) ./tools/test-e2e.sh $(GITEA_TEST_E2E_FLAGS)

.PHONY: bench-sqlite
bench-sqlite: integrations.sqlite.test generate-ini-sqlite
Expand Down Expand Up @@ -671,18 +633,6 @@ migrations.individual.sqlite.test: $(GO_SOURCES) generate-ini-sqlite
migrations.individual.sqlite.test\#%: $(GO_SOURCES) generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*

e2e.mysql.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.mysql.test

e2e.pgsql.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.pgsql.test

e2e.mssql.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.mssql.test

e2e.sqlite.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.sqlite.test -tags '$(TEST_TAGS)'

.PHONY: check
check: test

Expand Down Expand Up @@ -721,6 +671,9 @@ ifneq ($(and $(STATIC),$(findstring pam,$(TAGS))),)
endif
CGO_ENABLED="$(CGO_ENABLED)" CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(EXTLDFLAGS) $(LDFLAGS)' -o $@

$(EXECUTABLE_E2E): $(GO_SOURCES)
CGO_ENABLED=1 $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TEST_TAGS)' -ldflags '-s -w $(EXTLDFLAGS) $(LDFLAGS)' -o $@

.PHONY: release
release: frontend generate release-windows release-linux release-darwin release-freebsd release-copy release-compress vendor release-sources release-check

Expand Down
3 changes: 2 additions & 1 deletion eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,10 @@ export default defineConfig([
},
{
...playwright.configs['flat/recommended'],
files: ['tests/e2e/**'],
files: ['tests/e2e/**/*.test.ts'],
rules: {
...playwright.configs['flat/recommended'].rules,
'playwright/expect-expect': [0],
},
},
{
Expand Down
97 changes: 17 additions & 80 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,98 +1,35 @@
import {devices} from '@playwright/test';
import {env} from 'node:process';
import type {PlaywrightTestConfig} from '@playwright/test';
import {defineConfig, devices} from '@playwright/test';

const BASE_URL = env.GITEA_TEST_SERVER_URL?.replace?.(/\/$/g, '') || 'http://localhost:3000';

export default {
export default defineConfig({
testDir: './tests/e2e/',
testMatch: /.*\.test\.e2e\.ts/, // Match any .test.e2e.ts files

/* Maximum time one test can run for. */
timeout: 30 * 1000,

outputDir: './tests/e2e-output/',
testMatch: /.*\.test\.ts/,
forbidOnly: Boolean(env.CI),
reporter: 'list',
timeout: env.CI ? 12000 : 6000,
expect: {

/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 2000,
timeout: env.CI ? 6000 : 3000,
},

/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: Boolean(env.CI),

/* Retry on CI only */
retries: env.CI ? 2 : 0,

/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: env.CI ? 'list' : [['list'], ['html', {outputFolder: 'tests/e2e/reports/', open: 'never'}]],

/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
headless: true, // set to false to debug

baseURL: env.GITEA_TEST_E2E_URL?.replace?.(/\/$/g, ''),
locale: 'en-US',

/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 1000,

/* Maximum time allowed for navigation, such as `page.goto()`. */
navigationTimeout: 5 * 1000,

/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: BASE_URL,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',

screenshot: 'only-on-failure',
actionTimeout: env.CI ? 6000 : 3000,
navigationTimeout: env.CI ? 12000 : 6000,
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',

/* Project-specific settings. */
use: {
...devices['Desktop Chrome'],
permissions: ['clipboard-read', 'clipboard-write'],
},
},

// disabled because of https://github.com/go-gitea/gitea/issues/21355
// {
// name: 'firefox',
// use: {
// ...devices['Desktop Firefox'],
// },
// },

{
name: 'webkit',
use: {
...devices['Desktop Safari'],
},
},

/* Test against mobile viewports. */
{
name: 'Mobile Chrome',
use: {
...devices['Pixel 5'],
},
},
{
name: 'Mobile Safari',
...env.CI ? [{
name: 'firefox',
use: {
...devices['iPhone 12'],
...devices['Desktop Firefox'],
},
},
}] : [],
],

/* Folder for test artifacts such as screenshots, videos, traces, etc. */
outputDir: 'tests/e2e/test-artifacts/',
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
snapshotDir: 'tests/e2e/test-snapshots/',
} satisfies PlaywrightTestConfig;
});
Loading