Skip to content

Commit 1450873

Browse files
committed
go to background instead of click
1 parent 4f793d7 commit 1450873

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

packages/integration-tests/suites/replay/customEvents/init.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { Replay } from '@sentry/replay';
33

44
window.Sentry = Sentry;
55
window.Replay = new Replay({
6-
flushMinDelay: 200,
7-
flushMaxDelay: 200,
6+
flushMinDelay: 500,
7+
flushMaxDelay: 500,
88
useCompression: false,
99
});
1010

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
document.getElementById('go-background').addEventListener('click', () => {
2+
Object.defineProperty(document, 'hidden', { value: true, writable: true });
3+
const ev = document.createEvent('Event');
4+
ev.initEvent('visibilitychange');
5+
document.dispatchEvent(ev);
6+
});

packages/integration-tests/suites/replay/customEvents/template.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<button onclick="console.log('Test log')">Click me</button>
7+
<!-- <button id=""onclick="console.log('Test log')">Click me</button> -->
8+
<button id="go-background">New Tab</button>
89
</body>
910
</html>

packages/integration-tests/suites/replay/customEvents/test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ sentryTest('replay recording should contain default performance spans', async ({
4343

4444
expect(replayEvent1).toEqual(getExpectedReplayEvent({ segment_id: 1, urls: [], replay_start_timestamp: undefined }));
4545

46+
// We can't guarantee the order of the performance spans, or in which of the two segments they are sent
47+
// So we collect them all and check that they are all there
4648
const collectedPerformanceSpans = [...performanceSpans0, ...performanceSpans1];
4749

48-
expect(collectedPerformanceSpans.length).toBe(6);
4950
expect(collectedPerformanceSpans).toEqual(
5051
expect.arrayContaining([
5152
expectedNavigationPerformanceSpan,

0 commit comments

Comments
 (0)