Skip to content
Merged
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
16 changes: 11 additions & 5 deletions src/tests/Produkter/Produkter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@

await expect(page.getByRole('button', { name: 'KJØP' })).toBeVisible();

// Click the buy button and wait for it to complete
await page.getByRole('button', { name: 'KJØP' }).click();

await page.locator('#header').getByText('1').waitFor();

await expect(page.locator('#header').getByText('1')).toBeVisible({
timeout: 15000,

// Wait for network idle to ensure any API calls complete
await page.waitForLoadState('networkidle');

// More specific selector for the cart count and consistent timeout
const cartCountSelector = '#header';

// Wait for cart count to be visible and equal to "1"
await expect(page.locator(cartCountSelector).getByText('1')).toBeVisible({

Check failure on line 30 in src/tests/Produkter/Produkter.spec.ts

View workflow job for this annotation

GitHub Actions / test

[webkit] › src/tests/Produkter/Produkter.spec.ts:8:7 › Produkter › Test at vi kan kjøpe produktet

1) [webkit] › src/tests/Produkter/Produkter.spec.ts:8:7 › Produkter › Test at vi kan kjøpe produktet Error: Timed out 30000ms waiting for expect(locator).toBeVisible() Locator: locator('#header').getByText('1') Expected: visible Received: <element(s) not found> Call log: - expect.toBeVisible with timeout 30000ms - waiting for locator('#header').getByText('1') 28 | 29 | // Wait for cart count to be visible and equal to "1" > 30 | await expect(page.locator(cartCountSelector).getByText('1')).toBeVisible({ | ^ 31 | timeout: 30000 32 | }); 33 | at /home/runner/work/nextjs-woocommerce/nextjs-woocommerce/src/tests/Produkter/Produkter.spec.ts:30:66
timeout: 30000
});

await page.getByRole('link', { name: 'Handlekurv' }).click();
Expand Down
Loading