Skip to content

Commit

Permalink
unflake?
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed May 10, 2023
1 parent 0dd6ed8 commit 194c9c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Expand Up @@ -3,8 +3,8 @@ const head = document.querySelector('head');

const COUNT = 250;

window.__isLoaded = () => {
return window.loaded.length === COUNT * 2;
window.__isLoaded = (run = 1) => {
return window.loaded.length === COUNT * 2 * run;
};

document.querySelector('[data-network]').addEventListener('click', () => {
Expand Down
Expand Up @@ -58,7 +58,7 @@ sentryTest(
},
10_000,
);
const reqPromise1breadcrumbs = waitForReplayRequest(
const reqPromise1Breadcrumbs = waitForReplayRequest(
page,
(_event, res) => {
const { breadcrumbs } = getCustomRecordingEvents(res);
Expand All @@ -75,7 +75,7 @@ sentryTest(
await forceFlushReplay();

const { performanceSpans } = getCustomRecordingEvents(await reqPromise1);
const { breadcrumbs } = getCustomRecordingEvents(await reqPromise1breadcrumbs);
const { breadcrumbs } = getCustomRecordingEvents(await reqPromise1Breadcrumbs);

// All assets have been _loaded_
expect(scriptsLoaded).toBe(COUNT);
Expand All @@ -101,7 +101,7 @@ sentryTest(
},
10_000,
);
const reqPromise2breadcrumbs = waitForReplayRequest(
const reqPromise2Breadcrumbs = waitForReplayRequest(
page,
(_event, res) => {
const { breadcrumbs } = getCustomRecordingEvents(res);
Expand All @@ -114,10 +114,11 @@ sentryTest(
await page.click('[data-network]');
await page.click('[data-fetch]');

await page.waitForFunction('window.__isLoaded(2)');
await forceFlushReplay();

const { performanceSpans: performanceSpans2 } = getCustomRecordingEvents(await reqPromise2);
const { breadcrumbs: breadcrumbs2 } = getCustomRecordingEvents(await reqPromise2breadcrumbs);
const { breadcrumbs: breadcrumbs2 } = getCustomRecordingEvents(await reqPromise2Breadcrumbs);

// All assets have been _loaded_
expect(scriptsLoaded).toBe(COUNT * 2);
Expand Down

0 comments on commit 194c9c9

Please sign in to comment.