-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
test(solidstart): Add client performance e2e tests #12895
Merged
andreiborza
merged 2 commits into
develop
from
ab/solidstart-e2e-performance-client-tests
Jul 12, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
3 changes: 2 additions & 1 deletion
3
dev-packages/e2e-tests/test-applications/solidstart/src/entry-client.tsx
This file contains 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,13 +1,14 @@ | ||
// @refresh reload | ||
import * as Sentry from '@sentry/solidstart'; | ||
import { solidRouterBrowserTracingIntegration } from '@sentry/solidstart/solidrouter'; | ||
import { StartClient, mount } from '@solidjs/start/client'; | ||
|
||
Sentry.init({ | ||
// We can't use env variables here, seems like they are stripped | ||
// out in production builds. | ||
dsn: 'https://[email protected]/1337', | ||
environment: 'qa', // dynamic sampling bias to keep transactions | ||
integrations: [Sentry.browserTracingIntegration()], | ||
integrations: [solidRouterBrowserTracingIntegration()], | ||
tunnel: 'http://localhost:3031/', // proxy server | ||
// Performance Monitoring | ||
tracesSampleRate: 1.0, // Capture 100% of the transactions | ||
|
This file contains 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
6 changes: 6 additions & 0 deletions
6
dev-packages/e2e-tests/test-applications/solidstart/src/routes/users/[id].tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useParams } from '@solidjs/router'; | ||
|
||
export default function User() { | ||
const params = useParams(); | ||
return <div>User ID: {params.id}</div>; | ||
} |
93 changes: 93 additions & 0 deletions
93
dev-packages/e2e-tests/test-applications/solidstart/tests/performance.client.test.ts
This file contains 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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { waitForTransaction } from '@sentry-internal/test-utils'; | ||
|
||
test('sends a pageload transaction', async ({ page }) => { | ||
const transactionPromise = waitForTransaction('solidstart', async transactionEvent => { | ||
return transactionEvent?.transaction === '/' && transactionEvent.contexts?.trace?.op === 'pageload'; | ||
}); | ||
|
||
await page.goto('/'); | ||
const pageloadTransaction = await transactionPromise; | ||
|
||
expect(pageloadTransaction).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
op: 'pageload', | ||
origin: 'auto.pageload.browser', | ||
}, | ||
}, | ||
transaction: '/', | ||
transaction_info: { | ||
source: 'url', | ||
}, | ||
}); | ||
}); | ||
|
||
test('sends a navigation transaction', async ({ page }) => { | ||
const transactionPromise = waitForTransaction('solidstart', async transactionEvent => { | ||
return transactionEvent?.transaction === '/users/5' && transactionEvent.contexts?.trace?.op === 'navigation'; | ||
}); | ||
|
||
await page.goto(`/`); | ||
await page.locator('#navLink').click(); | ||
const navigationTransaction = await transactionPromise; | ||
|
||
expect(navigationTransaction).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
op: 'navigation', | ||
origin: 'auto.navigation.solid.solidrouter', | ||
}, | ||
}, | ||
transaction: '/users/5', | ||
transaction_info: { | ||
source: 'url', | ||
}, | ||
}); | ||
}); | ||
|
||
test('updates the transaction when using the back button', async ({ page }) => { | ||
// Solid Router sends a `-1` navigation when using the back button. | ||
// The sentry solidRouterBrowserTracingIntegration tries to update such | ||
// transactions with the proper name once the `useLocation` hook triggers. | ||
const navigationTxnPromise = waitForTransaction('solidstart', async transactionEvent => { | ||
return transactionEvent?.transaction === '/users/6' && transactionEvent.contexts?.trace?.op === 'navigation'; | ||
}); | ||
|
||
await page.goto(`/`); | ||
await page.locator('#navLinkUserBack').click(); | ||
const navigationTxn = await navigationTxnPromise; | ||
|
||
expect(navigationTxn).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
op: 'navigation', | ||
origin: 'auto.navigation.solid.solidrouter', | ||
}, | ||
}, | ||
transaction: '/users/6', | ||
transaction_info: { | ||
source: 'url', | ||
}, | ||
}); | ||
|
||
const backNavigationTxnPromise = waitForTransaction('solidstart', async transactionEvent => { | ||
return transactionEvent?.transaction === '/' && transactionEvent.contexts?.trace?.op === 'navigation'; | ||
}); | ||
|
||
await page.goBack(); | ||
const backNavigationTxn = await backNavigationTxnPromise; | ||
|
||
expect(backNavigationTxn).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
op: 'navigation', | ||
origin: 'auto.navigation.solid.solidrouter', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow-up, this should probably be |
||
}, | ||
}, | ||
transaction: '/', | ||
transaction_info: { | ||
source: 'url', | ||
}, | ||
}); | ||
}); |
Oops, something went wrong.
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.
Follow up task: We likely want to emit
auto.pageload.solidstart.router
here.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.
Thanks, will update this in a follow up PR.