-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
38 lines (28 loc) · 1.19 KB
/
test.ts
File metadata and controls
38 lines (28 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { expect } from '@playwright/test';
import type { Event } from '@sentry/core';
import { sentryTest } from '../../../utils/fixtures';
import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers';
sentryTest('Assigns web worker debug IDs when using webWorkerIntegration', async ({ getLocalTestUrl, page }) => {
const bundle = process.env.PW_BUNDLE;
if (bundle != null && !bundle.includes('esm') && !bundle.includes('cjs')) {
sentryTest.skip();
}
const url = await getLocalTestUrl({ testDir: __dirname });
const errorEventPromise = getFirstSentryEnvelopeRequest<Event>(page, url);
page.route('**/worker.js', route => {
route.fulfill({
path: `${__dirname}/assets/worker.js`,
});
});
const button = page.locator('#errWorker');
await button.click();
const errorEvent = await errorEventPromise;
expect(errorEvent.debug_meta?.images).toBeDefined();
const debugImages = errorEvent.debug_meta?.images || [];
expect(debugImages.length).toBe(1);
debugImages.forEach(image => {
expect(image.type).toBe('sourcemap');
expect(image.debug_id).toEqual('worker-debug-id-789');
expect(image.code_file).toEqual('http://sentry-test.io/worker.js');
});
});