|
| 1 | +name: E2E Chrome Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + isManual: |
| 7 | + required: false |
| 8 | + type: boolean |
| 9 | + default: false |
| 10 | + platform: |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + secrets: |
| 14 | + TEST_USER_USERNAME: |
| 15 | + required: true |
| 16 | + TEST_USER_PASSWORD: |
| 17 | + required: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + e2e-chrome-tests: |
| 21 | + environment: ${{ inputs.isManual && 'manual_e2e_tests' || '' }} |
| 22 | + timeout-minutes: 5 |
| 23 | + runs-on: ubuntu-latest |
| 24 | + container: |
| 25 | + image: cypress/browsers:node18.12.0-chrome106-ff106 |
| 26 | + options: --user 1001 |
| 27 | + strategy: |
| 28 | + fail-fast: false # https://github.com/cypress-io/github-action/issues/48 |
| 29 | + matrix: |
| 30 | + # https://github.com/languages-learner/web/issues/32 - Disable cypress logs because limit reached |
| 31 | + # containers: [ 1, 2 ] |
| 32 | + containers: [ 1 ] |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Setup Node.js |
| 38 | + uses: actions/setup-node@v4 |
| 39 | + with: |
| 40 | + node-version: 18 |
| 41 | + |
| 42 | + - name: Cache dependencies |
| 43 | + id: cache |
| 44 | + uses: actions/cache@v3 |
| 45 | + with: |
| 46 | + path: ./node_modules |
| 47 | + key: modules-${{ hashFiles('package-lock.json') }} |
| 48 | + |
| 49 | + - name: Download the build folders |
| 50 | + uses: actions/download-artifact@v4 |
| 51 | + with: |
| 52 | + name: dist-test |
| 53 | + path: dist-test |
| 54 | + |
| 55 | + - name: Install dependencies |
| 56 | + if: steps.cache.outputs.cache-hit != 'true' |
| 57 | + run: npm ci |
| 58 | + |
| 59 | + - name: "Cypress install" |
| 60 | + run: yarn cypress install --force |
| 61 | + |
| 62 | + - name: Node info |
| 63 | + run: node -v |
| 64 | + |
| 65 | + # - name: __e Dir |
| 66 | + # run: ls /__e |
| 67 | + |
| 68 | + - name: "E2E Tests - Chrome" |
| 69 | + uses: cypress-io/github-action@v6 |
| 70 | + with: |
| 71 | + install: false |
| 72 | + start: npm run preview:test |
| 73 | + browser: chrome |
| 74 | + # https://github.com/languages-learner/web/issues/32 - Disable cypress logs because limit reached |
| 75 | + # record: true |
| 76 | + # parallel: true |
| 77 | + # group: "E2E - Chrome" |
| 78 | + spec: cypress/e2e/* |
| 79 | + config-file: ${{ inputs.platform == 'desktop' && 'cypress/configs/preview.ts' || 'cypress/configs/mobile.preview.ts' }} |
| 80 | + env: |
| 81 | + TEST_USER_USERNAME: ${{ secrets.TEST_USER_USERNAME }} |
| 82 | + TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }} |
| 83 | +# https://github.com/languages-learner/web/issues/32 - Disable cypress logs because limit reached |
| 84 | +# CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} |
| 85 | +# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} |
| 86 | +# COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} |
| 87 | +# COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }} |
| 88 | +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + |
| 90 | + - name: Save cypress snapshots |
| 91 | + if: always() |
| 92 | + uses: actions/upload-artifact@v4 |
| 93 | + with: |
| 94 | + name: ${{ inputs.platform == 'desktop' && 'e2e-chrome-cypress-snapshots' || 'e2e-chrome-mobile-cypress-snapshots' }} |
| 95 | + path: | |
| 96 | + cypress/snapshots/actual |
| 97 | + cypress/snapshots/diff |
0 commit comments