Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(efps): allow recording video in efps suite #7606

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/efps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
required: true
type: boolean
default: false
record_video:
description: "Record video"
required: true
type: boolean
default: false

jobs:
efps:
Expand Down Expand Up @@ -78,6 +83,7 @@ jobs:
PERF_EFPS_SANITY_TOKEN: ${{ secrets.PERF_EFPS_SANITY_TOKEN }}
REFERENCE_TAG: ${{ github.event.inputs.reference_tag || 'latest' }}
ENABLE_PROFILER: ${{ github.event.inputs.enable_profiler || false }}
RECORD_VIDEO: ${{ github.event.inputs.record_video || false }}
run: pnpm efps:test

- name: PR comment with report
Expand Down
4 changes: 4 additions & 0 deletions perf/efps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const HEADLESS = true
const ENABLE_PROFILER = process.env.ENABLE_PROFILER === 'true'
// eslint-disable-next-line turbo/no-undeclared-env-vars
const REFERENCE_TAG = process.env.REFERENCE_TAG || 'latest'
// eslint-disable-next-line turbo/no-undeclared-env-vars
const RECORD_VIDEO = process.env.RECORD_VIDEO === 'true'
const TESTS = [article, recipe, synthetic]

const projectId = process.env.VITE_PERF_EFPS_PROJECT_ID!
Expand Down Expand Up @@ -169,6 +171,7 @@ async function runAbTest(test: EfpsTest) {
resultsDir,
client,
headless: HEADLESS,
recordVideo: RECORD_VIDEO,
enableProfiler: ENABLE_PROFILER,
projectId,
sanityPkgPath: referenceSanityPkgPath,
Expand All @@ -189,6 +192,7 @@ async function runAbTest(test: EfpsTest) {
resultsDir,
client,
headless: HEADLESS,
recordVideo: RECORD_VIDEO,
enableProfiler: ENABLE_PROFILER,
projectId,
sanityPkgPath: experimentSanityPkgPath,
Expand Down
27 changes: 15 additions & 12 deletions perf/efps/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,29 @@ import {type EfpsResult, type EfpsTest, type EfpsTestRunnerContext} from './type
const workspaceDir = path.dirname(fileURLToPath(import.meta.url))

interface RunTestOptions {
test: EfpsTest
resultsDir: string
projectId: string
headless: boolean
client: SanityClient
sanityPkgPath: string
key: string
enableProfiler: boolean
headless: boolean
key: string
log: (text: string) => void
projectId: string
recordVideo: boolean
resultsDir: string
sanityPkgPath: string
test: EfpsTest
}

export async function runTest({
test,
resultsDir,
projectId,
headless,
client,
sanityPkgPath,
key,
enableProfiler,
headless,
key,
log,
projectId,
recordVideo,
resultsDir,
sanityPkgPath,
test,
}: RunTestOptions): Promise<EfpsResult[]> {
const outDir = path.join(workspaceDir, 'builds', test.name, key)
const testResultsDir = path.join(resultsDir, test.name, key)
Expand Down Expand Up @@ -75,6 +77,7 @@ export async function runTest({
log('Launching browser…')
browser = await chromium.launch({headless})
context = await browser.newContext({
recordVideo: recordVideo ? {dir: testResultsDir} : undefined,
storageState: {
cookies: [],
origins: [
Expand Down
Loading