Skip to content

Commit 48336b1

Browse files
committed
add explicit force flushes
1 parent bab85e3 commit 48336b1

File tree

2 files changed

+6
-2
lines changed
  • packages/browser-integration-tests/suites/replay

2 files changed

+6
-2
lines changed

packages/browser-integration-tests/suites/replay/sessionExpiry/test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
// Session should expire after 2s - keep in sync with init.js
1515
const SESSION_TIMEOUT = 2000;
1616

17-
sentryTest('handles an expired session', async ({ getLocalTestPath, page }) => {
17+
sentryTest('handles an expired session', async ({ forceFlushReplay, getLocalTestPath, page }) => {
1818
if (shouldSkipReplayTest()) {
1919
sentryTest.skip();
2020
}
@@ -47,6 +47,7 @@ sentryTest('handles an expired session', async ({ getLocalTestPath, page }) => {
4747
const reqPromise2 = waitForReplayRequest(page, 0);
4848

4949
await page.click('#button1');
50+
await forceFlushReplay();
5051
const req1 = await reqPromise1;
5152

5253
const replayEvent1 = getReplayEvent(req1);
@@ -58,6 +59,7 @@ sentryTest('handles an expired session', async ({ getLocalTestPath, page }) => {
5859
await new Promise(resolve => setTimeout(resolve, SESSION_TIMEOUT));
5960

6061
await page.click('#button2');
62+
await forceFlushReplay();
6163
const req2 = await reqPromise2;
6264

6365
const replay2 = await getReplaySnapshot(page);

packages/browser-integration-tests/suites/replay/sessionMaxAge/test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const SESSION_MAX_AGE = 4000;
1818
The main difference between this and sessionExpiry test, is that here we wait for the overall time (4s)
1919
in multiple steps (2s, 2s) instead of waiting for the whole time at once (4s).
2020
*/
21-
sentryTest('handles session that exceeds max age', async ({ getLocalTestPath, page }) => {
21+
sentryTest('handles session that exceeds max age', async ({ forceFlushReplay, getLocalTestPath, page }) => {
2222
if (shouldSkipReplayTest()) {
2323
sentryTest.skip();
2424
}
@@ -60,6 +60,7 @@ sentryTest('handles session that exceeds max age', async ({ getLocalTestPath, pa
6060
const timePassed1 = Date.now() - startTimestamp;
6161
await new Promise(resolve => setTimeout(resolve, Math.max(SESSION_MAX_AGE / 2 - timePassed1, 0)));
6262
await page.click('#button1');
63+
await forceFlushReplay();
6364

6465
const req1 = await reqPromise1;
6566
const replayEvent1 = getReplayEvent(req1);
@@ -73,6 +74,7 @@ sentryTest('handles session that exceeds max age', async ({ getLocalTestPath, pa
7374
const timePassed2 = Date.now() - startTimestamp;
7475
await new Promise(resolve => setTimeout(resolve, Math.max(SESSION_MAX_AGE - timePassed2, 0)));
7576
await page.click('#button2');
77+
await forceFlushReplay();
7678

7779
const req2 = await reqPromise2;
7880
const replay2 = await getReplaySnapshot(page);

0 commit comments

Comments
 (0)