test(ci): web extension ci tests

This commit is contained in:
Carlos Garcia Ortiz karliatto
2023-03-23 14:25:48 +01:00
committed by Carlos García Ortiz
parent f037c55ace
commit a033390e23
3 changed files with 82 additions and 0 deletions

View File

@@ -394,3 +394,39 @@ connect-web:
extends: .e2e connect-web
only:
<<: *run_everything_rules
.e2e connect-web-extension:
stage: integration testing
variables:
COMPOSE_PROJECT_NAME: $CI_JOB_ID
COMPOSE_FILE: ./docker/docker-compose.connect-webextension-test.yml
URL: ${DEV_SERVER_URL}/connect/${CI_BUILD_REF_NAME}/
HEADLESS: "true"
script:
- yarn install --immutable
- node ./packages/connect-examples/update-webextensions.js
- docker-compose pull
- docker-compose up -d trezor-user-env-unix
- docker-compose run test-run
after_script:
- docker-compose down
- docker network prune -f
artifacts:
expire_in: 7 days
when: always
paths:
- ./packages/integration-tests/screenshots
- ./packages/integration-tests/test-results
interruptible: true
connect-web-extension:
extends: .e2e connect-web-extension
only:
<<: *run_everything_rules
when: always
connect-web-extension manual:
extends: .e2e connect-web-extension
except:
<<: *run_everything_rules
when: manual

View File

@@ -0,0 +1,36 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env
environment:
- SDL_VIDEODRIVER=dummy
- XDG_RUNTIME_DIR=/var/tmp
- DISPLAY=$DISPLAY
- QT_X11_NO_MITSHM=1
- LOCAL_USER_ID=$LOCAL_USER_ID
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
test-run:
image: mcr.microsoft.com/playwright:focal
container_name: webextension-test-runner
ipc: host
depends_on:
- trezor-user-env-unix
network_mode: service:trezor-user-env-unix
environment:
- URL=$URL
- HEADLESS=$HEADLESS
- DISPLAY=$DISPLAY
- LOCAL_USER_ID=$LOCAL_USER_ID
- CI_JOB_URL=$CI_JOB_URL
- CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH
- CI_JOB_NAME=$CI_JOB_NAME
# useful for debugging tests
- PWDEBUG=console
working_dir: /trezor-suite
command: bash -c "npx playwright install && yarn workspace @trezor/connect-webextension test:e2e"
volumes:
- ../:/trezor-suite
- /tmp/.X11-unix:/tmp/.X11-unix:rw

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
xhost +
LOCAL_USER_ID="$(id -u "$USER")"
HEADLESS=false
export LOCAL_USER_ID
export HEADLESS
docker-compose -f ./docker/docker-compose.connect-webextension-test.yml up --build --abort-on-container-exit