Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize playwright
Browse files Browse the repository at this point in the history
brachkow committed Sep 25, 2024

Verified

This commit was signed with the committer’s verified signature.
electrovir electrovir
1 parent e9657cd commit c602848
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tests/regression.test.ts
Original file line number Diff line number Diff line change
@@ -110,16 +110,21 @@ describe('visual regression test for', () => {
});
});

beforeEach(async () => {
beforeAll(async () => {
browser = await playwright.chromium.launch();
});

afterAll(async () => {
await browser.close();
});

beforeEach(async () => {
page = await browser.newPage();
});

const goto = (route: string) => {
return page.goto(`http://localhost:3000${route}`, {
waitUntil: 'networkidle',
});
};
afterEach(async () => {
await page.close();
});

let testIndex = 0;

@@ -128,7 +133,10 @@ describe('visual regression test for', () => {
async (name, route, action, width, height, colorScheme) => {
console.log(`Running test ${++testIndex} of ${tests.length}: ${name}`);
await page.setViewportSize({ width, height });
await goto(route);

await page.goto(`http://localhost:3000${route}`, {
waitUntil: 'networkidle',
});

if (colorScheme === 'dark') {
await page.evaluate(() => {

0 comments on commit c602848

Please sign in to comment.