From 0dd1afdacd7fd636466c3bdfcff872408db9a391 Mon Sep 17 00:00:00 2001 From: Anssi Juvonen Date: Fri, 13 Dec 2024 19:33:08 +0200 Subject: [PATCH] Debug toast clicks --- e2e/log.spec.ts | 10 ++++++---- playwright.config.ts | 28 ++++++++++++++-------------- src/views/LogView.vue | 2 +- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/e2e/log.spec.ts b/e2e/log.spec.ts index ce545eb..5150095 100644 --- a/e2e/log.spec.ts +++ b/e2e/log.spec.ts @@ -2,7 +2,7 @@ import {test, expect} from '@playwright/test'; // See here how to get started: // https://playwright.dev/docs/intro -test('logs veggies', async ({page}) => { +test.only('logs veggies', async ({page}) => { await page.goto('/'); await page.getByTestId('home-start-button').click(); await page.getByTestId('veggie-search-button').click(); @@ -17,9 +17,11 @@ 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 elements = page.getByTestId('toast-message'); + while ((await elements.count()) > 0) { + try { + await elements.first().click({force: true}); + } catch (e) {} } await expect(page.getByTestId('toast-message')).toBeHidden(); diff --git a/playwright.config.ts b/playwright.config.ts index 1d6127b..a9aa6b4 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. @@ -22,7 +22,7 @@ export default defineConfig({ timeout: 3000, }, /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, + forbidOnly: false, /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Opt out of parallel tests on CI. */ @@ -47,18 +47,18 @@ export default defineConfig({ /* Configure projects for major browsers */ projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - { - name: 'firefox', - use: { - ...devices['Desktop Firefox'], - }, - }, + // { + // name: 'chromium', + // use: { + // ...devices['Desktop Chrome'], + // }, + // }, + // { + // name: 'firefox', + // use: { + // ...devices['Desktop Firefox'], + // }, + // }, { name: 'Mobile Chrome', use: { diff --git a/src/views/LogView.vue b/src/views/LogView.vue index 5a5c16d..950453f 100644 --- a/src/views/LogView.vue +++ b/src/views/LogView.vue @@ -40,7 +40,7 @@ watch(currentVeggies, (newCurrentVeggies, oldCurrentVeggies) => { addToastMessage(t('toasts.challengeCompleted', [getCheer()])); } else if (allVeggies.value.length % 100 === 0) { addToastMessage(t('toasts.totalVeggies', [allVeggies.value.length, getCheer()])); - } else if (Math.random() <= 0.35) { + } else if (Math.random() <= 1) { const facts = [ ...Object.values(tm(`facts.${addedVeggie}`)), t('toasts.uniqueVeggies', [uniqueVeggies.value.length, ALL_VEGGIES.length, getCheer()]),