-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Rework e2e tests #36634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Rework e2e tests #36634
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
f76c0ac
Rework e2e tests
silverwind 625e46d
Pass e2e credentials via environment variables
silverwind 68acbd3
Address review comments
silverwind f604702
Use env vars directly in e2e login helper, remove user parameter
silverwind cbe336f
cleanup
silverwind 3dd69ec
Add playwright/no-raw-locators eslint rule for e2e tests
silverwind af48192
Remove make playwright step from e2e CI workflow
silverwind 7075f3a
Remove redundant "logged in user" e2e test
silverwind aa8b0ad
Remove response status check from e2e homepage test
silverwind 83a448c
Rename e2e env vars to E2E_URL, simplify URL detection
silverwind 734be7e
Fix e2e CI: use ./gitea path for executable, show user creation errors
silverwind bbfa948
Remove EXECUTABLE fallback in test-e2e.sh
silverwind 61b7554
Quote shell variable expansions in test-e2e.sh
silverwind d91a8d8
Move ./ prefix for EXECUTABLE into test-e2e.sh
silverwind cb1c0a9
Use ./ prefix inline instead of rewriting EXECUTABLE
silverwind 03f05ab
Remove leftover EXECUTABLE reassignment in test-e2e.sh
silverwind 4a0366d
Split playwright install back into separate make target
silverwind 30b9a05
Fix flaky logout test by waiting for navigation
silverwind 40446b8
Use semantic click for logout instead of dispatchEvent
silverwind 5354352
Use server-rendered title attribute for dropdown locator
silverwind 20f96f7
Wait for logout response before verifying sign-out
silverwind 4517e8a
Use clearCookies for logout to avoid fomantic JS dependency
silverwind a7af563
Apply suggestion from @silverwind
silverwind 9a70946
add temp server for local development, misc tweaks
silverwind 7648954
allow locators again
silverwind 5439c7e
skip playwright --with-deps on actions
silverwind e5b5bda
skip installing playwright system deps on github actions
silverwind 4af1520
Add register e2e test and disable CAPTCHA for e2e
silverwind 2314ea3
add 6 new e2e tests and tighten timeouts
silverwind 76c0fff
Rename test.gitea.io to e2e.gitea.com in e2e tests
silverwind 6ea6c37
enable color on CI
silverwind e9e676d
Address e2e review feedback
silverwind 08a92e5
add dependency on EXECUTABLE
silverwind 5fcdd85
Apply suggestion from @silverwind
silverwind 1e01037
Pass TAGS to test-e2e to prevent binary rebuild without SQLite
silverwind 6ce62bc
Replace API calls in e2e tests with UI interactions
silverwind 408b259
Reuse login helper in register test
silverwind 799d525
Fix repo creation test by using direct input selector
silverwind 530b86e
Add ambient type declarations for e2e env variables
silverwind aaad640
cleanup
silverwind c63da12
Apply suggestion from @silverwind
silverwind 79b4b2e
Revert e2e org/user deletion to API calls
silverwind 766ba01
Revert e2e repo create/delete to API calls, double timeouts
silverwind f8d0369
Merge branch 'main' into e2eup
silverwind ff729c3
Merge branch 'main' into e2eup
silverwind 6f0497a
Merge remote-tracking branch 'origin/main' into e2eup
silverwind f6037c9
Rework e2e test setup for full isolation
silverwind d132030
Fix markdown table alignment in CONTRIBUTING.md
silverwind 6bc667d
rename test
silverwind a2d1138
Add Firefox to e2e test matrix on CI
silverwind 6b5fa84
Fix CGO_ENABLED for e2e binary build, enable debug on CI
silverwind 564b9f0
silence
silverwind a49aecf
Fix FORCE_COLOR corrupting port number in e2e script
silverwind 50c30c8
Add EXECUTABLE_E2E variable and proper Make target
silverwind 69b5c0b
update docs
silverwind a83dd45
Add separate playwright install step in CI
silverwind 0156730
Reorder CI steps to match original order
silverwind 109ffab
tweak vars
silverwind fa8727f
Merge branch 'main' into e2eup
lunny 6942616
Merge branch 'main' into e2eup
GiteaBot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.