-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update github workflow with CY tests wip
- Loading branch information
Showing
15 changed files
with
298 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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,203 @@ | ||
name: "E2e test on main branch push" | ||
|
||
# These jobs can be tested with nektos/act tool | ||
# https://github.com/nektos/act | ||
# | ||
# Look for "!env.ACT" in the DRY_RUN expression below | ||
|
||
on: | ||
push: | ||
branches: | ||
- 2023.9.x-feature-e2e | ||
|
||
env: | ||
BUILD_OS: linux | ||
BUILD_ARCH: amd64 | ||
|
||
GO_VERSION: 1.19 | ||
GOFLAGS: -mod=readonly | ||
|
||
NODE_VERSION: 16 | ||
CORTEZA_VERSION: 2023.9.0 | ||
CYPRESS_VERSION: 13.5.0 | ||
CYPRESS_HOST: http://localhost:8888 | ||
CYPRESS_BASE_URL: http://localhost:8888 | ||
CYPRESS_ADMIN_URL: http://localhost:8080 | ||
CYPRESS_COMPOSE_URL: http://localhost:8081 | ||
CYPRESS_WORKFLOW_URL: http://localhost:8082 | ||
CYPRESS_REPORTER_URL: http://localhost:8083 | ||
CYPRESS_ONE_URL: http://localhost:8084 | ||
CYPRESS_PRIVACY_URL: http://localhost:8085 | ||
CYPRESS_USER_EMAIL: [email protected] | ||
CYPRESS_USER_PASSWORD: cypress123 | ||
CYPRESS_USER_PASSWORD_NEW: newcypress123 | ||
CYPRESS_USER_EMAIL_NEW: [email protected] | ||
CYPRESS_USER_DPO: [email protected] | ||
CYPRESS_USER_DPO_PASSWORD: [email protected] | ||
|
||
jobs: | ||
server-client-setup: | ||
name: "server and client test" | ||
strategy: | ||
matrix: | ||
client: | ||
- { port: 8081, name: compose } | ||
- { port: 8080, name: admin } | ||
- { port: 8082, name: workflow } | ||
- { port: 8083, name: reporter } | ||
- { port: 8084, name: one } | ||
- { port: 8085, name: privacy } | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Setup tmate session | ||
uses: mxschmitt/action-tmate@v3 | ||
with: | ||
limit-access-to-actor: true | ||
detached: true | ||
|
||
- uses: actions/setup-node@v3 | ||
with: { node-version: "${{ env.NODE_VERSION }}" } | ||
|
||
- uses: actions/setup-go@v3 | ||
with: { go-version: "${{ env.GO_VERSION }}" } | ||
|
||
- name: "Setup YARN" | ||
run: npm install -g yarn @vue/cli-service | ||
|
||
- name: Checkout corteza repo | ||
uses: actions/checkout@v3 | ||
with: | ||
path: corteza | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ref: 2023.9.x-feature-e2e | ||
|
||
- name: "Copy server language files" | ||
working-directory: corteza/server/pkg/locale | ||
run: make src/en | ||
|
||
- name: "Set up PostgreSQL database" | ||
env: | ||
POSTGRES_USER: corteza | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_DB: corteza_cy_test | ||
run: | | ||
docker run -d \ | ||
--name corteza_postgres \ | ||
-p 5432:5432 \ | ||
-e POSTGRES_USER=${POSTGRES_USER} \ | ||
-e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \ | ||
-e POSTGRES_DB=${POSTGRES_DB} \ | ||
--health-cmd="pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}" \ | ||
--health-interval=10s \ | ||
--health-timeout=5s \ | ||
--health-retries=5 \ | ||
postgres:15 | ||
- name: Run server and db | ||
working-directory: corteza | ||
run: | | ||
docker-compose up -d backend | ||
- name: Update config file in webapps | ||
working-directory: corteza | ||
env: | ||
CLIENT_NAME: ${{ matrix.client.name }} | ||
run: | | ||
cp client/web/${CLIENT_NAME}/public/config.example.js client/web/${CLIENT_NAME}/public/config.js | ||
sed -i -e 's/https:\/\/api.cortezaproject.your-domain.tld/\/\/localhost:8888\/api/g' client/web/${CLIENT_NAME}/public/config.js | ||
- name: Build js | ||
working-directory: corteza/lib/js | ||
run: | | ||
yarn install | ||
yarn build | ||
- name: Build vue | ||
working-directory: corteza/lib/vue | ||
run: | | ||
yarn install | ||
yarn build | ||
- name: Run "${{ matrix.client.name }}" | ||
working-directory: corteza | ||
# re-link the packages for each app | ||
env: | ||
CLIENT_NAME: ${{ matrix.client.name }} | ||
CLIENT_PORT: ${{ matrix.client.port }} | ||
run: | | ||
echo ${CLIENT_NAME} | ||
echo ${CLIENT_PORT} | ||
docker-compose run -d \ | ||
--name ${CLIENT_NAME} \ | ||
--use-aliases \ | ||
client \ | ||
sh -c "cd /corteza/lib/js && yarn link && cd /corteza/lib/vue && yarn link && cd /corteza/client/web/${CLIENT_NAME} && yarn link @cortezaproject/corteza-vue && yarn link @cortezaproject/corteza-js && yarn install && yarn serve --port ${CLIENT_PORT}" | ||
- name: Clone CY repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: cortezaproject/corteza-e2e-cypress | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ref: 2023.9.x-feature-e2e | ||
path: corteza-e2e-cypress | ||
|
||
# github actions do not support docker-compose --wait | ||
- name: Wait for postgres healthcheck | ||
run: timeout 180s sh -c 'until docker ps | grep corteza_postgres | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done' | ||
|
||
- name: Wait for "${{ matrix.client.name }}" healthcheck | ||
env: | ||
CLIENT_NAME: ${{ matrix.client.name }} | ||
run: timeout 180s sh -c 'until docker ps | grep ${CLIENT_NAME} | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done' | ||
|
||
- name: Wait for backend healthcheck | ||
run: timeout 180s sh -c 'until docker ps | grep corteza_backend_1 | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done' | ||
|
||
- name: Run CY tests for "${{ matrix.client.name }}" | ||
env: | ||
CLIENT_NAME: ${{ matrix.client.name }} | ||
CLIENT_PORT: ${{ matrix.client.port }} | ||
working-directory: corteza-e2e-cypress | ||
run: | | ||
docker ps | ||
yarn install | ||
echo "Run CY tests" | ||
if [ "${CLIENT_NAME}" = "privacy" ]; then | ||
echo "Run Privacy tests" | ||
docker-compose run \ | ||
--entrypoint="bash -c \" \ | ||
cypress run --spec cypress/e2e/basic-functionalities/server/Create_user.cy.js --browser chrome \ | ||
\"" \ | ||
cypress | ||
docker-compose run \ | ||
--entrypoint="bash -c \" \ | ||
cypress run --spec cypress/e2e/basic-functionalities/${CLIENT_NAME}/index.cy.js --browser chrome \ | ||
\"" \ | ||
cypress | ||
else | ||
echo "Run ${CLIENT_NAME} tests" | ||
docker-compose run \ | ||
--entrypoint="bash -c \" \ | ||
cypress run --spec cypress/e2e/basic-functionalities/server/Create_user.cy.js --browser chrome \ | ||
\"" \ | ||
cypress | ||
docker-compose run \ | ||
--entrypoint="bash -c \" \ | ||
cypress run --spec cypress/e2e/basic-functionalities/${CLIENT_NAME}/index.cy.js --browser chrome \ | ||
\"" \ | ||
cypress | ||
docker-compose run \ | ||
--entrypoint="bash -c \" \ | ||
cypress run --spec cypress/e2e/basic-functionalities/topbar/${CLIENT_NAME}/index.cy.js --browser chrome \ | ||
\"" \ | ||
cypress | ||
fi | ||
This file contains 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 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 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 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 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 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 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
Binary file not shown.
This file contains 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,60 @@ | ||
version: "3.5" | ||
|
||
services: | ||
backend: | ||
network_mode: host | ||
image: golang:latest | ||
volumes: | ||
- "${PWD}:/corteza" | ||
entrypoint: | | ||
sh -c " | ||
git config --global --add safe.directory /corteza && | ||
go run /corteza/server/cmd/corteza/main.go serve-api | ||
" | ||
working_dir: /corteza/server | ||
environment: | ||
- DB_DSN=postgres://corteza:root@localhost:5432/corteza_cy_test?sslmode=disable | ||
# - GIN_ARG_LADDR=0.0.0.0 | ||
- HTTP_ADDR=:8888 | ||
- HTTP_ENABLE_DEBUG_ROUTE=true | ||
- HTTP_WEBAPP_ENABLED=true | ||
- ENVIRONMENT=dev | ||
healthcheck: | ||
test: curl --silent --fail-early --fail http://localhost:8888/healthcheck || exit 1 | ||
interval: 30s | ||
timeout: 30s | ||
retries: 3 | ||
start_period: 60s | ||
|
||
postgres: | ||
network_mode: host | ||
image: postgres:15 | ||
environment: | ||
POSTGRES_USER: corteza | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_DB: corteza_cy_test | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
client: | ||
network_mode: host | ||
image: node:16.20-alpine3.16 | ||
volumes: | ||
- "${PWD}:/corteza" | ||
working_dir: /corteza | ||
environment: | ||
BUILD_VERSION: 2023.3.6-3-g251c05abf | ||
healthcheck: | ||
test: wget --no-verbose --tries=1 --spider http://localhost:8080 || exit 1 | ||
interval: 30s | ||
timeout: 30s | ||
retries: 3 | ||
start_period: 60s | ||
|
||
deploy: | ||
resources: | ||
limits: | ||
memory: 2g |
Binary file added
BIN
+397 KB
...ld -- should not be able to create a user with misconfigured email (failed).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+396 KB
...d -- should not be able to create a user with misconfigured handle (failed).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+396 KB
...ed field -- should not be able to create a user with missing email (failed).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+398 KB
...ld -- should not be able to create a user with only a name entered (failed).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+401 KB
...ld -- should not be able to create a user without any info entered (failed).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.