Skip to content

Commit

Permalink
fix: update workflows [skip ci]
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
vCaisim committed Sep 26, 2024
1 parent f13dbc3 commit 3cdb522
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 31 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-basic-failed-only-or8n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
test-or8n:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
timeout-minutes: 60
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/test-basic-failed-only-shards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
test-shards:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
timeout-minutes: 60
Expand Down Expand Up @@ -37,23 +38,27 @@ 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 }}"
echo "Running command: $COMMAND"
$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
54 changes: 27 additions & 27 deletions basic/3-assertions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
// });
});
10 changes: 10 additions & 0 deletions basic/pw.config.shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@ const config: PlaywrightTestConfig = {
use: {
...devices["Desktop Chrome"],
},
testMatch: [
"1-getting-started.spec.ts",
"3-assertions.spec.ts",
"5-flaky.spec.ts",
],
},
{
name: "b",
retries: 2,
use: {
...devices["Desktop Chrome"],
},
testMatch: [
"1-getting-started.spec.ts",
"3-assertions.spec.ts",
"5-flaky.spec.ts",
],
},
],

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down

0 comments on commit 3cdb522

Please sign in to comment.