diff --git a/e2e/log.spec.ts b/e2e/log.spec.ts index 5f2eb0d..04e097c 100644 --- a/e2e/log.spec.ts +++ b/e2e/log.spec.ts @@ -17,13 +17,12 @@ test('logs veggies', async ({page}) => { 'This Week 2 Veggies', ); - let elements = await page.getByTestId('toast-message').all(); - for (const element of elements) { - await element.click(); + const toastLocator = page.getByTestId('toast-message'); + + while ((await toastLocator.count()) > 0) { + await toastLocator.nth(0).click(); // Click the first toast message } - elements = await page.getByTestId('toast-message').all(); - expect(elements).toHaveLength(0); await page.getByTestId('navbar-link-settings').click(); await page.getByTestId('navbar-link-log').click(); await expect(page.getByTestId('category-status-chart-center-label')).toHaveText( @@ -75,7 +74,7 @@ test('achievement notifications work', async ({page}) => { await expect(page.getByTestId('dialog')).toBeHidden(); }); -test('weekly achievement works', async ({page}) => { +test.only('weekly achievement works', async ({page}) => { await page.goto('/'); await page.getByTestId('home-start-button').click(); await page.getByTestId('veggie-search-button').click(); diff --git a/e2e/stats.spec.ts b/e2e/stats.spec.ts index 02817a3..900bca7 100644 --- a/e2e/stats.spec.ts +++ b/e2e/stats.spec.ts @@ -7,9 +7,10 @@ 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 toastLocator = page.getByTestId('toast-message'); + + while ((await toastLocator.count()) > 0) { + await toastLocator.nth(0).click(); // Click the first toast message } await page.getByTestId('navbar-link-stats').click(); await expect(page.getByTestId('tag-apple')).toBeVisible();