|
| 1 | +name: ui-tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["Notify ui test"] |
| 6 | + types: |
| 7 | + - completed |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: bansan85/action-workflow_run-status@main |
| 14 | + |
| 15 | + - name: checkout |
| 16 | + uses: actions/checkout@v2 |
| 17 | + with: |
| 18 | + # checkouts the commit that triggered the Notify ui test workflow |
| 19 | + ref: ${{ github.event.workflow_run.head_sha }} |
| 20 | + |
| 21 | + - name: cached dependencies |
| 22 | + uses: actions/cache@v2 |
| 23 | + id: cached-dependencies |
| 24 | + with: |
| 25 | + path: | |
| 26 | + ./vendor |
| 27 | + ./tawkto/vendor |
| 28 | + # the key will change if composer.lock changes |
| 29 | + key: ${{ runner.os }}-composer-dependencies-${{ hashFiles('**/composer.lock') }} |
| 30 | + |
| 31 | + - name: install dependencies |
| 32 | + if: steps.cached-dependencies.outputs.cache-hit != 'true' |
| 33 | + uses: php-actions/composer@v6 |
| 34 | + with: |
| 35 | + php_extensions: zip |
| 36 | + command: run build |
| 37 | + |
| 38 | + tests: |
| 39 | + needs: [build] |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + browser: ['chrome', 'firefox', 'edge'] |
| 44 | + |
| 45 | + runs-on: ubuntu-latest |
| 46 | + env: |
| 47 | + WEB_HOST: wordpress |
| 48 | + SELENIUM_BROWSER: ${{ matrix.browser }} |
| 49 | + SELENIUM_HOST: localhost |
| 50 | + SELENIUM_PORT: 4444 |
| 51 | + |
| 52 | + steps: |
| 53 | + - name: Report to PR |
| 54 | + env: |
| 55 | + MATRIX_CONTEXT: ${{ toJSON(matrix) }} |
| 56 | + uses: bansan85/action-workflow_run-status@main |
| 57 | + |
| 58 | + - name: checkout |
| 59 | + uses: actions/checkout@v2 |
| 60 | + with: |
| 61 | + # checkouts the commit that triggered the Notify ui test workflow |
| 62 | + ref: ${{ github.event.workflow_run.head_sha }} |
| 63 | + |
| 64 | + - name: Start docker services and setup WordPress |
| 65 | + run: | |
| 66 | + docker-compose -f ./tests/docker/docker-compose.yml up -d; |
| 67 | + docker attach wordpress-cli; |
| 68 | +
|
| 69 | + - name: cached dependencies |
| 70 | + uses: actions/cache@v2 |
| 71 | + id: cached-dependencies |
| 72 | + with: |
| 73 | + path: | |
| 74 | + ./vendor |
| 75 | + ./tawkto/vendor |
| 76 | + # the key will change if composer.lock changes |
| 77 | + key: ${{ runner.os }}-composer-dependencies-${{ hashFiles('**/composer.lock') }} |
| 78 | + |
| 79 | + - name: prepare test artifact |
| 80 | + run: composer run package |
| 81 | + |
| 82 | + - name: run tests |
| 83 | + env: |
| 84 | + TAWK_PROPERTY_ID: 61efb9abb9e4e21181bbc347 |
| 85 | + TAWK_WIDGET_ID: 1fq86qic0 |
| 86 | + TAWK_USERNAME: ${{ secrets.TAWK_USERNAME }} |
| 87 | + TAWK_PASSWORD: ${{ secrets.TAWK_PASSWORD }} |
| 88 | + run: composer run test |
0 commit comments