Skip to content

Commit bce0c01

Browse files
committed
try fix tests 1
1 parent bfbbc1b commit bce0c01

File tree

5 files changed

+50
-30
lines changed

5 files changed

+50
-30
lines changed

dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
1313
return txnEvent.transaction.includes('GET /test-param/');
1414
});
1515

16-
const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
17-
page.goto(`/test-param/${PARAM}`),
16+
const res = await page.goto(`/test-param/${PARAM}`);
17+
const data = await res.json();
18+
19+
const [clientTxnEvent, serverTxnEvent] = await Promise.all([
1820
clientTxnEventPromise,
1921
serverTxnEventPromise,
2022
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
@@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
3335
});
3436

3537
expect(serverTxnEvent).toMatchObject({
36-
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
38+
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)
3739
transaction_info: { source: 'url' },
3840
type: 'transaction',
3941
contexts: {
@@ -44,19 +46,21 @@ test.describe('distributed tracing', () => {
4446
},
4547
});
4648

49+
const baggage = (data.headers.baggage || null).split(',');
50+
4751
// connected trace
4852
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
4953
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
50-
expect(clientTxnEvent.contexts?.trace?.baggage).not.toBeUndefined();
54+
expect(baggage).not.toBeNull();
5155

5256
expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
5357
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
54-
expect((clientTxnEvent.contexts?.trace?.baggage as string | undefined)?.split(',').sort()).toEqual(
58+
expect(baggage).toEqual(
5559
expect.arrayContaining([
5660
'sentry-sample-rate=1.0',
5761
'sentry-sampled=true',
5862
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
59-
'sentry-transaction=GET%20%2Ftest-param%2Fs0me-param',
63+
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
6064
]),
6165
);
6266
});

dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
1313
return txnEvent.transaction.includes('GET /test-param/');
1414
});
1515

16-
const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
17-
page.goto(`/test-param/${PARAM}`),
16+
const res = await page.goto(`/test-param/${PARAM}`);
17+
const data = await res.json();
18+
19+
const [clientTxnEvent, serverTxnEvent] = await Promise.all([
1820
clientTxnEventPromise,
1921
serverTxnEventPromise,
2022
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
@@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
3335
});
3436

3537
expect(serverTxnEvent).toMatchObject({
36-
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
38+
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)
3739
transaction_info: { source: 'url' },
3840
type: 'transaction',
3941
contexts: {
@@ -44,19 +46,21 @@ test.describe('distributed tracing', () => {
4446
},
4547
});
4648

49+
const baggage = (data.headers.baggage || null).split(',');
50+
4751
// connected trace
4852
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
4953
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
50-
expect(clientTxnEvent.contexts?.trace?.baggage).not.toBeUndefined();
54+
expect(baggage).not.toBeNull();
5155

5256
expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
5357
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
54-
expect((clientTxnEvent.contexts?.trace?.baggage as string | undefined)?.split(',').sort()).toEqual(
58+
expect(baggage).toEqual(
5559
expect.arrayContaining([
5660
'sentry-sample-rate=1.0',
5761
'sentry-sampled=true',
5862
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
59-
'sentry-transaction=GET%20%2Ftest-param%2Fs0me-param',
63+
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
6064
]),
6165
);
6266
});

dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
1313
return txnEvent.transaction.includes('GET /test-param/');
1414
});
1515

16-
const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
17-
page.goto(`/test-param/${PARAM}`),
16+
const res = await page.goto(`/test-param/${PARAM}`);
17+
const data = await res.json();
18+
19+
const [clientTxnEvent, serverTxnEvent] = await Promise.all([
1820
clientTxnEventPromise,
1921
serverTxnEventPromise,
2022
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
@@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
3335
});
3436

