mirror of
https://github.com/lingble/twenty.git
synced 2025-10-29 11:52:28 +00:00
Continuation of #6644 Now chromium browser is used in workspaces tests instead of firefox and screenshots after each test are properly saved in one folder when run from IDE and from terminal using `yarn test:e2e` command
33 lines
994 B
TypeScript
33 lines
994 B
TypeScript
import { test as base } from '@playwright/test';
|
|
import path from 'path';
|
|
|
|
const date = new Date();
|
|
|
|
export const test = base.extend<{ screenshotHook: void }>({
|
|
screenshotHook: [
|
|
async ({ page, browserName }, use, workerInfo) => {
|
|
// here everything is the same as beforeEach()
|
|
// goto is to go to website as login setup saves the cookies of logged-in user, not the state of browser
|
|
await page.goto('/');
|
|
await use(); // here is the code of test
|
|
// here everything is the same as afterEach()
|
|
// automatic fixture of making screenshot after each test
|
|
await page.screenshot({
|
|
path: path.resolve(
|
|
__dirname,
|
|
'..',
|
|
'..',
|
|
'results',
|
|
'screenshots',
|
|
`${workerInfo.project.name}`,
|
|
browserName,
|
|
`${date.toISOString()}.png`,
|
|
),
|
|
});
|
|
},
|
|
{ auto: true }, // automatic fixture runs with every test
|
|
],
|
|
});
|
|
|
|
export { expect } from '@playwright/test';
|