Integration tests for stage #3327
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
| # Workflows that run integration tests on live sites | |
| name: Integration tests | |
| run-name: Integration tests for ${{ inputs.branch }} | |
| env: | |
| SLACK_CHANNEL_ID: CBX0KH5GA # #www-notify in MoCo Slack | |
| SLACK_BOT_TOKEN: ${{secrets.SLACK_BOT_TOKEN_FOR_MEAO_NOTIFICATIONS_APP}} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: The branch of mozilla/bedrock to test against - main|stage|prod|run-integration-tests | |
| required: true | |
| git_sha: | |
| description: The git SHA just deployed to the service we want to test | |
| required: true | |
| mozorg_service_hostname: | |
| description: The root URL of the Mozorg service to run tests against | |
| required: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| notify-of-test-run-start: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| sparse-checkout: .github/actions/slack | |
| - name: Notify via Slack that tests are starting | |
| uses: ./.github/actions/slack | |
| with: | |
| env_name: test | |
| label: "Integration tests [${{ inputs.git_sha }}]" | |
| status: info | |
| channel_id: ${{ env.SLACK_CHANNEL_ID }} | |
| slack_bot_token: ${{ env.SLACK_BOT_TOKEN }} | |
| ref: ${{ inputs.branch }} | |
| message: "Integration tests started" | |
| integration-tests: | |
| if: always() | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - LABEL: test-ie-saucelabs | |
| BROWSER_NAME: internet explorer | |
| DRIVER: SauceLabs | |
| MARK_EXPRESSION: smoke | |
| PLATFORM: Windows 10 | |
| PYTEST_PROCESSES: 8 | |
| - LABEL: test-headless | |
| DRIVER: "" | |
| MARK_EXPRESSION: headless | |
| env: | |
| BASE_URL: ${{ github.event.inputs.mozorg_service_hostname }} | |
| BROWSER_NAME: ${{ matrix.BROWSER_NAME }} | |
| CI_JOB_ID: ${{ github.run_id }} | |
| DRIVER: ${{ matrix.DRIVER }} | |
| LABEL: ${{ matrix.LABEL }} | |
| MARK_EXPRESSION: ${{ matrix.MARK_EXPRESSION }} | |
| PLATFORM: ${{ matrix.PLATFORM }} | |
| PYTEST_PROCESSES: ${{ matrix.PYTEST_PROCESSES }} | |
| SAUCELABS_API_KEY: ${{ secrets.SAUCELABS_API_KEY }} | |
| SAUCELABS_USERNAME: ${{ secrets.SAUCELABS_USERNAME }} | |
| # Note we use if: always() below to keep things going, rather than | |
| # continue-on-error, because that approach falsely marks the overall | |
| # test suite as green/passed even if it has some failures. | |
| steps: | |
| - name: Fetch codebase | |
| if: always() | |
| uses: actions/checkout@v5 | |
| - name: Sets specific env vars IF testing against dev/main only | |
| if: ${{ github.event.inputs.branch == 'main'}} | |
| run: | | |
| echo "BOUNCER_URL=https://bouncer-bouncer.stage.mozaws.net/" >> $GITHUB_ENV | |
| - name: Run functional integration tests | |
| if: always() | |
| run: ./bin/integration_tests/functional_tests.sh | |
| env: | |
| TEST_IMAGE: mozmeao/bedrock_test:${{ github.event.inputs.git_sha }} | |
| - name: Cleanup after functional integration tests | |
| if: always() | |
| run: ./bin/integration_tests/cleanup_after_functional_tests.sh | |
| - name: Store artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: results-${{github.run_id}}-${{matrix.label}} | |
| if-no-files-found: ignore # this avoids a false "Warning" if there were no issues | |
| playwright-tests: | |
| if: always() | |
| runs-on: ubuntu-latest | |
| env: | |
| PLAYWRIGHT_BASE_URL: ${{ github.event.inputs.mozorg_service_hostname }} | |
| CI: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: cd tests/playwright && npm ci && npm run install-deps | |
| - name: Run Playwright tests | |
| run: cd tests/playwright && npm run integration-tests | |
| - uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: test-results-${{ github.event.inputs.git_sha }}-${{ github.run_id }} | |
| path: tests/playwright/test-results/ | |
| if-no-files-found: ignore # this avoids a false "Warning" if there were no issues | |
| retention-days: 30 | |
| notify-of-test-run-completion: | |
| if: always() | |
| runs-on: ubuntu-latest | |
| needs: [integration-tests, playwright-tests] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| sparse-checkout: .github/actions/slack | |
| - name: Notify via Slack of test-run success | |
| if: ${{ needs.integration-tests.result == 'success' && needs.playwright-tests.result == 'success' }} | |
| uses: ./.github/actions/slack | |
| with: | |
| env_name: test | |
| label: "Integration tests [${{ inputs.git_sha }}]" | |
| status: "success" | |
| channel_id: ${{ env.SLACK_CHANNEL_ID }} | |
| slack_bot_token: ${{ env.SLACK_BOT_TOKEN }} | |
| ref: ${{ inputs.branch }} | |
| message: "Integration tests completed. Status: success" | |
| - name: Notify via Slack of test-run failure | |
| if: ${{ needs.integration-tests.result == 'failure' || needs.playwright-tests.result == 'failure' }} | |
| uses: ./.github/actions/slack | |
| with: | |
| env_name: test | |
| label: "Integration tests [${{ inputs.git_sha }}]" | |
| status: "failure" | |
| channel_id: ${{ env.SLACK_CHANNEL_ID }} | |
| slack_bot_token: ${{ env.SLACK_BOT_TOKEN }} | |
| ref: ${{ inputs.branch }} | |
| message: "Integration tests completed. Status: failure" | |
| - name: Notify via Slack of test-run cancelled | |
| if: ${{ needs.integration-tests.result == 'cancelled' || needs.playwright-tests.result == 'cancelled' }} | |
| uses: ./.github/actions/slack | |
| with: | |
| env_name: test | |
| label: "Integration tests [${{ inputs.git_sha }}]" | |
| status: "cancelled" | |
| channel_id: ${{ env.SLACK_CHANNEL_ID }} | |
| slack_bot_token: ${{ env.SLACK_BOT_TOKEN }} | |
| ref: ${{ inputs.branch }} | |
| message: "Integration tests completed. Status: cancelled" |