Skip to content

Commit f252957

Browse files
committed
add nuxt e2e tests
1 parent 08f5a34 commit f252957

6 files changed

Lines changed: 88 additions & 0 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) =>
1919
'sentry.origin': 'auto.pageload.vue',
2020
'sentry.op': 'pageload',
2121
'params.param': '1234',
22+
'url.template': '/test-param/:param()',
23+
'url.path': '/test-param/1234',
24+
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-param\/1234$/),
2225
},
2326
op: 'pageload',
2427
origin: 'auto.pageload.vue',

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) =>
2020
'sentry.origin': 'auto.pageload.vue',
2121
'sentry.op': 'pageload',
2222
'params.param': '1234',
23+
'url.template': '/test-param/:param()',
24+
'url.path': '/test-param/1234',
25+
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-param\/1234$/),
2326
},
2427
op: 'pageload',
2528
origin: 'auto.pageload.vue',

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) =>
1919
'sentry.origin': 'auto.pageload.vue',
2020
'sentry.op': 'pageload',
2121
'params.param': '1234',
22+
'url.template': '/test-param/:param()',
23+
'url.path': '/test-param/1234',
24+
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-param\/1234$/),
2225
},
2326
op: 'pageload',
2427
origin: 'auto.pageload.vue',

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) =>
1919
'sentry.origin': 'auto.pageload.vue',
2020
'sentry.op': 'pageload',
2121
'params.param': '1234',
22+
'url.template': '/test-param/:param()',
23+
'url.path': '/test-param/1234',
24+
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-param\/1234$/),
2225
},
2326
op: 'pageload',
2427
origin: 'auto.pageload.vue',

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) =>
1919
'sentry.origin': 'auto.pageload.vue',
2020
'sentry.op': 'pageload',
2121
'params.param': '1234',
22+
'url.template': '/test-param/:param()',
23+
'url.path': '/test-param/1234',
24+
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-param\/1234$/),
2225
},
2326
op: 'pageload',
2427
origin: 'auto.pageload.vue',
@@ -31,6 +34,41 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) =>
3134
});
3235
});
3336

37+
test('sends a navigation root span with a parameterized URL', async ({ page }) => {
38+
const transactionPromise = waitForTransaction('nuxt-4', async transactionEvent => {
39+
return (
40+
transactionEvent.contexts?.trace?.op === 'navigation' && transactionEvent.transaction === '/test-param/:param()'
41+
);
42+
});
43+
44+
await page.goto(`/`);
45+
await page.getByText('Fetch Param').click();
46+
47+
const rootSpan = await transactionPromise;
48+
49+
expect(rootSpan).toMatchObject({
50+
contexts: {
51+
trace: {
52+
data: {
53+
'sentry.source': 'route',
54+
'sentry.origin': 'auto.navigation.vue',
55+
'sentry.op': 'navigation',
56+
'params.param': '1234',
57+
'url.template': '/test-param/:param()',
58+
'url.path': '/test-param/1234',
59+
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-param\/1234$/),
60+
},
61+
op: 'navigation',
62+
origin: 'auto.navigation.vue',
63+
},
64+
},
65+
transaction: '/test-param/:param()',
66+
transaction_info: {
67+
source: 'route',
68+
},
69+
});
70+
});
71+
3472
test('sends component tracking spans when `trackComponents` is enabled', async ({ page }) => {
3573
const transactionPromise = waitForTransaction('nuxt-4', async transactionEvent => {
3674
return transactionEvent.transaction === '/client-error';

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) =>
1919
'sentry.origin': 'auto.pageload.vue',
2020
'sentry.op': 'pageload',
2121
'params.param': '1234',
22+
'url.template': '/test-param/:param()',
23+
'url.path': '/test-param/1234',
24+
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-param\/1234$/),
2225
},
2326
op: 'pageload',
2427
origin: 'auto.pageload.vue',
@@ -31,6 +34,41 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) =>
3134
});
3235
});
3336

37+
test('sends a navigation root span with a parameterized URL', async ({ page }) => {
38+
const transactionPromise = waitForTransaction('nuxt-5', async transactionEvent => {
39+
return (
40+
transactionEvent.contexts?.trace?.op === 'navigation' && transactionEvent.transaction === '/test-param/:param()'
41+
);
42+
});
43+
44+
await page.goto(`/`);
45+
await page.getByText('Fetch Param').click();
46+
47+
const rootSpan = await transactionPromise;
48+
49+
expect(rootSpan).toMatchObject({
50+
contexts: {
51+
trace: {
52+
data: {
53+
'sentry.source': 'route',
54+
'sentry.origin': 'auto.navigation.vue',
55+
'sentry.op': 'navigation',
56+
'params.param': '1234',
57+
'url.template': '/test-param/:param()',
58+
'url.path': '/test-param/1234',
59+
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-param\/1234$/),
60+
},
61+
op: 'navigation',
62+
origin: 'auto.navigation.vue',
63+
},
64+
},
65+
transaction: '/test-param/:param()',
66+
transaction_info: {
67+
source: 'route',
68+
},
69+
});
70+
});
71+
3472
test('sends component tracking spans when `trackComponents` is enabled', async ({ page }) => {
3573
const transactionPromise = waitForTransaction('nuxt-5', async transactionEvent => {
3674
return transactionEvent.transaction === '/client-error';

0 commit comments

Comments
 (0)