Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"version": "0.0.1",
"scripts": {
"dev": "astro dev --force",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"start": "node ./dist/server/entry.mjs",
"astro": "astro",
"test:build": "pnpm install && pnpm build",
"test:assert": "TEST_ENV=production playwright test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (!testEnv) {
}

const config = getPlaywrightConfig({
startCommand: 'node ./dist/server/entry.mjs',
startCommand: 'pnpm start',
});

export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ test.describe('client-side errors', () => {
contexts: {
trace: {
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ test.describe('tracing in static/pre-rendered routes', () => {
const clientPageloadTraceId = clientPageloadTxn.contexts?.trace?.trace_id;
const clientPageloadParentSpanId = clientPageloadTxn.contexts?.trace?.parent_span_id;

const sentryTraceMetaTagContent = await page.locator('meta[name="sentry-trace"]').getAttribute('content');
const baggageMetaTagContent = await page.locator('meta[name="baggage"]').getAttribute('content');
const sentryTraceMetaTags = await page.locator('meta[name="sentry-trace"]').count();
expect(sentryTraceMetaTags).toBe(0);

const [metaTraceId, metaParentSpanId, metaSampled] = sentryTraceMetaTagContent?.split('-') || [];
const baggageMetaTags = await page.locator('meta[name="baggage"]').count();
expect(baggageMetaTags).toBe(0);

expect(clientPageloadTraceId).toMatch(/[a-f0-9]{32}/);
expect(clientPageloadParentSpanId).toMatch(/[a-f0-9]{16}/);
expect(metaSampled).toBe('1');
expect(clientPageloadParentSpanId).toBeUndefined();

expect(clientPageloadTxn).toMatchObject({
contexts: {
Expand All @@ -40,9 +40,8 @@ test.describe('tracing in static/pre-rendered routes', () => {
}),
op: 'pageload',
origin: 'auto.pageload.astro',
parent_span_id: metaParentSpanId,
span_id: expect.stringMatching(/[a-f0-9]{16}/),
trace_id: metaTraceId,
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
},
},
platform: 'javascript',
Expand All @@ -53,9 +52,6 @@ test.describe('tracing in static/pre-rendered routes', () => {
type: 'transaction',
});

expect(baggageMetaTagContent).toContain('sentry-transaction=GET%20%2Ftest-static'); // URL-encoded for 'GET /test-static'
expect(baggageMetaTagContent).toContain('sentry-sampled=true');

await page.waitForTimeout(1000); // wait another sec to ensure no server transaction is sent
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
"start": "node ./dist/server/entry.mjs",
"test:build": "pnpm install && pnpm build",
"test:assert": "TEST_ENV=production playwright test"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (!testEnv) {
}

const config = getPlaywrightConfig({
startCommand: 'node ./dist/server/entry.mjs',
startCommand: 'pnpm start',
});

export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ test.describe('client-side errors', () => {
contexts: {
trace: {
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ import { waitForTransaction } from '@sentry-internal/test-utils';
test.describe('tracing in static routes with server islands', () => {
test('only sends client pageload transaction and server island endpoint transaction', async ({ page }) => {
const clientPageloadTxnPromise = waitForTransaction('astro-5', txnEvent => {
return txnEvent?.transaction === '/server-island';
return txnEvent.transaction === '/server-island';
});

const serverIslandEndpointTxnPromise = waitForTransaction('astro-5', evt => {
return !!evt.transaction?.startsWith('GET /_server-islands');
return evt.transaction === 'GET /_server-islands/[name]';
});

await page.goto('/server-island');

const clientPageloadTxn = await clientPageloadTxnPromise;

const clientPageloadTraceId = clientPageloadTxn.contexts?.trace?.trace_id;
const clientPageloadParentSpanId = clientPageloadTxn.contexts?.trace?.parent_span_id;

const sentryTraceMetaTagContent = await page.locator('meta[name="sentry-trace"]').getAttribute('content');
const baggageMetaTagContent = await page.locator('meta[name="baggage"]').getAttribute('content');
const sentryTraceMetaTags = await page.locator('meta[name="sentry-trace"]').count();
expect(sentryTraceMetaTags).toBe(0);

const [metaTraceId, metaParentSpanId, metaSampled] = sentryTraceMetaTagContent?.split('-') || [];
const baggageMetaTags = await page.locator('meta[name="baggage"]').count();
expect(baggageMetaTags).toBe(0);

expect(clientPageloadTraceId).toMatch(/[a-f0-9]{32}/);
expect(clientPageloadParentSpanId).toMatch(/[a-f0-9]{16}/);
expect(metaSampled).toBe('1');
expect(clientPageloadParentSpanId).toBeUndefined();

expect(clientPageloadTxn).toMatchObject({
contexts: {
Expand All @@ -37,9 +36,8 @@ test.describe('tracing in static routes with server islands', () => {
}),
op: 'pageload',
origin: 'auto.pageload.astro',
parent_span_id: metaParentSpanId,
span_id: expect.stringMatching(/[a-f0-9]{16}/),
trace_id: metaTraceId,
trace_id: clientPageloadTraceId,
},
},
platform: 'javascript',
Expand All @@ -63,9 +61,6 @@ test.describe('tracing in static routes with server islands', () => {
]),
);

expect(baggageMetaTagContent).toContain('sentry-transaction=GET%20%2Fserver-island'); // URL-encoded for 'GET /server-island'
expect(baggageMetaTagContent).toContain('sentry-sampled=true');

const serverIslandEndpointTxn = await serverIslandEndpointTxnPromise;

expect(serverIslandEndpointTxn).toMatchObject({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ test.describe('tracing in static/pre-rendered routes', () => {
const clientPageloadTraceId = clientPageloadTxn.contexts?.trace?.trace_id;
const clientPageloadParentSpanId = clientPageloadTxn.contexts?.trace?.parent_span_id;

const sentryTraceMetaTagContent = await page.locator('meta[name="sentry-trace"]').getAttribute('content');
const baggageMetaTagContent = await page.locator('meta[name="baggage"]').getAttribute('content');
const sentryTraceMetaTags = await page.locator('meta[name="sentry-trace"]').count();
expect(sentryTraceMetaTags).toBe(0);

const [metaTraceId, metaParentSpanId, metaSampled] = sentryTraceMetaTagContent?.split('-') || [];
const baggageMetaTags = await page.locator('meta[name="baggage"]').count();
expect(baggageMetaTags).toBe(0);

expect(clientPageloadTraceId).toMatch(/[a-f0-9]{32}/);
expect(clientPageloadParentSpanId).toMatch(/[a-f0-9]{16}/);
expect(metaSampled).toBe('1');
expect(clientPageloadParentSpanId).toBeUndefined();

expect(clientPageloadTxn).toMatchObject({
contexts: {
Expand All @@ -40,9 +40,8 @@ test.describe('tracing in static/pre-rendered routes', () => {
}),
op: 'pageload',
origin: 'auto.pageload.astro',
parent_span_id: metaParentSpanId,
span_id: expect.stringMatching(/[a-f0-9]{16}/),
trace_id: metaTraceId,
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
},
},
platform: 'javascript',
Expand All @@ -53,9 +52,6 @@ test.describe('tracing in static/pre-rendered routes', () => {
type: 'transaction',
});

expect(baggageMetaTagContent).toContain('sentry-transaction=GET%20%2Ftest-static'); // URL-encoded for 'GET /test-static'
expect(baggageMetaTagContent).toContain('sentry-sampled=true');

await page.waitForTimeout(1000); // wait another sec to ensure no server transaction is sent
});
});
Loading
Loading