Skip to content

Integration tests for stage @ 4cfb912bd45d35d55234995dbff515186e423676 #3866

Integration tests for stage @ 4cfb912bd45d35d55234995dbff515186e423676

Integration tests for stage @ 4cfb912bd45d35d55234995dbff515186e423676 #3866

# Workflows that run integration tests on live sites
name: Integration tests
run-name: "Integration tests for ${{ inputs.branch }} @ ${{ inputs.git_sha }}"
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:
if: github.repository == 'mozilla/bedrock'
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: github.repository == 'mozilla/bedrock'
runs-on: ubuntu-latest
env:
BASE_URL: ${{ github.event.inputs.mozorg_service_hostname }}
CI_JOB_ID: ${{ github.run_id }}
LABEL: test-headless
MARK_EXPRESSION: headless
# 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-results
path: results-${{github.run_id}}
if-no-files-found: ignore # this avoids a false "Warning" if there were no issues
playwright-tests:
if: github.repository == 'mozilla/bedrock'
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@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
- 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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() && github.repository == 'mozilla/bedrock'
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"