Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
test(e2e): Port nextjs-app-dir to span streaming#23905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chargome
merged 1 commit into
test/e2e-port-nextjs-orpc
from
test/e2e-port-nextjs-app-dirSep 2, 2026
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1 dev-packages/e2e-tests/test-applications/nextjs-app-dir/instrumentation-client.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1 dev-packages/e2e-tests/test-applications/nextjs-app-dir/instrumentation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 80 additions & 89 deletions
169 ...e-tests/test-applications/nextjs-app-dir/tests/client-app-routing-instrumentation.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 38 additions & 37 deletions
75 .../e2e-tests/test-applications/nextjs-app-dir/tests/connected-servercomponent-trace.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,53 +1,54 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
| import { waitForTransaction } from '@sentry-internal/test-utils'; | ||
| test('Will create a transaction with spans for every server component and metadata generation functions when visiting a page', async ({ | ||
| import { collectStreamedSpans } from '@sentry-internal/test-utils'; | ||
| // Streamed spans are flushed across multiple envelopes as they end, so the server-component child spans | ||
| // can arrive in a different (earlier) envelope than the `is_segment` root span. Accumulate spans across | ||
| // envelopes until the root span (which ends last) is seen. | ||
| function collectSpanNamesUntilSegment(segmentName: string): Promise<string[]> { | ||
| return collectStreamedSpans('nextjs-app-dir', spans => | ||
| spans.some(span => span.name === segmentName && span.is_segment), | ||
| ).then(spans => spans.map(span => span.name)); | ||
| } | ||
| test('Will create spans for every server component and metadata generation functions when visiting a page', async ({ | ||
| page, | ||
| }) => { | ||
| const serverTransactionEventPromise = waitForTransaction('nextjs-app-dir', async transactionEvent => { | ||
| return transactionEvent?.transaction === 'GET /nested-layout'; | ||
| }); | ||
| const spanNamesPromise = collectSpanNamesUntilSegment('GET /nested-layout'); | ||
| await page.goto('/nested-layout'); | ||
| const spanDescriptions = (await serverTransactionEventPromise).spans?.map(span => { | ||
| return span.description; | ||
| }); | ||
| const spanNames = await spanNamesPromise; | ||
| expect(spanDescriptions).toContainEqual('render route (app) /nested-layout'); | ||
| expect(spanDescriptions).toContainEqual('generateMetadata /(nested-layout)/nested-layout/page'); | ||
| expect(spanNames).toContainEqual('render route (app) /nested-layout'); | ||
| expect(spanNames).toContainEqual('generateMetadata /(nested-layout)/nested-layout/page'); | ||
| expect(spanDescriptions).toContainEqual('resolve page components'); | ||
| expect(spanDescriptions).toContainEqual('build component tree'); | ||
| expect(spanDescriptions).toContainEqual('resolve root layout server component'); | ||
| expect(spanDescriptions).toContainEqual('resolve layout server component "(nested-layout)"'); | ||
| expect(spanDescriptions).toContainEqual('resolve layout server component "nested-layout"'); | ||
| expect(spanDescriptions).toContainEqual('resolve page server component "/nested-layout"'); | ||
| expect(spanDescriptions).toContainEqual('start response'); | ||
| expect(spanNames).toContainEqual('resolve page components'); | ||
| expect(spanNames).toContainEqual('build component tree'); | ||
| expect(spanNames).toContainEqual('resolve root layout server component'); | ||
| expect(spanNames).toContainEqual('resolve layout server component "(nested-layout)"'); | ||
| expect(spanNames).toContainEqual('resolve layout server component "nested-layout"'); | ||
| expect(spanNames).toContainEqual('resolve page server component "/nested-layout"'); | ||
| expect(spanNames).toContainEqual('start response'); | ||
| }); | ||
| test('Will create a transaction with spans for every server component and metadata generation functions when visiting a dynamic page', async ({ | ||
| test('Will create spans for every server component and metadata generation functions when visiting a dynamic page', async ({ | ||
| page, | ||
| }) => { | ||
| const serverTransactionEventPromise = waitForTransaction('nextjs-app-dir', async transactionEvent => { | ||
| return transactionEvent?.transaction === 'GET /nested-layout/[dynamic]'; | ||
| }); | ||
| const spanNamesPromise = collectSpanNamesUntilSegment('GET /nested-layout/[dynamic]'); | ||
| await page.goto('/nested-layout/123'); | ||
| const spanDescriptions = (await serverTransactionEventPromise).spans?.map(span => { | ||
| return span.description; | ||
| }); | ||
| expect(spanDescriptions).toContainEqual('render route (app) /nested-layout/[dynamic]'); | ||
| expect(spanDescriptions).toContainEqual('generateMetadata /(nested-layout)/nested-layout/[dynamic]/page'); | ||
| expect(spanDescriptions).toContainEqual('resolve page components'); | ||
| expect(spanDescriptions).toContainEqual('build component tree'); | ||
| expect(spanDescriptions).toContainEqual('resolve root layout server component'); | ||
| expect(spanDescriptions).toContainEqual('resolve layout server component "(nested-layout)"'); | ||
| expect(spanDescriptions).toContainEqual('resolve layout server component "nested-layout"'); | ||
| expect(spanDescriptions).toContainEqual('resolve layout server component "[dynamic]"'); | ||
| expect(spanDescriptions).toContainEqual('resolve page server component "/nested-layout/[dynamic]"'); | ||
| expect(spanDescriptions).toContainEqual('start response'); | ||
| const spanNames = await spanNamesPromise; | ||
| expect(spanNames).toContainEqual('render route (app) /nested-layout/[dynamic]'); | ||
| expect(spanNames).toContainEqual('generateMetadata /(nested-layout)/nested-layout/[dynamic]/page'); | ||
| expect(spanNames).toContainEqual('resolve page components'); | ||
| expect(spanNames).toContainEqual('build component tree'); | ||
| expect(spanNames).toContainEqual('resolve root layout server component'); | ||
| expect(spanNames).toContainEqual('resolve layout server component "(nested-layout)"'); | ||
| expect(spanNames).toContainEqual('resolve layout server component "nested-layout"'); | ||
| expect(spanNames).toContainEqual('resolve layout server component "[dynamic]"'); | ||
| expect(spanNames).toContainEqual('resolve page server component "/nested-layout/[dynamic]"'); | ||
| expect(spanNames).toContainEqual('start response'); | ||
| }); | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: You think that might make sense to move into our utils folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow up 👍