Skip to content

fix(solidstart): Make back navigation test less flaky #13374

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
merged 1 commit into from
Aug 14, 2024
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
@@ -0,0 +1,9 @@
import { A } from '@solidjs/router';

export default function BackNavigation() {
return (
<A id="navLink" href="/users/6">
User 6
</A>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ export default function Home() {
</A>
</li>
<li>
<A id="navLinkUserBack" href="/users/6">
User 6
</A>
<A href="/back-navigation">Test back navigation</A>
</li>
</ul>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ test('updates the transaction when using the back button', async ({ page }) => {
return transactionEvent?.transaction === '/users/6' && transactionEvent.contexts?.trace?.op === 'navigation';
});

await page.goto(`/`);
await page.locator('#navLinkUserBack').click();
await page.goto(`/back-navigation`);
await page.locator('#navLink').click();
const navigationTxn = await navigationTxnPromise;

expect(navigationTxn).toMatchObject({
Expand All @@ -72,7 +72,9 @@ test('updates the transaction when using the back button', async ({ page }) => {
});

const backNavigationTxnPromise = waitForTransaction('solidstart', async transactionEvent => {
return transactionEvent?.transaction === '/' && transactionEvent.contexts?.trace?.op === 'navigation';
return (
transactionEvent?.transaction === '/back-navigation' && transactionEvent.contexts?.trace?.op === 'navigation'
);
});

await page.goBack();
Expand All @@ -85,7 +87,7 @@ test('updates the transaction when using the back button', async ({ page }) => {
origin: 'auto.navigation.solidstart.solidrouter',
},
},
transaction: '/',
transaction: '/back-navigation',
transaction_info: {
source: 'url',
},
Expand Down
Loading