Skip to content

Commit 03025a7

Browse files
committed
add debug test
1 parent c5e3e7c commit 03025a7

File tree

2 files changed

+42
-0
lines changed
  • packages/browser-integration-tests/suites/public-api/debug

2 files changed

+42
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
Sentry.init({
6+
dsn: 'https://[email protected]/1337',
7+
debug: true,
8+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* eslint-disable no-console */
2+
import type { ConsoleMessage } from '@playwright/test';
3+
import { expect } from '@playwright/test';
4+
5+
import { sentryTest } from '../../../utils/fixtures';
6+
7+
sentryTest('logs debug messages correctly', async ({ getLocalTestUrl, page }) => {
8+
const url = await getLocalTestUrl({ testDir: __dirname });
9+
10+
const consoleMessages: string[] = [];
11+
12+
page.on('console', (msg: ConsoleMessage) => {
13+
consoleMessages.push(msg.text());
14+
});
15+
16+
await page.goto(url);
17+
18+
await page.evaluate(() => console.log('test log'));
19+
20+
expect(consoleMessages).toEqual([
21+
'Sentry Logger [log]: Integration installed: InboundFilters',
22+
'Sentry Logger [log]: Integration installed: FunctionToString',
23+
'Sentry Logger [log]: Integration installed: TryCatch',
24+
'Sentry Logger [log]: Integration installed: Breadcrumbs',
25+
'Sentry Logger [log]: Global Handler attached: onerror',
26+
'Sentry Logger [log]: Global Handler attached: onunhandledrejection',
27+
'Sentry Logger [log]: Integration installed: GlobalHandlers',
28+
'Sentry Logger [log]: Integration installed: LinkedErrors',
29+
'Sentry Logger [log]: Integration installed: Dedupe',
30+
'Sentry Logger [log]: Integration installed: HttpContext',
31+
'Sentry Logger [warn]: Discarded session because of missing or non-string release',
32+
'test log',
33+
]);
34+
});

0 commit comments

Comments
 (0)