Cypress Tests #57
This file contains hidden or 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
| name: Cypress Tests | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 9 * * 1' | |
| jobs: | |
| install: | |
| name: Install | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout Repository | |
| id: checkout-repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Cache Node Modules | |
| id: cache-node-modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| key: modules-${{ hashFiles('package-lock.json') }} | |
| test: | |
| name: Tests - ${{ matrix.browser }} - part ${{ matrix.splitIndex }} of ${{ matrix.splitTotal }} | |
| runs-on: ubuntu-latest | |
| needs: [install] | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| browser: [electron, chrome, firefox, edge] | |
| splitIndex: [0, 1] | |
| splitTotal: [2] | |
| services: | |
| rbp-booking: | |
| image: mwinteringham/restfulbookerplatform_booking:1.6.24c7b22 | |
| ports: | |
| - 3000:3000 | |
| rbp-room: | |
| image: mwinteringham/restfulbookerplatform_room:1.6.24c7b22 | |
| ports: | |
| - 3001:3001 | |
| rbp-branding: | |
| image: mwinteringham/restfulbookerplatform_branding:1.6.24c7b22 | |
| ports: | |
| - 3002:3002 | |
| rbp-assets: | |
| image: mwinteringham/restfulbookerplatform_assets:1.6.24c7b22 | |
| ports: | |
| - 3003:3003 | |
| rbp-auth: | |
| image: mwinteringham/restfulbookerplatform_auth:1.6.24c7b22 | |
| ports: | |
| - 3004:3004 | |
| rbp-report: | |
| image: mwinteringham/restfulbookerplatform_report:1.6.24c7b22 | |
| ports: | |
| - 3005:3005 | |
| rbp-message: | |
| image: mwinteringham/restfulbookerplatform_message:1.6.24c7b22 | |
| ports: | |
| - 3006:3006 | |
| rbp-proxy: | |
| image: mwinteringham/restfulbookerplatform_proxy:latest | |
| ports: | |
| - 80:80 | |
| steps: | |
| - name: Checkout Repository | |
| id: checkout-repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Cache Node Modules | |
| id: cache-node-modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| key: modules-${{ hashFiles('package-lock.json') }} | |
| - name: Cypress Run | |
| id: cypress-run | |
| if: ${{ matrix.browser != 'firefox' }} | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| env: ENV=local,TAGS=not @bug | |
| browser: ${{ matrix.browser }} | |
| command-prefix: '--' | |
| env: | |
| SPLIT: ${{ matrix.splitTotal }} | |
| SPLIT_INDEX: ${{ matrix.splitIndex }} | |
| CYPRESS_messagesOutput: cypress/reports/messages/cucumber-${{ matrix.browser }}-${{ matrix.splitIndex }}_${{ matrix.splitTotal }}.ndjson | |
| - name: Cypress Run (for Firefox) | |
| id: cypress-run-firefox | |
| if: ${{ matrix.browser == 'firefox' }} | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| config: video=false | |
| env: ENV=local,TAGS=not @bug | |
| browser: ${{ matrix.browser }} | |
| command-prefix: '--' | |
| env: | |
| SPLIT: ${{ matrix.splitTotal }} | |
| SPLIT_INDEX: ${{ matrix.splitIndex }} | |
| CYPRESS_messagesOutput: cypress/reports/messages/cucumber-${{ matrix.browser }}-${{ matrix.splitIndex }}_${{ matrix.splitTotal }}.ndjson | |
| - name: Upload Allure Results | |
| id: upload-allure-results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: allure-results-${{ matrix.browser }}-${{ matrix.splitIndex }}_${{ matrix.splitTotal }} | |
| path: cypress/reports/allure-results/ | |
| if-no-files-found: ignore | |
| retention-days: 1 | |
| - name: Upload Cucumber Messages | |
| id: upload-cucumber-messages | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: cucumber-messages-${{ matrix.browser }}-${{ matrix.splitIndex }}_${{ matrix.splitTotal }} | |
| path: cypress/reports/messages/ | |
| if-no-files-found: ignore | |
| retention-days: 1 | |
| report: | |
| name: Merge and Publish Reports | |
| if: ${{ always() }} | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| timeout-minutes: 30 | |
| permissions: | |
| actions: write | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: true | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout Repository | |
| id: checkout-repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Cache Node Modules | |
| id: cache-node-modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| key: modules-${{ hashFiles('package-lock.json') }} | |
| - name: Download Cucumber Messages | |
| id: download-cucumber-messages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: cucumber-messages | |
| pattern: cucumber-messages-* | |
| merge-multiple: true | |
| - name: Generate Cucumber HTML Reports | |
| id: generate-cucumber-html-reports | |
| run: | | |
| mkdir cucumber-html-reports | |
| npx cucumber-merge-messages cucumber-messages/*electron*.ndjson > cucumber-messages/cucumber-electron.ndjson | |
| npx cucumber-html-formatter < cucumber-messages/cucumber-electron.ndjson > cucumber-html-reports/cucumber-electron.html | |
| npx cucumber-merge-messages cucumber-messages/*chrome-*.ndjson > cucumber-messages/cucumber-chrome.ndjson | |
| npx cucumber-html-formatter < cucumber-messages/cucumber-chrome.ndjson > cucumber-html-reports/cucumber-chrome.html | |
| npx cucumber-merge-messages cucumber-messages/*firefox-*.ndjson > cucumber-messages/cucumber-firefox.ndjson | |
| npx cucumber-html-formatter < cucumber-messages/cucumber-firefox.ndjson > cucumber-html-reports/cucumber-firefox.html | |
| npx cucumber-merge-messages cucumber-messages/*edge-*.ndjson > cucumber-messages/cucumber-edge.ndjson | |
| npx cucumber-html-formatter < cucumber-messages/cucumber-edge.ndjson > cucumber-html-reports/cucumber-edge.html | |
| - name: Download Allure Results | |
| id: download-allure-results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: allure-results | |
| pattern: allure-results-* | |
| merge-multiple: true | |
| - name: Generate Allure Report | |
| id: generate-allure-report | |
| run: | | |
| curl --create-dirs -o ./allure-results/history/categories-trend.json https://m-pujic-levi9-com.github.io/cypress-cucumber-e2e-tests/allure/history/categories-trend.json | |
| curl --create-dirs -o ./allure-results/history/duration-trend.json https://m-pujic-levi9-com.github.io/cypress-cucumber-e2e-tests/allure/history/duration-trend.json | |
| curl --create-dirs -o ./allure-results/history/history-trend.json https://m-pujic-levi9-com.github.io/cypress-cucumber-e2e-tests/allure/history/history-trend.json | |
| curl --create-dirs -o ./allure-results/history/history.json https://m-pujic-levi9-com.github.io/cypress-cucumber-e2e-tests/allure/history/history.json | |
| curl --create-dirs -o ./allure-results/history/retry-trend.json https://m-pujic-levi9-com.github.io/cypress-cucumber-e2e-tests/allure/history/retry-trend.json | |
| npx allure generate allure-results -o allure-report --clean | |
| - name: Move to Reports Folder | |
| id: move-to-reports-folder | |
| run: | | |
| mv cucumber-html-reports reports/cucumber | |
| mv allure-report reports/allure | |
| shell: bash | |
| - name: Setup Pages | |
| id: setup-pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload Pages Artifact | |
| id: upload-pages-artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: reports/ | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Delete Unnecessary Artifacts | |
| id: delete-unnecessary-artifacts | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: | | |
| allure-results-* | |
| cucumber-messages-* | |
| failOnError: false |