Skip to content
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

Kd/ci playwright go test #20123

Merged
merged 58 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
ccd6923
Add initial playwright config
kdumontnu Jun 22, 2022
601a656
Simplify Makefile
kdumontnu Jan 31, 2022
e307d34
Simplify Makefile
kdumontnu Feb 1, 2022
935aef0
Use correct config files
kdumontnu Feb 1, 2022
c54cb84
Update playwright settings
kdumontnu Feb 6, 2022
5deabe5
Fix package-lock file
kdumontnu Feb 6, 2022
6589fc7
Don't use test logger for e2e tests
kdumontnu Feb 7, 2022
1055426
fix frontend lint
kdumontnu Feb 7, 2022
8e88806
Allow passing TEST_LOGGER variable
kdumontnu Feb 7, 2022
606f1ab
Init postgres database
kdumontnu Feb 7, 2022
3017e55
use standard gitea env variables
kdumontnu Jun 22, 2022
d557713
Update playwright
kdumontnu Jun 22, 2022
d19c959
update drone
kdumontnu Jun 23, 2022
ba57344
Move empty env var to commands
kdumontnu Jun 23, 2022
5ebadc5
Cleanup
kdumontnu Jun 23, 2022
a099a57
Move integrations to subfolder
kdumontnu Jun 23, 2022
13e63f8
tests integrations to tests integraton
kdumontnu Jun 23, 2022
923f6de
Run e2e tests with go test
kdumontnu Jun 24, 2022
b7d5dbe
Fix linting
kdumontnu Jun 24, 2022
0c4d0f9
install CI deps
kdumontnu Jun 24, 2022
07ff4c5
resolve conflicts
kdumontnu Jun 27, 2022
3ca4887
Add files to ESlint
kdumontnu Jun 27, 2022
f6e637b
Fix drone typo
kdumontnu Jun 27, 2022
d395cc4
Don't log to console in CI
kdumontnu Jun 27, 2022
1e71627
Use go test http server
kdumontnu Jun 27, 2022
1ef5eca
Add build step before tests
kdumontnu Jun 27, 2022
b51d2bd
Move shared init function to common package
kdumontnu Jun 27, 2022
4a35208
fix drone
kdumontnu Jun 27, 2022
c3a2063
Clean up tests
kdumontnu Jun 28, 2022
c6a8aa0
Merge commit 'cdd6371ad484cce6233892d8f6744b52cd38e0c8' into kd/ci-pl…
kdumontnu Jun 28, 2022
27feb22
Fix linting
kdumontnu Jun 28, 2022
7933e44
Better mocking for page + version string
kdumontnu Jun 28, 2022
2861aa4
Cleanup test generation
kdumontnu Jun 28, 2022
adbd8a0
Remove dependency on gitea binary
kdumontnu Jun 28, 2022
fab88ea
Fix linting
kdumontnu Jun 28, 2022
32e3961
add initial support for running specific tests
kdumontnu Jun 28, 2022
cab441f
Add ACCEPT_VISUAL variable
kdumontnu Jun 28, 2022
2c98943
don't require git-lfs
kdumontnu Jun 28, 2022
56c877a
Add initial documentation
kdumontnu Jun 28, 2022
6c9224c
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Jun 29, 2022
49289b4
Review feedback
kdumontnu Jun 29, 2022
8802abd
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Jun 30, 2022
71a53bd
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Jul 5, 2022
db18686
Add logged in session test
kdumontnu Jul 6, 2022
3c9f161
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Jul 6, 2022
7feb192
Attempt fixing drone race
kdumontnu Jul 6, 2022
bbe663a
Cleanup and bump version
kdumontnu Jul 6, 2022
a5c8d13
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Jul 7, 2022
34f6364
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Jul 8, 2022
14af841
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Aug 31, 2022
72a3dc5
Bump deps
kdumontnu Sep 1, 2022
a18ed34
Review feedback
kdumontnu Sep 1, 2022
026dbaa
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Sep 1, 2022
b44459c
simplify installation
kdumontnu Sep 1, 2022
224d45a
Fix ci
kdumontnu Sep 1, 2022
3ebb9a2
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Sep 2, 2022
d06d1c9
Update install docs
kdumontnu Sep 2, 2022
c2dc4c7
Merge branch 'main' into kd/ci-playwright_go_test
kdumontnu Sep 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
74 changes: 74 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,80 @@ steps:
- name: deps
path: /go

