Skip to content

Commit

Permalink
test(e2e): record video of every browser
Browse files Browse the repository at this point in the history
  • Loading branch information
garrappachc committed Aug 3, 2024
1 parent 358fe91 commit e56b851
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/fixtures/auth-users.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, test, type Page } from '@playwright/test'
import jsonwebtoken from 'jsonwebtoken'
import { minutesToMilliseconds } from 'date-fns'
import { join } from 'path'

export interface AuthUsersOptions {
steamIds: string[]
Expand All @@ -12,7 +13,7 @@ interface AuthUsersFixture {

export const authUsers = test.extend<AuthUsersOptions & AuthUsersFixture>({
steamIds: [[], { option: true }],
pages: async ({ steamIds, browser, baseURL }, use) => {
pages: async ({ steamIds, browser, baseURL }, use, testInfo) => {
// opening a new context takes some time
test.setTimeout(minutesToMilliseconds(1))
expect(process.env['AUTH_SECRET']).toBeDefined()
Expand All @@ -25,7 +26,12 @@ export const authUsers = test.extend<AuthUsersOptions & AuthUsersFixture>({
const pages = new Map<string, Page>()
await Promise.all(
steamIds.map(async steamId => {
const context = await browser.newContext()
const context = await browser.newContext({
recordVideo: {
dir: join(testInfo.outputDir, 'videos', steamId),
size: { width: 1280, height: 720 },
},
})
const token = jsonwebtoken.sign({ id: steamId }, process.env['AUTH_SECRET']!, {
expiresIn: '7d',
})
Expand Down

0 comments on commit e56b851

Please sign in to comment.