Skip to content

Commit 19ccb19

Browse files
authored
Merge branch 'develop' into aliu/launch-darkly-integration
2 parents d90d346 + a91a5ba commit 19ccb19

File tree

45 files changed

+818
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+818
-217
lines changed

.size-limit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module.exports = [
7979
path: 'packages/browser/build/npm/esm/index.js',
8080
import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'replayCanvasIntegration'),
8181
gzip: true,
82-
limit: '78.1 KB',
82+
limit: '78.2 KB',
8383
},
8484
{
8585
name: '@sentry/browser (incl. Tracing, Replay, Feedback)',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
Sentry.init({
6+
dsn: 'https://[email protected]/1337',
7+
integrations: [
8+
Sentry.browserTracingIntegration({
9+
idleTimeout: 9000,
10+
enableLongTask: false,
11+
enableLongAnimationFrame: true,
12+
instrumentPageLoad: false,
13+
enableInp: false,
14+
}),
15+
],
16+
tracesSampleRate: 1,
17+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function getElapsed(startTime) {
2+
const time = Date.now();
3+
return time - startTime;
4+
}
5+
6+
function handleClick() {
7+
const startTime = Date.now();
8+
while (getElapsed(startTime) < 105) {
9+
//
10+
}
11+
window.history.pushState({}, '', `#myHeading`);
12+
}
13+
14+
const button = document.getElementById('clickme');
15+
16+
console.log('button', button);
17+
18+
button.addEventListener('click', handleClick);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
</head>
6+
<body>
7+
<button id="clickme">
8+
click me to start the long animation!
9+
</button>
10+
11+
<h1 id="myHeading">My Heading</h1>
12+
</body>
13+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
6+
7+
sentryTest(
8+
"doesn't capture long animation frame that starts before a navigation.",
9+
async ({ browserName, getLocalTestPath, page }) => {
10+
// Long animation frames only work on chrome
11+
if (shouldSkipTracingTest() || browserName !== 'chromium') {
12+
sentryTest.skip();
13+
}
14+
15+
const url = await getLocalTestPath({ testDir: __dirname });
16+
17+
await page.goto(url);
18+
19+
const navigationTransactionEventPromise = getFirstSentryEnvelopeRequest<Event>(page);
20+
21+
await page.locator('#clickme').click();
22+
23+
const navigationTransactionEvent = await navigationTransactionEventPromise;
24+
25+
expect(navigationTransactionEvent.contexts?.trace?.op).toBe('navigation');
26+
27+
const loafSpans = navigationTransactionEvent.spans?.filter(s => s.op?.startsWith('ui.long-animation-frame'));
28+
29+
expect(loafSpans?.length).toEqual(0);
30+
},
31+
);

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-before-navigation/init.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ Sentry.init({
1515
}),
1616
],
1717
tracesSampleRate: 1,
18-
debug: true,
1918
});

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-before-navigation/subject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ longTaskButton?.addEventListener('click', () => {
1313
}
1414

1515
// trigger a navigation in the same event loop tick
16-
window.history.pushState({}, '', '/#myHeading');
16+
window.history.pushState({}, '', '#myHeading');
1717
});

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-before-navigation/test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ sentryTest(
1515

1616
await page.goto(url);
1717

18+
const navigationTransactionEventPromise = getFirstSentryEnvelopeRequest<Event>(page);
19+
1820
await page.locator('#myButton').click();
1921

20-
const navigationTransactionEvent = await getFirstSentryEnvelopeRequest<Event>(page, url);
22+
const navigationTransactionEvent = await navigationTransactionEventPromise;
2123

2224
expect(navigationTransactionEvent.contexts?.trace?.op).toBe('navigation');
2325

dev-packages/e2e-tests/test-applications/react-router-6/tests/sse.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ test('Waits for sse streaming when sse has been explicitly aborted', async ({ pa
6666
expect(resolveBodyDuration).toBe(0);
6767

6868
// validate abort error was thrown by inspecting console
69-
const consoleBreadcrumb = rootSpan.breadcrumbs?.find(breadcrumb => breadcrumb.category === 'console');
70-
expect(consoleBreadcrumb?.message).toBe('Could not fetch sse AbortError: BodyStreamBuffer was aborted');
69+
expect(rootSpan.breadcrumbs).toContainEqual(
70+
expect.objectContaining({
71+
category: 'console',
72+
message: 'Could not fetch sse AbortError: BodyStreamBuffer was aborted',
73+
}),
74+
);
7175
});
7276

7377
test('Aborts when stream takes longer than 5s, by not updating the span duration', async ({ page }) => {

dev-packages/e2e-tests/test-applications/react-send-to-sentry/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@types/react-dom": "18.0.0",
1010
"react": "18.2.0",
1111
"react-dom": "18.2.0",
12-
"react-router-dom": "^6.4.1",
12+
"react-router-dom": "6.4.1",
1313
"react-scripts": "5.0.1",
1414
"typescript": "4.9.5"
1515
},

0 commit comments

Comments
 (0)