Skip to content

Commit

Permalink
Debug toast clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuvonen committed Dec 13, 2024
1 parent e1d9cec commit 0dd1afd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
10 changes: 6 additions & 4 deletions e2e/log.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}) => {

Check failure on line 5 in e2e/log.spec.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected focused test
await page.goto('/');
await page.getByTestId('home-start-button').click();
await page.getByTestId('veggie-search-button').click();
Expand All @@ -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});

Check warning on line 23 in e2e/log.spec.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of { force: true } option
} catch (e) {}

Check failure on line 24 in e2e/log.spec.ts

View workflow job for this annotation

GitHub Actions / lint

'e' is defined but never used
}

await expect(page.getByTestId('toast-message')).toBeHidden();
Expand Down
28 changes: 14 additions & 14 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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. */
Expand All @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion src/views/LogView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>(tm(`facts.${addedVeggie}`)),
t('toasts.uniqueVeggies', [uniqueVeggies.value.length, ALL_VEGGIES.length, getCheer()]),
Expand Down

0 comments on commit 0dd1afd

Please sign in to comment.