3537
expect(serverTxnEvent).toMatchObject({
36-
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
38+
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)`
3739
transaction_info: { source: 'url' },
3840
type: 'transaction',
3941
contexts: {
@@ -44,19 +46,21 @@ test.describe('distributed tracing', () => {
4446
},
4547
});
4648

49+
const baggage = (data.headers.baggage || null).split(',');
50+
4751
// connected trace
4852
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
4953
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
50-
expect(clientTxnEvent.contexts?.trace?.baggage).not.toBeUndefined();
54+
expect(baggage).not.toBeNull();
5155

5256
expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
5357
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
54-
expect((clientTxnEvent.contexts?.trace?.baggage as string | undefined)?.split(',').sort()).toEqual(
58+
expect(baggage).toEqual(
5559
expect.arrayContaining([
5660
'sentry-sample-rate=1.0',
5761
'sentry-sampled=true',
5862
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
59-
'sentry-transaction=GET%20%2Ftest-param%2Fs0me-param',
63+
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
6064
]),
6165
);
6266
});

dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
1313
return txnEvent.transaction.includes('GET /test-param/');
1414
});
1515

16-
const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
17-
page.goto(`/test-param/${PARAM}`),
16+
const res = await page.goto(`/test-param/${PARAM}`);
17+
const data = await res.json();
18+
19+
const [clientTxnEvent, serverTxnEvent] = await Promise.all([
1820
clientTxnEventPromise,
1921
serverTxnEventPromise,
2022
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
@@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
3335
});
3436

3537
expect(serverTxnEvent).toMatchObject({
36-
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
38+
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)
3739
transaction_info: { source: 'url' },
3840
type: 'transaction',
3941
contexts: {
@@ -44,19 +46,21 @@ test.describe('distributed tracing', () => {
4446
},
4547
});
4648

49+
const baggage = (data.headers.baggage || null).split(',');
50+
4751
// connected trace
4852
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
4953
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
50-
expect(clientTxnEvent.contexts?.trace?.baggage).not.toBeUndefined();
54+
expect(baggage).not.toBeNull();
5155

5256
expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
5357
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
54-
expect((clientTxnEvent.contexts?.trace?.baggage as string | undefined)?.split(',').sort()).toEqual(
58+
expect(baggage).toEqual(
5559
expect.arrayContaining([
5660
'sentry-sample-rate=1.0',
5761
'sentry-sampled=true',
5862
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
59-
'sentry-transaction=GET%20%2Ftest-param%2Fs0me-param',
63+
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
6064
]),
6165
);
6266
});

dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ test.describe('distributed tracing', () => {
1313
return txnEvent.transaction.includes('GET /test-param/');
1414
});
1515

16-
const [_, clientTxnEvent, serverTxnEvent] = await Promise.all([
17-
page.goto(`/test-param/${PARAM}`),
16+
const res = await page.goto(`/test-param/${PARAM}`);
17+
const data = await res.json();
18+
19+
const [clientTxnEvent, serverTxnEvent] = await Promise.all([
1820
clientTxnEventPromise,
1921
serverTxnEventPromise,
2022
expect(page.getByText(`Param: ${PARAM}`)).toBeVisible(),
@@ -33,7 +35,7 @@ test.describe('distributed tracing', () => {
3335
});
3436

3537
expect(serverTxnEvent).toMatchObject({
36-
transaction: 'GET /test-param/s0me-param', // todo: parametrize (nitro)
38+
transaction: `GET /test-param/${PARAM}`, // todo: parametrize (nitro)
3739
transaction_info: { source: 'url' },
3840
type: 'transaction',
3941
contexts: {
@@ -44,19 +46,21 @@ test.describe('distributed tracing', () => {
4446
},
4547
});
4648

49+
const baggage = (data.headers.baggage || null).split(',');
50+
4751
// connected trace
4852
expect(clientTxnEvent.contexts?.trace?.trace_id).not.toBeUndefined();
4953
expect(clientTxnEvent.contexts?.trace?.parent_span_id).not.toBeUndefined();
50-
expect(clientTxnEvent.contexts?.trace?.baggage).not.toBeUndefined();
54+
expect(baggage).not.toBeNull();
5155

5256
expect(clientTxnEvent.contexts?.trace?.trace_id).toBe(serverTxnEvent.contexts?.trace?.trace_id);
5357
expect(clientTxnEvent.contexts?.trace?.parent_span_id).toBe(serverTxnEvent.contexts?.trace?.span_id);
54-
expect((clientTxnEvent.contexts?.trace?.baggage as string | undefined)?.split(',').sort()).toEqual(
58+
expect(baggage).toEqual(
5559
expect.arrayContaining([
5660
'sentry-sample-rate=1.0',
5761
'sentry-sampled=true',
5862
`sentry-trace_id=${serverTxnEvent.contexts?.trace?.trace_id}`,
59-
'sentry-transaction=GET%20%2Ftest-param%2Fs0me-param',
63+
`sentry-transaction=GET%20%2Ftest-param%2F${PARAM}`,
6064
]),
6165
);
6266
});

0 commit comments

Comments
 (0)