Skip to content

Commit c8ded77

Browse files
authored
Kd/ci playwright go test (#20123)
* Add initial playwright config * Simplify Makefile * Simplify Makefile * Use correct config files * Update playwright settings * Fix package-lock file * Don't use test logger for e2e tests * fix frontend lint * Allow passing TEST_LOGGER variable * Init postgres database * use standard gitea env variables * Update playwright * update drone * Move empty env var to commands * Cleanup * Move integrations to subfolder * tests integrations to tests integraton * Run e2e tests with go test * Fix linting * install CI deps * Add files to ESlint * Fix drone typo * Don't log to console in CI * Use go test http server * Add build step before tests * Move shared init function to common package * fix drone * Clean up tests * Fix linting * Better mocking for page + version string * Cleanup test generation * Remove dependency on gitea binary * Fix linting * add initial support for running specific tests * Add ACCEPT_VISUAL variable * don't require git-lfs * Add initial documentation * Review feedback * Add logged in session test * Attempt fixing drone race * Cleanup and bump version * Bump deps * Review feedback * simplify installation * Fix ci * Update install docs
1 parent 5710ff3 commit c8ded77

File tree

644 files changed

+1857
-1027
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

644 files changed

+1857
-1027
lines changed

.drone.yml

+69
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,75 @@ steps:
498498
- name: deps
499499
path: /go
500500

501+
---
502+
kind: pipeline
503+
type: docker
504+
name: testing-e2e
505+
506+
platform:
507+
os: linux
508+
arch: amd64
509+
510+
depends_on:
511+
- compliance
512+
513+
trigger:
514+
event:
515+
- pull_request
516+
517+
volumes:
518+
- name: deps
519+
temp: {}
520+
521+
services:
522+
- name: pgsql
523+
pull: default
524+
image: postgres:10
525+
environment:
526+
POSTGRES_DB: testgitea-e2e
527+
POSTGRES_PASSWORD: postgres
528+
POSTGRES_INITDB_ARGS: --encoding=UTF8 --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'
529+
530+
steps:
531+
- name: deps-frontend
532+
image: node:16
533+
pull: always
534+
commands:
535+
- make deps-frontend
536+
537+
- name: build-frontend
538+
image: node:16
539+
commands:
540+
- make frontend
541+
depends_on: [deps-frontend]
542+
543+
- name: deps-backend
544+
image: golang:1.18
545+
pull: always
546+
commands:
547+
- make deps-backend
548+
volumes:
549+
- name: deps
550+
path: /go
551+
552+
# TODO: We should probably build all dependencies into a test image
553+
- name: test-e2e
554+
image: mcr.microsoft.com/playwright:v1.23.1-focal
555+
commands:
556+
- curl -sLO https://go.dev/dl/go1.18.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.18.linux-amd64.tar.gz
557+
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
558+
- apt-get -qq update && apt-get -qqy install build-essential
559+
- export TEST_PGSQL_SCHEMA=''
560+
- ./build/test-env-prepare.sh
561+
- su gitea bash -c "export PATH=$PATH:/usr/local/go/bin && timeout -s ABRT 40m make test-e2e-pgsql"
562+
environment:
563+
GOPROXY: https://goproxy.io
564+
GOSUMDB: sum.golang.org
565+
USE_REPO_TEST_DIR: 1
566+
TEST_PGSQL_DBNAME: 'testgitea-e2e'
567+
DEBIAN_FRONTEND: noninteractive
568+
depends_on: [build-frontend, deps-backend]
569+
501570
---
502571
kind: pipeline
503572
name: update_translations

.gitignore

+8-15
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,14 @@ cpu.out
6363
/indexers
6464
/log
6565
/public/img/avatar
66-
/integrations/gitea-integration-mysql
67-
/integrations/gitea-integration-mysql8
68-
/integrations/gitea-integration-pgsql
69-
/integrations/gitea-integration-sqlite
70-
/integrations/gitea-integration-mssql
71-
/integrations/indexers-mysql
72-
/integrations/indexers-mysql8
73-
/integrations/indexers-pgsql
74-
/integrations/indexers-sqlite
75-
/integrations/indexers-mssql
76-
/integrations/sqlite.ini
77-
/integrations/mysql.ini
78-
/integrations/mysql8.ini
79-
/integrations/pgsql.ini
80-
/integrations/mssql.ini
66+
/tests/integration/gitea-integration-*
67+
/tests/integration/indexers-*
68+
/tests/e2e/gitea-e2e-*
69+
/tests/e2e/indexers-*
70+
/tests/e2e/reports
71+
/tests/e2e/test-artifacts
72+
/tests/e2e/test-snapshots
73+
/tests/*.ini
8174
/node_modules
8275
/yarn.lock
8376
/yarn-error.log

CONTRIBUTING.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ Here's how to run the test suite:
8686
| | |
8787
| :------------------------------------- | :----------------------------------------------- |
8888
|``make test[\#TestSpecificName]`` | run unit test |
89-
|``make test-sqlite[\#TestSpecificName]``| run [integration](integrations) test for SQLite |
90-
|[More details about integrations](integrations/README.md) |
89+
|``make test-sqlite[\#TestSpecificName]``| run [integration](tests/integration) test for SQLite |
90+
|[More details about integration tests](tests/integration/README.md) |
91+
|``make test-e2e-sqlite[\#TestSpecificFileName]``| run [end-to-end](tests/e2e) test for SQLite |
92+
|[More details about e2e tests](tests/e2e/README.md) |
9193

9294
## Vendoring
9395

@@ -168,7 +170,7 @@ import (
168170

169171
To maintain understandable code and avoid circular dependencies it is important to have a good structure of the code. The Gitea code is divided into the following parts:
170172

171-
- **integration:** Integrations tests
173+
- **integration:** Integration tests
172174
- **models:** Contains the data structures used by xorm to construct database tables. It also contains supporting functions to query and update the database. Dependencies to other code in Gitea should be avoided although some modules might be needed (for example for logging).
173175
- **models/fixtures:** Sample model data used in integration tests.
174176
- **models/migrations:** Handling of database migrations between versions. PRs that changes a database structure shall also have a migration step.

0 commit comments

Comments
 (0)