diff --git a/e2e/log.spec.ts b/e2e/log.spec.ts index ce545eb..3713741 100644 --- a/e2e/log.spec.ts +++ b/e2e/log.spec.ts @@ -17,9 +17,9 @@ test('logs veggies', async ({page}) => { 'This Week 2 Veggies', ); - const elements = await page.getByTestId('toast-message').all(); - for (const element of elements) { - await element.click(); + const toasts = page.getByTestId('toast-message'); + while ((await toasts.count()) > 0) { + await toasts.first().click({force: true}); } await expect(page.getByTestId('toast-message')).toBeHidden(); diff --git a/e2e/stats.spec.ts b/e2e/stats.spec.ts index 02817a3..024936a 100644 --- a/e2e/stats.spec.ts +++ b/e2e/stats.spec.ts @@ -7,9 +7,9 @@ test("shows current week's veggies", async ({page}) => { await page.getByText(/^apple$/).click(); await page.getByText('Apricot').click(); await page.getByText('Avocado').click(); - const elements = await page.getByTestId('toast-message').all(); - for (const element of elements) { - await element.click(); + const toasts = page.getByTestId('toast-message'); + while ((await toasts.count()) > 0) { + await toasts.first().click({force: true}); } await page.getByTestId('navbar-link-stats').click(); await expect(page.getByTestId('tag-apple')).toBeVisible(); diff --git a/playwright.config.ts b/playwright.config.ts index 1d6127b..8050f39 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -13,7 +13,7 @@ import {defineConfig, devices} from '@playwright/test'; export default defineConfig({ testDir: './e2e', /* Maximum time one test can run for. */ - timeout: 10 * 1000, + timeout: 6 * 1000, expect: { /** * Maximum time expect() should wait for the condition to be met. @@ -39,8 +39,7 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', - /* Only on CI systems run the tests headless */ - headless: !!process.env.CI, + headless: false, testIdAttribute: 'data-test-id', },