Skip to content

Commit e0364f3

Browse files
authored
Merge branch 'develop' into cg/fix-slow-test
2 parents 79bec2c + 90f958f commit e0364f3

File tree

48 files changed

+1091
-70
lines changed

Some content is hidden

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

48 files changed

+1091
-70
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,8 @@ jobs:
795795
# - The build job was successful, not skipped
796796
# - AND if the profiling node bindings were either successful or skipped
797797
if: |
798-
always() && needs.job_build.result == 'success' &&
798+
always() &&
799+
needs.job_build.result == 'success' &&
799800
(needs.job_compile_bindings_profiling_node.result == 'success' || needs.job_compile_bindings_profiling_node.result == 'skipped')
800801
needs: [job_get_metadata, job_build, job_compile_bindings_profiling_node]
801802
runs-on: ubuntu-20.04-large-js
@@ -981,13 +982,16 @@ jobs:
981982
directory: dev-packages/e2e-tests
982983
token: ${{ secrets.CODECOV_TOKEN }}
983984

985+
# - We skip optional tests on release branches
984986
job_optional_e2e_tests:
985987
name: E2E ${{ matrix.label || matrix.test-application }} Test
986988
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks
987989
# We need to add the `always()` check here because the previous step has this as well :(
988990
# See: https://github.com/actions/runner/issues/2205
989991
if:
990-
always() && needs.job_e2e_prepare.result == 'success' &&
992+
always() &&
993+
needs.job_get_metadata.outputs.is_release != 'true' &&
994+
needs.job_e2e_prepare.result == 'success' &&
991995
needs.job_e2e_prepare.outputs.matrix-optional != '{"include":[]}' &&
992996
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
993997
github.actor != 'dependabot[bot]'

dev-packages/browser-integration-tests/suites/feedback/attachTo/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sentryTest('should capture feedback with custom button', async ({ getLocalTestUr
2323
}
2424
});
2525

26-
const url = await getLocalTestUrl({ testDir: __dirname });
26+
const url = await getLocalTestUrl({ testDir: __dirname, handleLazyLoadedFeedback: true });
2727

2828
await page.goto(url);
2929
await page.locator('#custom-feedback-button').click();

dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sentryTest('should capture feedback', async ({ getLocalTestUrl, page }) => {
2323
}
2424
});
2525

26-
const url = await getLocalTestUrl({ testDir: __dirname });
26+
const url = await getLocalTestUrl({ testDir: __dirname, handleLazyLoadedFeedback: true });
2727

2828
await page.goto(url);
2929
await page.getByText('Report a Bug').click();

dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ sentryTest('should capture feedback', async ({ forceFlushReplay, getLocalTestUrl
3131
}
3232
});
3333

34-
const url = await getLocalTestUrl({ testDir: __dirname });
34+
const url = await getLocalTestUrl({ testDir: __dirname, handleLazyLoadedFeedback: true });
3535

3636
await Promise.all([page.goto(url), page.getByText('Report a Bug').click(), reqPromise0]);
3737

dev-packages/browser-integration-tests/suites/feedback/captureFeedbackCsp/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sentryTest('should capture feedback', async ({ getLocalTestUrl, page }) => {
2323
}
2424
});
2525

26-
const url = await getLocalTestUrl({ testDir: __dirname });
26+
const url = await getLocalTestUrl({ testDir: __dirname, handleLazyLoadedFeedback: true });
2727

2828
await page.goto(url);
2929
await page.getByText('Report a Bug').click();

dev-packages/browser-integration-tests/suites/integrations/lazyLoad/feedbackIntegration/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { sentryTest } from '../../../../utils/fixtures';
55

