Skip to content

Commit

Permalink
chore: remove measuring due to flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
jschfflr committed Jun 22, 2021
1 parent e3e7fe2 commit 67ee5e1
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions test/emulation.spec.ts
Expand Up @@ -413,29 +413,8 @@ describe('Emulation', () => {
it('should slow down execution', async () => {

This comment has been minimized.

Copy link
@OrKoN

OrKoN Jun 22, 2021

Collaborator

maybe update the test name too

This comment has been minimized.

Copy link
@jschfflr

jschfflr Jun 22, 2021

Author Contributor

Done, thanks!

const { page } = getTestState();

async function measure() {
const start = new Date();
await page.evaluate(() => {
let i = 0;
while (i < 1000) {
i++;
}
});

const end = new Date();
return +end - +start;
}

const baseline = await measure();
await page.emulateCPUThrottling(100);
const throttledTime = await measure();
await page.emulateCPUThrottling(null);
const timeWithoutThrottle = await measure();

// Throttling is not super precise. 20 has been chosen as very loose
// threshold just to make sure that throttling has at least _some_ effect.
expect(throttledTime / baseline).toBeGreaterThan(20);
expect(timeWithoutThrottle / baseline).toBeLessThan(20);
});
});
});

0 comments on commit 67ee5e1

Please sign in to comment.