Skip to content

Commit 123c84b

Browse files
committed
fix formatting
1 parent 888d88f commit 123c84b

File tree

3 files changed

+82
-88
lines changed
  • dev-packages/browser-integration-tests/suites/tracing

3 files changed

+82
-88
lines changed

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/meta/test.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,23 @@ import {
88
shouldSkipTracingTest,
99
} from '../../../../utils/helpers';
1010

11-
sentryTest(
12-
'should create a pageload transaction based on `sentry-trace` <meta>',
13-
async ({ getLocalTestUrl, page }) => {
14-
if (shouldSkipTracingTest()) {
15-
sentryTest.skip();
16-
}
11+
sentryTest('should create a pageload transaction based on `sentry-trace` <meta>', async ({ getLocalTestUrl, page }) => {
12+
if (shouldSkipTracingTest()) {
13+
sentryTest.skip();
14+
}
1715

18-
const url = await getLocalTestUrl({ testDir: __dirname });
16+
const url = await getLocalTestUrl({ testDir: __dirname });
1917

20-
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
18+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
2119

22-
expect(eventData.contexts?.trace).toMatchObject({
23-
op: 'pageload',
24-
parent_span_id: '1121201211212012',
25-
trace_id: '12312012123120121231201212312012',
26-
});
20+
expect(eventData.contexts?.trace).toMatchObject({
21+
op: 'pageload',
22+
parent_span_id: '1121201211212012',
23+
trace_id: '12312012123120121231201212312012',
24+
});
2725

28-
expect(eventData.spans?.length).toBeGreaterThan(0);
29-
},
30-
);
26+
expect(eventData.spans?.length).toBeGreaterThan(0);
27+
});
3128

