Skip to content

Placeholder NUX for testsuites #18677

Placeholder NUX for testsuites

Placeholder NUX for testsuites #18677

Workflow file for this run

name: Run test suites
on:
pull_request:
workflow_dispatch:
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@v2
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/wait-for-vercel-preview@v1.2.0
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@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "16"
# Get the yarn cache path.
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- 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
- uses: replayio/action-playwright@main
with:
command: npx playwright test --shard ${{ matrix.shard }}/10 --reporter=@replayio/playwright/reporter,line tests/*.ts
working-directory: ./packages/e2e-tests
api-key: ${{ env.RECORD_REPLAY_API_KEY }}
public: true
upload-all: true
project: replay-chromium
env:
REPLAY_PLAYWRIGHT_FIXTURE: 1
RECORD_REPLAY_METADATA_TEST_RUN_ID: ${{ needs.generate-test-run-id.outputs.testRunId }}
PLAYWRIGHT_TEST_BASE_URL: ${{ needs.preview-branch.outputs.url }}
INPUT_STRIPE: ${{ matrix.shard }}/10
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 }}
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@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "16"
# Get the yarn cache path.
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- 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
- uses: replayio/action-playwright@main
with:
command: npx playwright test --shard ${{ matrix.shard }}/1 --reporter=@replayio/playwright/reporter,line authenticated/**/*.ts
working-directory: ./packages/e2e-tests
api-key: ${{ env.RECORD_REPLAY_API_KEY }}
public: true
upload-all: true
project: replay-chromium
env:
REPLAY_PLAYWRIGHT_FIXTURE: 1
RECORD_REPLAY_METADATA_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 }}
e2etest-jail:
name: End-to-end tests - Jail
runs-on: ubuntu-latest
needs: [preview-branch, generate-test-run-id]
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "16"
# Get the yarn cache path.
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- 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
- uses: replayio/action-playwright@main
with:
command: npx playwright test --reporter=@replayio/playwright/reporter,line jail/*.test.ts --project replay-chromium || exit 0
working-directory: ./packages/e2e-tests
api-key: ${{ env.RECORD_REPLAY_API_KEY }}
public: true
upload-all: true
project: replay-chromium
env:
REPLAY_PLAYWRIGHT_FIXTURE: 1
RECORD_REPLAY_METADATA_TEST_RUN_ID: ${{ needs.generate-test-run-id.outputs.testRunId }}
PLAYWRIGHT_TEST_BASE_URL: ${{ needs.preview-branch.outputs.url }}
RECORD_REPLAY_TEST_METRICS: 1
AUTOMATED_TEST_SECRET: ${{ secrets.AUTOMATED_TEST_SECRET }}
AUTHENTICATED_TESTS_WORKSPACE_API_KEY: ${{ secrets.AUTHENTICATED_TESTS_WORKSPACE_API_KEY }}
unit-test:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "16"
# Get the yarn cache path.
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- 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