From e56b85157e68371aff91d6d8a9c9271dabfa9fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Garapich?= Date: Sat, 3 Aug 2024 11:41:23 +0000 Subject: [PATCH] test(e2e): record video of every browser --- tests/fixtures/auth-users.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/auth-users.ts b/tests/fixtures/auth-users.ts index 40aec188..779da1c5 100644 --- a/tests/fixtures/auth-users.ts +++ b/tests/fixtures/auth-users.ts @@ -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[] @@ -12,7 +13,7 @@ interface AuthUsersFixture { export const authUsers = test.extend({ 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() @@ -25,7 +26,12 @@ export const authUsers = test.extend({ const pages = new Map() 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', })