---
kind: pipeline
type: docker
name: testing-e2e

platform:
os: linux
arch: amd64

depends_on:
- compliance

trigger:
event:
- pull_request

volumes:
- name: deps
temp: {}

services:
- name: pgsql
pull: default
image: postgres:10
environment:
POSTGRES_DB: testgitea-e2e
POSTGRES_PASSWORD: postgres
POSTGRES_INITDB_ARGS: --encoding=UTF8 --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'

steps:
- name: deps-frontend
image: node:16
pull: always
commands:
- make deps-frontend

- name: build-frontend
image: node:16
commands:
- make frontend
depends_on: [deps-frontend]

- name: deps-backend
image: golang:1.18
pull: always
commands:
- make deps-backend
kdumontnu marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- name: deps
path: /go

# TODO: We should probably build all dependencies into a test image
6543 marked this conversation as resolved.
Show resolved Hide resolved
- name: test-e2e
image: mcr.microsoft.com/playwright:v1.22.2-focal
commands:
- curl -sL https://go.dev/dl/go1.18.3.linux-amd64.tar.gz -o go1.18.3.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz
kdumontnu marked this conversation as resolved.
Show resolved Hide resolved
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
- apt-get update
- apt-get install build-essential --yes
kdumontnu marked this conversation as resolved.
Show resolved Hide resolved
- export TEST_PGSQL_SCHEMA=''
- ./build/test-env-prepare.sh
- su gitea bash -c "export PATH=$PATH:/usr/local/go/bin && timeout -s ABRT 40m make test-e2e-pgsql"
environment:
GOPROXY: https://goproxy.io
GOSUMDB: sum.golang.org
USE_REPO_TEST_DIR: 1
NO_DEPS_PLAYWRIGHT: 1
TEST_PGSQL_DBNAME: 'testgitea-e2e'
NPX_FLAGS: '--yes'
kdumontnu marked this conversation as resolved.
Show resolved Hide resolved
kdumontnu marked this conversation as resolved.
Show resolved Hide resolved
depends_on: [build-frontend, deps-backend]
volumes:
- name: deps
path: /go

---
kind: pipeline
name: update_translations
Expand Down
23 changes: 8 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,14 @@ cpu.out
/indexers
/log
/public/img/avatar
/integrations/gitea-integration-mysql
/integrations/gitea-integration-mysql8
/integrations/gitea-integration-pgsql
/integrations/gitea-integration-sqlite
/integrations/gitea-integration-mssql
/integrations/indexers-mysql
/integrations/indexers-mysql8
/integrations/indexers-pgsql
/integrations/indexers-sqlite
/integrations/indexers-mssql
/integrations/sqlite.ini
/integrations/mysql.ini
/integrations/mysql8.ini
/integrations/pgsql.ini
/integrations/mssql.ini
/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
/node_modules
/yarn.lock
/yarn-error.log
Expand Down
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ Here's how to run the test suite:
| | |
| :------------------------------------- | :----------------------------------------------- |
|``make test[\#TestSpecificName]`` | run unit test |
|``make test-sqlite[\#TestSpecificName]``| run [integration](integrations) test for SQLite |
|[More details about integrations](integrations/README.md) |
|``make test-sqlite[\#TestSpecificName]``| run [integration](tests/integration) test for SQLite |
|[More details about integrations](tests/integration/README.md) |
|``make test-e2e-sqlite[\#TestSpecificFileName]``| run [end-to-end](tests/e2e) test for SQLite |
|[More details about e2e tests](tests/e2e/README.md) |

## Vendoring

Expand Down Expand Up @@ -167,7 +169,7 @@ import (

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:

- **integration:** Integrations tests
- **integration:** Integration tests
- **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).
- **models/fixtures:** Sample model data used in integration tests.
- **models/migrations:** Handling of database migrations between versions. PRs that changes a database structure shall also have a migration step.
Expand Down
Loading