66
sentryTest('it allows to lazy load the feedback integration', async ({ getLocalTestUrl, page }) => {
77
const bundle = process.env.PW_BUNDLE || '';
8-
const url = await getLocalTestUrl({ testDir: __dirname });
8+
const url = await getLocalTestUrl({ testDir: __dirname, handleLazyLoadedFeedback: true });
99

1010
await page.route(`https://browser.sentry-cdn.com/${SDK_VERSION}/feedback.min.js`, route => {
1111
return route.fulfill({

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/template.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
<body>
77
<div id="content"></div>
88
<img src="https://example.com/my/image.png" />
9-
<button type="button">Test button</button>
109
</body>
1110
</html>

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/test.ts

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ import type { Event } from '@sentry/types';
55
import { sentryTest } from '../../../../utils/fixtures';
66
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
77

8-
sentryTest('should capture a LCP vital with element details.', async ({ browserName, getLocalTestUrl, page }) => {
8+
/*
9+
Because we "serve" the html test page as a static file, all requests for the image
10+
are considered 3rd party requests. So the LCP value we obtain for the image is also
11+
considered a 3rd party LCP value, meaning `renderTime` is only set if we also
12+
return the `Timing-Allow-Origin` header.
13+
*/
14+
15+
sentryTest('captures LCP vitals with element details.', async ({ browserName, getLocalTestUrl, page }) => {
916
if (shouldSkipTracingTest() || browserName !== 'chromium') {
1017
sentryTest.skip();
1118
}
@@ -16,17 +23,50 @@ sentryTest('should capture a LCP vital with element details.', async ({ browserN
1623
});
1724

1825
const url = await getLocalTestUrl({ testDir: __dirname });
19-
const [eventData] = await Promise.all([
20-
getFirstSentryEnvelopeRequest<Event>(page),
21-
page.goto(url),
22-
page.locator('button').click(),
23-
]);
26+
const [eventData] = await Promise.all([getFirstSentryEnvelopeRequest<Event>(page), page.goto(url)]);
2427

2528
expect(eventData.measurements).toBeDefined();
2629
expect(eventData.measurements?.lcp?.value).toBeDefined();
2730

28-
// XXX: This should be body > img, but it can be flakey as sometimes it will report
29-
// the button as LCP.
3031
expect(eventData.contexts?.trace?.data?.['lcp.element'].startsWith('body >')).toBe(true);
3132
expect(eventData.contexts?.trace?.data?.['lcp.size']).toBeGreaterThan(0);
33+
expect(eventData.contexts?.trace?.data?.['lcp.loadTime']).toBeGreaterThan(0);
34+
35+
// renderTime is 0 because we don't return the `Timing-Allow-Origin` header
36+
// and the image is loaded from a 3rd party origin
37+
expect(eventData.contexts?.trace?.data?.['lcp.renderTime']).toBe(0);
38+
39+
// The LCP value should be the loadTime because the renderTime is not set
40+
expect(eventData.measurements?.lcp?.value).toBeCloseTo(eventData.contexts?.trace?.data?.['lcp.loadTime']);
3241
});
42+
43+
sentryTest(
44+
'captures LCP renderTime when returning Timing-Allow-Origin header.',
45+
async ({ browserName, getLocalTestUrl, page }) => {
46+
if (shouldSkipTracingTest() || browserName !== 'chromium') {
47+
sentryTest.skip();
48+
}
49+
50+
page.route('**', route => route.continue());
51+
page.route('**/my/image.png', async (route: Route) => {
52+
return route.fulfill({
53+
path: `${__dirname}/assets/sentry-logo-600x179.png`,
54+
headers: { 'Timing-Allow-Origin': '*' },
55+
});
56+
});
57+
58+
const url = await getLocalTestUrl({ testDir: __dirname });
59+
const [eventData] = await Promise.all([getFirstSentryEnvelopeRequest<Event>(page), page.goto(url)]);
60+
61+
expect(eventData.measurements).toBeDefined();
62+
expect(eventData.measurements?.lcp?.value).toBeDefined();
63+
64+
expect(eventData.contexts?.trace?.data?.['lcp.element'].startsWith('body >')).toBe(true);
65+
expect(eventData.contexts?.trace?.data?.['lcp.size']).toBeGreaterThan(0);
66+
expect(eventData.contexts?.trace?.data?.['lcp.loadTime']).toBeGreaterThan(0);
67+
expect(eventData.contexts?.trace?.data?.['lcp.renderTime']).toBeGreaterThan(0);
68+
69+
// The LCP value should be the renderTime because the renderTime is set
70+
expect(eventData.measurements?.lcp?.value).toBeCloseTo(eventData.contexts?.trace?.data?.['lcp.renderTime']);
71+
},
72+
);

dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ sentryTest(
316316
sentryTest.skip();
317317
}
318318

319-
const url = await getLocalTestUrl({ testDir: __dirname });
319+
const url = await getLocalTestUrl({ testDir: __dirname, handleLazyLoadedFeedback: true });
320320

321321
// ensure pageload transaction is finished
322322
await getFirstSentryEnvelopeRequest<Event>(page, url);

dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ sentryTest('user feedback event after pageload has pageload traceId in headers',
302302
sentryTest.skip();
303303
}
304304

305-
const url = await getLocalTestUrl({ testDir: __dirname });
305+
const url = await getLocalTestUrl({ testDir: __dirname, handleLazyLoadedFeedback: true });
306306

307307
const pageloadEvent = await getFirstSentryEnvelopeRequest<Event>(page, url);
308308
const pageloadTraceContext = pageloadEvent.contexts?.trace;

0 commit comments

Comments
 (0)