Skip to content

Commit 1269102

Browse files
committed
remove clickBreadcrumbs, use existing customEvents, skip some flakey tests on firefox
1 parent 8e38516 commit 1269102

File tree

7 files changed

+89
-158
lines changed

7 files changed

+89
-158
lines changed

packages/browser-integration-tests/suites/replay/clickBreadcrumbs/init.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/browser-integration-tests/suites/replay/clickBreadcrumbs/template.html

Lines changed: 0 additions & 17 deletions
This file was deleted.

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

Lines changed: 0 additions & 105 deletions
This file was deleted.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ window.Replay = new Sentry.Replay({
55
flushMinDelay: 500,
66
flushMaxDelay: 500,
77
useCompression: false,
8+
blockAllMedia: false,
89
});
910

1011
Sentry.init({

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<button id="go-background">New Tab</button>
7+
<div role="button" id="error" class="btn btn-error" aria-label="An Error">An Error</div>
8+
<button>
9+
<img id="img"
10+
alt="Alt Text"
11+
/>
12+
</button>
13+
<button class="sentry-unmask" aria-label="Unmasked label">
14+
Unmasked
15+
</button>
816
</body>
917
</html>

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

Lines changed: 76 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { PerformanceSpan } from '../../../utils/replayHelpers';
1414
import {
1515
getCustomRecordingEvents,
1616
getReplayEvent,
17+
getReplayRecordingContent,
1718
shouldSkipReplayTest,
1819
waitForReplayRequest,
1920
} from '../../../utils/replayHelpers';
@@ -81,8 +82,9 @@ sentryTest(
8182

8283
sentryTest(
8384
'replay recording should contain a click breadcrumb when a button is clicked',
84-
async ({ getLocalTestPath, page }) => {
85-
if (shouldSkipReplayTest()) {
85+
async ({ forceFlushReplay, getLocalTestPath, page, browserName }) => {
86+
// TODO(replay): This is flakey on firefox and webkit where clicks are flakey
87+
if (shouldSkipReplayTest() || ['firefox', 'webkit'].includes(browserName)) {
8688
sentryTest.skip();
8789
}
8890

@@ -100,21 +102,80 @@ sentryTest(
100102
const url = await getLocalTestPath({ testDir: __dirname });
101103

102104
await page.goto(url);
103-
const replayEvent0 = getReplayEvent(await reqPromise0);
104-
const { breadcrumbs: breadcrumbs0 } = getCustomRecordingEvents(await reqPromise0);
105-
106-
expect(replayEvent0).toEqual(getExpectedReplayEvent({ segment_id: 0 }));
107-
expect(breadcrumbs0.length).toEqual(0);
108-
109-
await page.click('button');
110-
111-
const replayEvent1 = getReplayEvent(await reqPromise1);
112-
const { breadcrumbs: breadcrumbs1 } = getCustomRecordingEvents(await reqPromise1);
105+
await reqPromise0;
106+
107+
await page.click('#error');
108+
await page.click('#img');
109+
await page.click('.sentry-unmask');
110+
await forceFlushReplay();
111+
const req1 = await reqPromise1;
112+
const content1 = getReplayRecordingContent(req1);
113+
expect(content1.breadcrumbs).toEqual(
114+
expect.arrayContaining([
115+
{
116+
...expectedClickBreadcrumb,
117+
message: 'body > div#error.btn.btn-error[aria-label="An Error"]',
118+
data: {
119+
nodeId: expect.any(Number),
120+
node: {
121+
attributes: {
122+
'aria-label': '** *****',
123+
class: 'btn btn-error',
124+
id: 'error',
125+
role: 'button',
126+
},
127+
id: expect.any(Number),
128+
tagName: 'div',
129+
textContent: '** *****',
130+
},
131+
},
132+
},
133+
]),
134+
);
113135

114-
expect(replayEvent1).toEqual(
115-
getExpectedReplayEvent({ segment_id: 1, urls: [], replay_start_timestamp: undefined }),
136+
expect(content1.breadcrumbs).toEqual(
137+
expect.arrayContaining([
138+
{
139+
...expectedClickBreadcrumb,
140+
message: 'body > button > img#img[alt="Alt Text"]',
141+
data: {
142+
nodeId: expect.any(Number),
143+
node: {
144+
attributes: {
145+
alt: 'Alt Text',
146+
id: 'img',
147+
},
148+
id: expect.any(Number),
149+
tagName: 'img',
150+
textContent: '',
151+
},
152+
},
153+
},
154+
]),
116155
);
117156

118-
expect(breadcrumbs1).toEqual([expectedClickBreadcrumb]);
157+
expect(content1.breadcrumbs).toEqual(
158+
expect.arrayContaining([
159+
{
160+
...expectedClickBreadcrumb,
161+
message: 'body > button.sentry-unmask[aria-label="Unmasked label"]',
162+
data: {
163+
nodeId: expect.any(Number),
164+
node: {
165+
attributes: {
166+
// TODO(rrweb): This is a bug in our rrweb fork!
167+
// This attribute should be unmasked.
168+
// 'aria-label': 'Unmasked label',
169+
'aria-label': '******** *****',
170+
class: 'sentry-unmask',
171+
},
172+
id: expect.any(Number),
173+
tagName: 'button',
174+
textContent: 'Unmasked',
175+
},
176+
},
177+
},
178+
]),
179+
);
119180
},
120181
);

packages/browser-integration-tests/suites/replay/errors/errorsInSession/test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import {
1212

1313
sentryTest(
1414
'[session-mode] replay event should contain an error id of an error that occurred during session recording',
15-
async ({ getLocalTestPath, page }) => {
16-
if (shouldSkipReplayTest()) {
15+
async ({ getLocalTestPath, page, browserName }) => {
16+
// TODO(replay): This is flakey on firefox where clicks are flakey
17+
if (shouldSkipReplayTest() || ['firefox'].includes(browserName)) {
1718
sentryTest.skip();
1819
}
1920

0 commit comments

Comments
 (0)