Skip to content

Commit cac7d82

Browse files
committed
Add integration test for breadcrumbs
1 parent f48b3c7 commit cac7d82

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/template.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
<body>
88
<button id="button1" type="button">Button 1</button>
99
<button id="button2" type="button">Button 2</button>
10+
<button id="annotated-button" type="button" data-component="AnnotatedButton">Button 2</button>
1011
</body>
1112
</html>

packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,35 @@ sentryTest('captures Breadcrumb for clicks & debounces them for a second', async
5757
},
5858
]);
5959
});
60+
61+
sentryTest('prioritizes the annotated component nam', async ({ getLocalTestUrl, page }) => {
62+
const url = await getLocalTestUrl({ testDir: __dirname });
63+
64+
await page.route('**/foo', route => {
65+
return route.fulfill({
66+
status: 200,
67+
body: JSON.stringify({
68+
userNames: ['John', 'Jane'],
69+
}),
70+
headers: {
71+
'Content-Type': 'application/json',
72+
},
73+
});
74+
});
75+
76+
const promise = getFirstSentryEnvelopeRequest<Event>(page);
77+
78+
await page.goto(url);
79+
await page.click('#annotated-button');
80+
await page.evaluate('Sentry.captureException("test exception")');
81+
82+
const eventData = await promise;
83+
84+
expect(eventData.breadcrumbs).toEqual([
85+
{
86+
timestamp: expect.any(Number),
87+
category: 'ui.click',
88+
message: 'AnnotatedButton',
89+
},
90+
]);
91+
});

0 commit comments

Comments
 (0)