Skip to content

Commit

Permalink
fix(solidstart): Make back navigation test less flaky (#13374)
Browse files Browse the repository at this point in the history
🤞 

Closes: #13345
  • Loading branch information
andreiborza authored Aug 14, 2024
1 parent 921e529 commit e3d73ca
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
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

0 comments on commit e3d73ca

Please sign in to comment.