Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dev-packages/browser-integration-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module.exports = {
browser: true,
node: true,
},
extends: ['../../.eslintrc.js'],
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
ignorePatterns: [
'suites/**/subject.js',
'suites/**/dist/*',
Expand Down
1 change: 1 addition & 0 deletions dev-packages/browser-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"devDependencies": {
"@types/glob": "8.0.0",
"@types/node": "^18.19.1",
"eslint-plugin-regexp": "^1.15.0",
"glob": "8.0.3"
},
"volta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ sentryTest('allows to setup a client manually & capture exceptions', async ({ ge
},
},
contexts: {
trace: { trace_id: expect.stringMatching(/[a-f0-9]{32}/), span_id: expect.stringMatching(/[a-f0-9]{16}/) },
trace: { trace_id: expect.stringMatching(/[a-f\d]{32}/), span_id: expect.stringMatching(/[a-f\d]{16}/) },
},
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ sentryTest(

// Required profile metadata (Sample Format V2)
expect(typeof envelopeItemPayload1.profiler_id).toBe('string');
expect(envelopeItemPayload1.profiler_id).toMatch(/^[a-f0-9]{32}$/);
expect(envelopeItemPayload1.profiler_id).toMatch(/^[a-f\d]{32}$/);
expect(typeof envelopeItemPayload1.chunk_id).toBe('string');
expect(envelopeItemPayload1.chunk_id).toMatch(/^[a-f0-9]{32}$/);
expect(envelopeItemPayload1.chunk_id).toMatch(/^[a-f\d]{32}$/);
expect(envelopeItemPayload1.client_sdk).toBeDefined();
expect(typeof envelopeItemPayload1.client_sdk.name).toBe('string');
expect(typeof envelopeItemPayload1.client_sdk.version).toBe('string');
Expand Down Expand Up @@ -170,9 +170,9 @@ sentryTest(
// Required profile metadata (Sample Format V2)
// https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/
expect(typeof envelopeItemPayload2.profiler_id).toBe('string');
expect(envelopeItemPayload2.profiler_id).toMatch(/^[a-f0-9]{32}$/);
expect(envelopeItemPayload2.profiler_id).toMatch(/^[a-f\d]{32}$/);
expect(typeof envelopeItemPayload2.chunk_id).toBe('string');
expect(envelopeItemPayload2.chunk_id).toMatch(/^[a-f0-9]{32}$/);
expect(envelopeItemPayload2.chunk_id).toMatch(/^[a-f\d]{32}$/);
expect(envelopeItemPayload2.client_sdk).toBeDefined();
expect(typeof envelopeItemPayload2.client_sdk.name).toBe('string');
expect(typeof envelopeItemPayload2.client_sdk.version).toBe('string');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ sentryTest(
// Required profile metadata (Sample Format V2)
// https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/
expect(typeof envelopeItemPayload.profiler_id).toBe('string');
expect(envelopeItemPayload.profiler_id).toMatch(/^[a-f0-9]{32}$/);
expect(envelopeItemPayload.profiler_id).toMatch(/^[a-f\d]{32}$/);
expect(typeof envelopeItemPayload.chunk_id).toBe('string');
expect(envelopeItemPayload.chunk_id).toMatch(/^[a-f0-9]{32}$/);
expect(envelopeItemPayload.chunk_id).toMatch(/^[a-f\d]{32}$/);
expect(envelopeItemPayload.client_sdk).toBeDefined();
expect(typeof envelopeItemPayload.client_sdk.name).toBe('string');
expect(typeof envelopeItemPayload.client_sdk.version).toBe('string');
Expand Down Expand Up @@ -175,7 +175,7 @@ sentryTest('attaches thread data to child spans (trace mode)', async ({ page, ge
const profilerId = rootSpan?.contexts?.profile?.profiler_id as string | undefined;
expect(typeof profilerId).toBe('string');

expect(profilerId).toMatch(/^[a-f0-9]{32}$/);
expect(profilerId).toMatch(/^[a-f\d]{32}$/);

const spans = (rootSpan?.spans ?? []) as Array<{ data?: Record<string, unknown> }>;
expect(spans.length).toBeGreaterThan(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ sentryTest(
const traceId = transactionEnvelopeHeader.trace!.trace_id!;
const parentSpanId = transactionEnvelopeItem.contexts?.trace?.span_id;

expect(traceId).toMatch(/[a-f0-9]{32}/);
expect(parentSpanId).toMatch(/[a-f0-9]{16}/);
expect(traceId).toMatch(/[a-f\d]{32}/);
expect(parentSpanId).toMatch(/[a-f\d]{16}/);

expect(spanEnvelopeHeader).toEqual({
sent_at: expect.any(String),
Expand Down Expand Up @@ -76,7 +76,7 @@ sentryTest(
segment_id: transactionEnvelopeItem.contexts?.trace?.span_id,
parent_span_id: parentSpanId,
origin: 'manual',
span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f\d]{16}/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: traceId,
Expand Down Expand Up @@ -111,7 +111,7 @@ sentryTest(
description: 'inner',
origin: 'manual',
parent_span_id: parentSpanId,
span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f\d]{16}/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: traceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ sentryTest('sends a segment span envelope', async ({ getLocalTestUrl, page }) =>
},
description: 'standalone_segment_span',
origin: 'manual',
span_id: expect.stringMatching(/^[0-9a-f]{16}$/),
span_id: expect.stringMatching(/^[\da-f]{16}$/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: expect.stringMatching(/^[0-9a-f]{32}$/),
trace_id: expect.stringMatching(/^[\da-f]{32}$/),
is_segment: true,
segment_id: spanJson.span_id,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sentryTest(
expect(envHeader.trace).toEqual({
environment: 'production',
sample_rate: '1',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
trace_id: expect.stringMatching(/[a-f\d]{32}/),
public_key: 'public',
replay_id: replay.session?.id,
sampled: 'true',
Expand Down Expand Up @@ -105,7 +105,7 @@ sentryTest(
expect(envHeader.trace).toEqual({
environment: 'production',
sample_rate: '1',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
trace_id: expect.stringMatching(/[a-f\d]{32}/),
public_key: 'public',
sampled: 'true',
sample_rand: expect.any(String),
Expand Down Expand Up @@ -158,7 +158,7 @@ sentryTest(
expect(envHeader.trace).toEqual({
environment: 'production',
sample_rate: '1',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
trace_id: expect.stringMatching(/[a-f\d]{32}/),
public_key: 'public',
replay_id: replay.session?.id,
sampled: 'true',
Expand Down Expand Up @@ -201,7 +201,7 @@ sentryTest(
expect(envHeader.trace).toEqual({
environment: 'production',
sample_rate: '1',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
trace_id: expect.stringMatching(/[a-f\d]{32}/),
public_key: 'public',
sampled: 'true',
sample_rand: expect.any(String),
Expand Down Expand Up @@ -243,7 +243,7 @@ sentryTest('should add replay_id to error DSC while replay is active', async ({
expect(error1Header.trace).toBeDefined();
expect(error1Header.trace).toEqual({
environment: 'production',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
trace_id: expect.stringMatching(/[a-f\d]{32}/),
public_key: 'public',
replay_id: replay.session?.id,
...(hasTracing
Expand All @@ -265,7 +265,7 @@ sentryTest('should add replay_id to error DSC while replay is active', async ({
expect(error2Header.trace).toBeDefined();
expect(error2Header.trace).toEqual({
environment: 'production',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
trace_id: expect.stringMatching(/[a-f\d]{32}/),
public_key: 'public',
...(hasTracing
? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sentryTest('creates fetch spans with http timing', async ({ browserName, getLoca
expect(span).toMatchObject({
description: `GET http://sentry-test-site.example/${index}`,
parent_span_id: tracingEvent.contexts?.trace?.span_id,
span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f\d]{16}/),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Paused Playwright test: leftover debug halts CI

A leftover debug statement await page.pause(); was added to the test. This will pause Playwright execution and likely cause the test to hang or time out in CI, breaking the test suite.

Fix in Cursor Fix in Web

start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: tracingEvent.contexts?.trace?.trace_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ sentryTest.describe('When `consistentTraceSampling` is `true` and page contains

expect(extractTraceparentData(sentryTrace)).toEqual({
traceId: expect.not.stringContaining(metaTagTraceId),
parentSpanId: expect.stringMatching(/^[0-9a-f]{16}$/),
parentSpanId: expect.stringMatching(/^[\da-f]{16}$/),
parentSampled: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sentryTest.describe('When `consistentTraceSampling` is `true` and page contains

expect(extractTraceparentData(sentryTrace)).toEqual({
traceId: expect.not.stringContaining(metaTagTraceIdIndex),
parentSpanId: expect.stringMatching(/^[0-9a-f]{16}$/),
parentSpanId: expect.stringMatching(/^[\da-f]{16}$/),
parentSampled: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ sentryTest.describe('When `consistentTraceSampling` is `true`', () => {
{
attributes: { 'sentry.link.type': 'previous_trace' },
sampled: false,
span_id: expect.stringMatching(/^[0-9a-f]{16}$/),
trace_id: expect.stringMatching(/^[0-9a-f]{32}$/),
span_id: expect.stringMatching(/^[\da-f]{16}$/),
trace_id: expect.stringMatching(/^[\da-f]{32}$/),
},
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ sentryTest('includes a span link to a previously negatively sampled span', async
expect(navigationTraceContext?.op).toBe('navigation');
expect(navigationTraceContext?.links).toEqual([
{
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
trace_id: expect.stringMatching(/[a-f\d]{32}/),
span_id: expect.stringMatching(/[a-f\d]{16}/),
sampled: false,
attributes: {
[SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE]: 'previous_trace',
Expand All @@ -34,7 +34,7 @@ sentryTest('includes a span link to a previously negatively sampled span', async
]);

expect(navigationTraceContext?.data).toMatchObject({
'sentry.previous_trace': expect.stringMatching(/[a-f0-9]{32}-[a-f0-9]{16}-0/),
'sentry.previous_trace': expect.stringMatching(/[a-f\d]{32}-[a-f\d]{16}-0/),
});

expect(navigationTraceContext?.trace_id).not.toEqual(navigationTraceContext?.links![0].trace_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ sentryTest('errors in TwP mode have same trace ID & span IDs', async ({ getLocal

// Span ID is a virtual span, not the propagated one
expect(spanId1).not.toEqual(spanId);
expect(spanId1).toMatch(/^[a-f0-9]{16}$/);
expect(spanId1).toMatch(/^[a-f\d]{16}$/);

const contexts2 = event2.contexts;
const { trace_id: traceId2, span_id: spanId2 } = contexts2?.trace || {};
expect(traceId2).toEqual(traceId);
expect(spanId2).toMatch(/^[a-f0-9]{16}$/);
expect(spanId2).toMatch(/^[a-f\d]{16}$/);

expect(spanId2).toEqual(spanId1);
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ sentryTest('errors in TwP mode have same trace ID & span IDs', async ({ getLocal

const contexts1 = event1.contexts;
const { trace_id: traceId1, span_id: spanId1 } = contexts1?.trace || {};
expect(traceId1).toMatch(/^[a-f0-9]{32}$/);
expect(spanId1).toMatch(/^[a-f0-9]{16}$/);
expect(traceId1).toMatch(/^[a-f\d]{32}$/);
expect(spanId1).toMatch(/^[a-f\d]{16}$/);

const contexts2 = event2.contexts;
const { trace_id: traceId2, span_id: spanId2 } = contexts2?.trace || {};
expect(traceId2).toMatch(/^[a-f0-9]{32}$/);
expect(spanId2).toMatch(/^[a-f0-9]{16}$/);
expect(traceId2).toMatch(/^[a-f\d]{32}$/);
expect(spanId2).toMatch(/^[a-f\d]{16}$/);

expect(traceId2).toEqual(traceId1);
expect(spanId2).toEqual(spanId1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
return (window as any).__traceId;
});

expect(traceId).toMatch(/^[0-9a-f]{32}$/);
expect(traceId).toMatch(/^[\da-f]{32}$/);

// 2
const baggageItems = await makeRequestAndGetBaggageItems(page);
expect(baggageItems).toEqual([
'sentry-environment=production',
'sentry-public_key=public',
'sentry-release=1.1.1',
expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/),
expect.stringMatching(/sentry-sample_rand=0\.\d+/),
'sentry-sample_rate=1',
'sentry-sampled=true',
`sentry-trace_id=${traceId}`,
Expand All @@ -83,7 +83,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
'sentry-environment=production',
'sentry-public_key=public',
'sentry-release=1.1.1',
expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/),
expect.stringMatching(/sentry-sample_rand=0\.\d+/),
'sentry-sample_rate=1',
'sentry-sampled=true',
`sentry-trace_id=${traceId}`,
Expand Down Expand Up @@ -112,7 +112,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
'sentry-environment=production',
'sentry-public_key=public',
'sentry-release=1.1.1',
expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/),
expect.stringMatching(/sentry-sample_rand=0\.\d+/),
'sentry-sample_rate=1',
'sentry-sampled=true',
`sentry-trace_id=${traceId}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sentryTest(
environment: 'production',
sample_rate: '1',
transaction: expect.stringContaining('/index.html'),
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
trace_id: expect.stringMatching(/[a-f\d]{32}/),
public_key: 'public',
sampled: 'true',
sample_rand: expect.any(String),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sentryTest(
expect(envHeader.trace).toEqual({
environment: 'production',
sample_rate: '1',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
trace_id: expect.stringMatching(/[a-f\d]{32}/),
public_key: 'public',
sampled: 'true',
sample_rand: expect.any(String),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
op: 'resource.img',
origin: 'auto.resource.browser.metrics',
parent_span_id: spanId,
span_id: expect.stringMatching(/^[a-f0-9]{16}$/),
span_id: expect.stringMatching(/^[a-f\d]{16}$/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: traceId,
Expand Down Expand Up @@ -151,7 +151,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
op: 'resource.link',
origin: 'auto.resource.browser.metrics',
parent_span_id: spanId,
span_id: expect.stringMatching(/^[a-f0-9]{16}$/),
span_id: expect.stringMatching(/^[a-f\d]{16}$/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: traceId,
Expand Down Expand Up @@ -192,7 +192,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
op: 'resource.script',
origin: 'auto.resource.browser.metrics',
parent_span_id: spanId,
span_id: expect.stringMatching(/^[a-f0-9]{16}$/),
span_id: expect.stringMatching(/^[a-f\d]{16}$/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: traceId,
Expand Down
Loading
Loading