Skip to content

Commit d6d02d7

Browse files
committed
Add dedupe tests again.
1 parent b6e78dd commit d6d02d7

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const { test, expect } = require('@playwright/test');
2+
const Sentry = require('@sentry/browser');
3+
4+
const { getSentryEvents } = require('./utils/helpers');
5+
6+
test.describe('Dedupe Integration', () => {
7+
test.beforeEach(async ({ baseURL, page }) => {
8+
await page.goto(baseURL);
9+
});
10+
11+
test(`doesn't drop message event if it has a different message from previous`, async ({ page }) => {
12+
const browserEvents = await getSentryEvents(page, () => {
13+
[0, 1].forEach(idx => {
14+
Sentry.captureMessage(`test_${idx}`);
15+
});
16+
});
17+
18+
expect(browserEvents).toHaveLength(2);
19+
});
20+
21+
test('drops duplicate event if it has the same message as previous', async ({ page }) => {
22+
const browserEvents = await getSentryEvents(page, () => {
23+
[0, 1].forEach(() => {
24+
Sentry.captureMessage('test');
25+
});
26+
});
27+
28+
expect(browserEvents).toHaveLength(1);
29+
});
30+
31+
test(`drops separately thrown exceptions of the same type and message`, async ({ page }) => {
32+
const browserEvents = await getSentryEvents(page, () => {
33+
[0, 1].forEach(() => {
34+
Sentry.captureException(Error('test'));
35+
});
36+
});
37+
38+
expect(browserEvents).toHaveLength(1);
39+
});
40+
41+
test('drops duplicate exception if it has the same fingerprint as previous', async ({ page }) => {
42+
const browserEvents = await getSentryEvents(page, () => {
43+
const testError = Error('test');
44+
45+
[0, 1].forEach(() => {
46+
Sentry.captureException(testError);
47+
});
48+
});
49+
50+
expect(browserEvents).toHaveLength(1);
51+
});
52+
});

0 commit comments

Comments
 (0)