3229
sentryTest(
3330
'should pick up `baggage` <meta> tag, propagate the content in transaction and not add own data',

dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts

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

8-
sentryTest('should add resource spans to pageload transaction', async ({ getLocalTestUrl, page, browser }) => {
8+
sentryTest('should add resource spans to pageload transaction', async ({ getLocalTestUrl, page }) => {
99
if (shouldSkipTracingTest()) {
1010
sentryTest.skip();
1111
}

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

Lines changed: 68 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -9,88 +9,85 @@ import {
99
shouldSkipTracingTest,
1010
} from '../../../../utils/helpers';
1111

12-
sentryTest(
13-
'should capture an INP click event span during pageload',
14-
async ({ browserName, getLocalTestUrl, page }) => {
15-
const supportedBrowsers = ['chromium'];
12+
sentryTest('should capture an INP click event span during pageload', async ({ browserName, getLocalTestUrl, page }) => {
13+
const supportedBrowsers = ['chromium'];
1614

17-
if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) {
18-
sentryTest.skip();
19-
}
15+
if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) {
16+
sentryTest.skip();
17+
}
2018

21-
const url = await getLocalTestUrl({ testDir: __dirname });
19+
const url = await getLocalTestUrl({ testDir: __dirname });
2220

23-
await page.goto(url);
21+
await page.goto(url);
2422

25-
const spanEnvelopePromise = getMultipleSentryEnvelopeRequests<SpanEnvelope>(
26-
page,
27-
1,
28-
{ envelopeType: 'span' },
29-
properFullEnvelopeRequestParser,
30-
);
23+
const spanEnvelopePromise = getMultipleSentryEnvelopeRequests<SpanEnvelope>(
24+
page,
25+
1,
26+
{ envelopeType: 'span' },
27+
properFullEnvelopeRequestParser,
28+
);
3129

32-
await page.locator('[data-test-id=normal-button]').click();
33-
await page.locator('.clicked[data-test-id=normal-button]').isVisible();
30+
await page.locator('[data-test-id=normal-button]').click();
31+
await page.locator('.clicked[data-test-id=normal-button]').isVisible();
3432

35-
await page.waitForTimeout(500);
33+
await page.waitForTimeout(500);
3634

37-
// Page hide to trigger INP
38-
await page.evaluate(() => {
39-
window.dispatchEvent(new Event('pagehide'));
40-
});
35+
// Page hide to trigger INP
36+
await page.evaluate(() => {
37+
window.dispatchEvent(new Event('pagehide'));
38+
});
4139

42-
// Get the INP span envelope
43-
const spanEnvelope = (await spanEnvelopePromise)[0];
44-
45-
const spanEnvelopeHeaders = spanEnvelope[0];
46-
const spanEnvelopeItem = spanEnvelope[1][0][1];
47-
48-
const traceId = spanEnvelopeHeaders.trace!.trace_id;
49-
expect(traceId).toMatch(/[a-f0-9]{32}/);
50-
51-
expect(spanEnvelopeHeaders).toEqual({
52-
sent_at: expect.any(String),
53-
trace: {
54-
environment: 'production',
55-
public_key: 'public',
56-
sample_rate: '1',
57-
sampled: 'true',
58-
trace_id: traceId,
59-
// no transaction, because span source is URL
60-
},
61-
});
40+
// Get the INP span envelope
41+
const spanEnvelope = (await spanEnvelopePromise)[0];
6242

63-
const inpValue = spanEnvelopeItem.measurements?.inp.value;
64-
expect(inpValue).toBeGreaterThan(0);
43+
const spanEnvelopeHeaders = spanEnvelope[0];
44+
const spanEnvelopeItem = spanEnvelope[1][0][1];
6545

66-
expect(spanEnvelopeItem).toEqual({
67-
data: {
68-
'sentry.exclusive_time': inpValue,
69-
'sentry.op': 'ui.interaction.click',
70-
'sentry.origin': 'auto.http.browser.inp',
71-
transaction: 'test-url',
72-
'user_agent.original': expect.stringContaining('Chrome'),
73-
},
74-
measurements: {
75-
inp: {
76-
unit: 'millisecond',
77-
value: inpValue,
78-
},
79-
},
80-
description: 'body > NormalButton',
81-
exclusive_time: inpValue,
82-
op: 'ui.interaction.click',
83-
origin: 'auto.http.browser.inp',
84-
segment_id: expect.not.stringMatching(spanEnvelopeItem.span_id!),
85-
// Parent is the pageload span
86-
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
87-
span_id: expect.stringMatching(/[a-f0-9]{16}/),
88-
start_timestamp: expect.any(Number),
89-
timestamp: expect.any(Number),
46+
const traceId = spanEnvelopeHeaders.trace!.trace_id;
47+
expect(traceId).toMatch(/[a-f0-9]{32}/);
48+
49+
expect(spanEnvelopeHeaders).toEqual({
50+
sent_at: expect.any(String),
51+
trace: {
52+
environment: 'production',
53+
public_key: 'public',
54+
sample_rate: '1',
55+
sampled: 'true',
9056
trace_id: traceId,
91-
});
92-
},
93-
);
57+
// no transaction, because span source is URL
58+
},
59+
});
60+
61+
const inpValue = spanEnvelopeItem.measurements?.inp.value;
62+
expect(inpValue).toBeGreaterThan(0);
63+
64+
expect(spanEnvelopeItem).toEqual({
65+
data: {
66+
'sentry.exclusive_time': inpValue,
67+
'sentry.op': 'ui.interaction.click',
68+
'sentry.origin': 'auto.http.browser.inp',
69+
transaction: 'test-url',
70+
'user_agent.original': expect.stringContaining('Chrome'),
71+
},
72+
measurements: {
73+
inp: {
74+
unit: 'millisecond',
75+
value: inpValue,
76+
},
77+
},
78+
description: 'body > NormalButton',
79+
exclusive_time: inpValue,
80+
op: 'ui.interaction.click',
81+
origin: 'auto.http.browser.inp',
82+
segment_id: expect.not.stringMatching(spanEnvelopeItem.span_id!),
83+
// Parent is the pageload span
84+
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
85+
span_id: expect.stringMatching(/[a-f0-9]{16}/),
86+
start_timestamp: expect.any(Number),
87+
timestamp: expect.any(Number),
88+
trace_id: traceId,
89+
});
90+
});
9491

9592
sentryTest(
9693
'should choose the slowest interaction click event when INP is triggered.',

0 commit comments

Comments
 (0)