Skip to content

Commit

Permalink
Return all tests to the run
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuvonen committed Dec 13, 2024
1 parent 0dd1afd commit 90b5567
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
7 changes: 5 additions & 2 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.only('logs veggies', async ({page}) => {
test('logs veggies', async ({page}) => {
await page.goto('/');
await page.getByTestId('home-start-button').click();
await page.getByTestId('veggie-search-button').click();
Expand All @@ -20,8 +20,11 @@ test.only('logs veggies', async ({page}) => {
const elements = page.getByTestId('toast-message');
while ((await elements.count()) > 0) {
try {
// eslint-disable-next-line playwright/no-force-option
await elements.first().click({force: true});
} catch (e) {}
} catch (e) {
console.error(e);
}
}

await expect(page.getByTestId('toast-message')).toBeHidden();
Expand Down
11 changes: 8 additions & 3 deletions e2e/stats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ 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 elements = page.getByTestId('toast-message');
while ((await elements.count()) > 0) {
try {
// eslint-disable-next-line playwright/no-force-option
await elements.first().click({force: true});
} catch (e) {
console.error(e);
}
}
await page.getByTestId('navbar-link-stats').click();
await expect(page.getByTestId('tag-apple')).toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: false,
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
Expand Down

0 comments on commit 90b5567

Please sign in to comment.