From 3cdb522dbff8e98a4be9cddbb8c2ce060b5e720d Mon Sep 17 00:00:00 2001 From: Veaceslav <118342408+vCaisim@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:34:57 +0300 Subject: [PATCH] fix: update workflows [skip ci] fix: remove continue-on-error [skip ci] fix: id [skip ci] chore: reduce testing suite [skip ci] chore: show debug logs [skip ci] fix: rely on generated ID [skip ci] fix: use job-index instead of node-index [skip ci] fix: set fail-fast option to false for workflow strategy [skip ci] --- .../workflows/test-basic-failed-only-or8n.yml | 1 + .../test-basic-failed-only-shards.yml | 11 ++-- basic/3-assertions.spec.ts | 54 +++++++++---------- basic/pw.config.shared.ts | 10 ++++ package.json | 2 +- 5 files changed, 47 insertions(+), 31 deletions(-) diff --git a/.github/workflows/test-basic-failed-only-or8n.yml b/.github/workflows/test-basic-failed-only-or8n.yml index 81c560f..0ba416a 100644 --- a/.github/workflows/test-basic-failed-only-or8n.yml +++ b/.github/workflows/test-basic-failed-only-or8n.yml @@ -6,6 +6,7 @@ on: jobs: test-or8n: strategy: + fail-fast: false matrix: shard: [1, 2, 3] timeout-minutes: 60 diff --git a/.github/workflows/test-basic-failed-only-shards.yml b/.github/workflows/test-basic-failed-only-shards.yml index b12c0e1..ace8900 100644 --- a/.github/workflows/test-basic-failed-only-shards.yml +++ b/.github/workflows/test-basic-failed-only-shards.yml @@ -6,6 +6,7 @@ on: jobs: test-shards: strategy: + fail-fast: false matrix: shard: [1, 2, 3] timeout-minutes: 60 @@ -37,16 +38,16 @@ jobs: npm install -g @currents/cmd@beta - name: Prepare environment & load last run from cache for shard ${{ matrix.shard }} + env: + DEBUG: "currents,currents:*" run: | - GH_STRATEGY_NODE_INDEX=$(( ${{ strategy.node-index }} + 1 )) - echo "GH_STRATEGY_NODE_INDEX=$GH_STRATEGY_NODE_INDEX" >> $GITHUB_ENV + echo "GH_STRATEGY_JOB_INDEX=${{ strategy.job-index }}" >> $GITHUB_ENV echo "GH_STRATEGY_JOB_TOTAL=${{ strategy.job-total }}" >> $GITHUB_ENV npx currents cache get --preset last-run --pw-output-dir basic/test-results --pw-config-dump .pw_config_dump echo "EXTRA_PW_FLAGS=$(cat .pw_config_dump)" >> $GITHUB_ENV - name: Run Tests - continue-on-error: true working-directory: ./basic run: | COMMAND="npx pwc ${{ env.EXTRA_PW_FLAGS }}" @@ -54,6 +55,10 @@ jobs: $COMMAND - name: Cache the last run results for shard ${{ matrix.shard }} + env: + DEBUG: "currents,currents:*" if: ${{ always() }} run: | + echo "GH_STRATEGY_JOB_INDEX=${{ strategy.job-index }}" >> $GITHUB_ENV + echo "GH_STRATEGY_JOB_TOTAL=${{ strategy.job-total }}" >> $GITHUB_ENV npx currents cache set --preset last-run --pw-output-dir basic/test-results diff --git a/basic/3-assertions.spec.ts b/basic/3-assertions.spec.ts index 1f23194..7694abc 100644 --- a/basic/3-assertions.spec.ts +++ b/basic/3-assertions.spec.ts @@ -22,34 +22,34 @@ test("should be able to use assertions", async ({ page }) => { await input.press("Enter"); }); - await test.step("toHaveCount/toHaveText/toContainText", async () => { - const items = page.locator(".todo-list li"); - await expect(items).toHaveCount(1); - await expect(items.first()).toHaveText("Buy milk"); - await expect(items).toHaveText(["Buy milk"]); - await expect(items.first()).toContainText("milk"); - }); + // await test.step("toHaveCount/toHaveText/toContainText", async () => { + // const items = page.locator(".todo-list li"); + // await expect(items).toHaveCount(1); + // await expect(items.first()).toHaveText("Buy milk"); + // await expect(items).toHaveText(["Buy milk"]); + // await expect(items.first()).toContainText("milk"); + // }); - await test.step("toBeChecked", async () => { - const firstItemCheckbox = page.locator( - 'input[type=checkbox]:left-of(:text("Buy milk"))' - ); - await expect(firstItemCheckbox).not.toBeChecked(); - await page.check('div input[type="checkbox"]'); - await expect(firstItemCheckbox).toBeChecked(); - }); + // await test.step("toBeChecked", async () => { + // const firstItemCheckbox = page.locator( + // 'input[type=checkbox]:left-of(:text("Buy milk"))' + // ); + // await expect(firstItemCheckbox).not.toBeChecked(); + // await page.check('div input[type="checkbox"]'); + // await expect(firstItemCheckbox).toBeChecked(); + // }); - await test.step("toBeVisible/toBeHidden", async () => { - await expect(page.locator("text=Buy milk")).toBeVisible(); - await page.click("text=Active"); - await expect(page.locator("text=Buy milk")).toBeHidden(); - }); + // await test.step("toBeVisible/toBeHidden", async () => { + // await expect(page.locator("text=Buy milk")).toBeVisible(); + // await page.click("text=Active"); + // await expect(page.locator("text=Buy milk")).toBeHidden(); + // }); - await test.step("toHaveClass/toHaveCSS", async () => { - await expect( - page.locator('[placeholder="What needs to be done?"]') - ).toHaveClass("new-todo"); - await page.click("text=Clear completed"); - await expect(page.locator(".main")).toHaveCSS("display", "none"); - }); + // await test.step("toHaveClass/toHaveCSS", async () => { + // await expect( + // page.locator('[placeholder="What needs to be done?"]') + // ).toHaveClass("new-todo"); + // await page.click("text=Clear completed"); + // await expect(page.locator(".main")).toHaveCSS("display", "none"); + // }); }); diff --git a/basic/pw.config.shared.ts b/basic/pw.config.shared.ts index 15f2b09..da3d4d6 100644 --- a/basic/pw.config.shared.ts +++ b/basic/pw.config.shared.ts @@ -32,6 +32,11 @@ const config: PlaywrightTestConfig = { use: { ...devices["Desktop Chrome"], }, + testMatch: [ + "1-getting-started.spec.ts", + "3-assertions.spec.ts", + "5-flaky.spec.ts", + ], }, { name: "b", @@ -39,6 +44,11 @@ const config: PlaywrightTestConfig = { use: { ...devices["Desktop Chrome"], }, + testMatch: [ + "1-getting-started.spec.ts", + "3-assertions.spec.ts", + "5-flaky.spec.ts", + ], }, ], diff --git a/package.json b/package.json index 81890a1..4eb6cef 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "test:basic": "playwright test --config basic\\playwright.config.ts" + "test:basic": "playwright test --config basic/playwright.config.ts" }, "keywords": [], "author": "",