Skip to content

Commit

Permalink
Removing vite export to test
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiborza committed Sep 4, 2024
1 parent 414d54c commit 155f21e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';

async function safeGoto(page, url) {
for (let i = 0; i < 3; i++) {
try {
await page.goto(url, { waitUntil: 'domcontentloaded' });
return; // Exit if successful
} catch (error) {
console.log(`Retrying navigation (${i + 1}/3)...`);
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 2 seconds before retrying
}
}
throw new Error('Failed to navigate to the page after 3 attempts');
}

// Use safeGoto in your tests


test('captures an exception', async ({ page }) => {
const errorEventPromise = waitForError('solidstart', errorEvent => {
return (
Expand All @@ -10,7 +26,8 @@ test('captures an exception', async ({ page }) => {
);
});

await page.goto('/client-error', { waitUntil: 'networkidle' });
await safeGoto(page, '/client-error');
// await page.goto('/client-error');
await page.locator('#caughtErrorBtn').click();
const errorEvent = await errorEventPromise;

Expand Down
6 changes: 1 addition & 5 deletions packages/solidstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,11 @@
},
"peerDependencies": {
"@solidjs/router": "^0.13.4",
"@solidjs/start": "^1.0.0",
"vite": "*"
"@solidjs/start": "^1.0.0"
},
"peerDependenciesMeta": {
"@solidjs/router": {
"optional": true
},
"vite": {
"optional": true
}
},
"dependencies": {
Expand Down

0 comments on commit 155f21e

Please sign in to comment.