Skip to content

Commit e99dbc9

Browse files
committed
improve test
1 parent 3071ef7 commit e99dbc9

File tree

1 file changed

+15
-6
lines changed
  • dev-packages/browser-integration-tests/suites/public-api/diagnoseSdkConnectivity

1 file changed

+15
-6
lines changed

dev-packages/browser-integration-tests/suites/public-api/diagnoseSdkConnectivity/test.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ sentryTest('makes a call to sentry.io to diagnose SDK connectivity', async ({ ge
1717
});
1818
});
1919

20-
let diagnoseMessage: string | undefined;
21-
page.on('console', msg => {
22-
if (msg.text().includes('SDK connectivity:')) {
23-
diagnoseMessage = msg.text();
24-
}
20+
const diagnoseMessagePromise = new Promise<string>(resolve => {
21+
page.on('console', msg => {
22+
if (msg.text().includes('SDK connectivity:')) {
23+
resolve(msg.text());
24+
}
25+
});
2526
});
2627

2728
const url = await getLocalTestUrl({ testDir: __dirname });
@@ -30,9 +31,17 @@ sentryTest('makes a call to sentry.io to diagnose SDK connectivity', async ({ ge
3031
const pageLoadEvent = envelopeRequestParser(await pageloadRequestPromise);
3132

3233
// udnefined is expected and means the request was successful
33-
expect(diagnoseMessage).toEqual('SDK connectivity: undefined');
34+
expect(await diagnoseMessagePromise).toEqual('SDK connectivity: undefined');
3435

3536
// the request to sentry.io should not be traced, hence no http.client span should be sent.
3637
const httpClientSpans = pageLoadEvent.spans?.filter(s => s.op === 'http.client');
3738
expect(httpClientSpans).toHaveLength(0);
39+
40+
// no fetch breadcrumb should be sent (only breadcrumb for the console log)
41+
expect(pageLoadEvent.breadcrumbs).toEqual([
42+
expect.objectContaining({
43+
category: 'console',
44+
message: 'SDK connectivity: undefined',
45+
}),
46+
]);
3847
});

0 commit comments

Comments
 (0)