Skip to content

Hide React panel and show custom messaging during playback (#10372) #20315

Hide React panel and show custom messaging during playback (#10372)

Hide React panel and show custom messaging during playback (#10372) #20315

Workflow file for this run

name: Run test suites
run-name: >-
${{ (github.event.inputs.runId && format('Run test suites - run id {0}', github.event.inputs.runId))
|| (github.event.inputs.linuxBuildFile && format('Run test suites - linux build {0}', github.event.inputs.linuxBuildFile))
|| '' }}
on:
pull_request:
workflow_dispatch:
inputs:
linuxBuildFile:
description: "Linux Chromium Build File (.tar.xz)"
runId:
description: "Test Run ID, chosen by workflow dispatcher, to make it possible to find the correct run from the api"
push:
branches:
- main
env:
RECORD_REPLAY_API_KEY: rwk_yaEG8jo6gcisGHHoMj8SNoOMIHSbT7REuU5E1QnKCiL
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: E2E Tests
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
download-browser:
name: Download Replay browser
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Download
run: wget https://static.replay.io/downloads/macOS-replay-playwright.tar.xz
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: macOS-replay-playwright
path: macOS-replay-playwright.tar.xz
preview-branch:
name: Wait for Vercel Preview Branch
runs-on: ubuntu-latest
steps:
- name: Waiting for 200 from the Vercel Preview
uses: patrickedqvist/[email protected]
id: waitFor200
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 960
check_interval: 60
environment: ${{ fromJSON('["", "production"]')[github.ref == 'refs/heads/main'] }}
outputs:
url: ${{ steps.waitFor200.outputs.url }}
generate-test-run-id:
name: Generate Test Run ID
runs-on: ubuntu-latest
steps:
- run: yarn add uuid
shell: sh
- uses: actions/github-script@v6
id: uuid
with:
result-encoding: string
script: return require("uuid").v4()
outputs:
testRunId: ${{ steps.uuid.outputs.result }}
e2etest:
name: End-to-end tests (${{ matrix.shard }})
runs-on: ubuntu-latest
needs: [preview-branch, generate-test-run-id]
strategy:
# GH cancels other matrixed jobs by default if one fails. We want all E2E jobs to complete.
fail-fast: false
matrix:
shard: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "16"
# Get the yarn cache path.
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "{dir}={$(yarn config get cacheFolder)}" >> $GITHUB_OUTPUT
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: "yarn-cache-folder-"
# Actually install packages with Yarn
- name: Install packages
run: yarn install
env:
YARN_CHECKSUM_BEHAVIOR: "update"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- name: Install Replay Playwright
run: npx @replayio/playwright install
env:
RECORD_REPLAY_CHROMIUM_DOWNLOAD_FILE: ${{ github.event.inputs.linuxBuildFile }}
- name: Run Playwright
run: npx playwright test --shard ${{ matrix.shard }}/10 tests/*.ts --project replay-chromium
working-directory: ./packages/e2e-tests
env:
REPLAY_PLAYWRIGHT_FIXTURE: 1
RECORD_REPLAY_TEST_RUN_ID: ${{ needs.generate-test-run-id.outputs.testRunId }}
PLAYWRIGHT_TEST_BASE_URL: ${{ needs.preview-branch.outputs.url }}
INPUT_STRIPE: ${{ matrix.shard }}/10
SHARD_NUMBER: ${{ matrix.shard }}
RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}
RECORD_REPLAY_TEST_METRICS: 1
AUTOMATED_TEST_SECRET: ${{ secrets.AUTOMATED_TEST_SECRET }}
AUTHENTICATED_TESTS_WORKSPACE_API_KEY: ${{ secrets.AUTHENTICATED_TESTS_WORKSPACE_API_KEY }}
GOLDEN_TEST_RUN_WORKSPACE_API_KEY: ${{ secrets.GOLDEN_TEST_RUN_WORKSPACE_API_KEY }}
- name: Archive Playwright report results with code coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: all-code-coverage-reports_${{ matrix.shard }}
path: packages/e2e-tests/test-results
retention-days: 3
- uses: replayio/[email protected]
if: always()
with:
api-key: ${{ env.RECORD_REPLAY_API_KEY }}
public: true
authenticated-e2etest:
name: Authenticated end-to-end tests (${{ matrix.shard }})
runs-on: ubuntu-latest
needs: [preview-branch, generate-test-run-id]
strategy:
# GH cancels other matrixed jobs by default if one fails. We want all E2E jobs to complete.
fail-fast: false
matrix:
shard: ["1"]
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "16"
# Get the yarn cache path.
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "{dir}={$(yarn config get cacheFolder)}" >> $GITHUB_OUTPUT
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: "yarn-cache-folder-"
# Actually install packages with Yarn
- name: Install packages
run: yarn install
env:
YARN_CHECKSUM_BEHAVIOR: "update"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- name: Install Replay Playwright
run: npx @replayio/playwright install
- name: Run Playwright
run: npx playwright test --shard ${{ matrix.shard }}/1 authenticated/ test-suite-dashboard/ --project replay-chromium
working-directory: ./packages/e2e-tests
env:
REPLAY_PLAYWRIGHT_FIXTURE: 1
RECORD_REPLAY_TEST_RUN_ID: ${{ needs.generate-test-run-id.outputs.testRunId }}
PLAYWRIGHT_TEST_BASE_URL: ${{ needs.preview-branch.outputs.url }}
INPUT_STRIPE: ${{ matrix.shard }}/1
RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}
RECORD_REPLAY_TEST_METRICS: 1
AUTOMATED_TEST_SECRET: ${{ secrets.AUTOMATED_TEST_SECRET }}
AUTHENTICATED_TESTS_WORKSPACE_API_KEY: ${{ secrets.AUTHENTICATED_TESTS_WORKSPACE_API_KEY }}
GOLDEN_TEST_RUN_WORKSPACE_API_KEY: ${{ secrets.GOLDEN_TEST_RUN_WORKSPACE_API_KEY }}
- name: Archive Playwright report results with code coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: all-code-coverage-reports_auth
path: packages/e2e-tests/test-results
retention-days: 3
- uses: replayio/[email protected]
if: always()
with:
api-key: ${{ env.RECORD_REPLAY_API_KEY }}
public: true
unit-test:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "16"
# Get the yarn cache path.
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "{dir}={$(yarn config get cacheFolder)}" >> $GITHUB_OUTPUT
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: "yarn-cache-folder-"
# Actually install packages with Yarn
- name: Install packages
run: yarn install
env:
YARN_CHECKSUM_BEHAVIOR: "update"
- name: Run tests
run: yarn test