From f99aafcca03235f3eea75978206e36ba07386ac1 Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Mon, 10 Nov 2025 18:04:47 +0700 Subject: [PATCH 1/3] remove e2e failure comment if e2e test passes --- .github/workflows/ci.yml | 50 +++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ffedd8ab..81ceb74fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,15 +101,32 @@ jobs: retention-days: 30 - name: Comment PR with Playwright artifact link - if: failure() && github.event_name == 'pull_request' + if: always() && github.event_name == 'pull_request' uses: actions/github-script@v7 with: script: | const runId = context.runId; const repo = context.repo; const artifactUrl = `https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId}`; + const identifier = ''; - const comment = `## ❌ Playwright Tests Failed + // Find existing comment + const { data: comments } = await github.rest.issues.listComments({ + issue_number: context.issue.number, + owner: repo.owner, + repo: repo.repo, + }); + + const existingComment = comments.find(comment => + comment.body?.includes(identifier) + ); + + // Determine if tests passed or failed + const testsFailed = '${{ job.status }}' !== 'success'; + + if (testsFailed) { + const comment = `${identifier} + ## ❌ Playwright Tests Failed The Playwright tests have failed. Please download the test report artifact to see detailed information about the failures: @@ -123,12 +140,29 @@ jobs: The report includes screenshots, videos, and detailed traces of the failed tests.`; - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: repo.owner, - repo: repo.repo, - body: comment - }); + if (existingComment) { + await github.rest.issues.updateComment({ + owner: repo.owner, + repo: repo.repo, + comment_id: existingComment.id, + body: comment + }); + } else { + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: repo.owner, + repo: repo.repo, + body: comment + }); + } + } else if (existingComment) { + // Tests passed - delete the failure comment + await github.rest.issues.deleteComment({ + owner: repo.owner, + repo: repo.repo, + comment_id: existingComment.id + }); + } report_coverage: runs-on: ubuntu-latest From d2680f94a3bc42ac3b9e4196d923fefd040ca661 Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Mon, 10 Nov 2025 18:05:21 +0700 Subject: [PATCH 2/3] force fail --- e2e/hashlink.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/hashlink.spec.ts b/e2e/hashlink.spec.ts index 5f2fa6553..a1366091b 100644 --- a/e2e/hashlink.spec.ts +++ b/e2e/hashlink.spec.ts @@ -107,7 +107,8 @@ test.describe('Hash Links', () => { if (!headingId) continue; // Verify heading exists and is visible - await expect(heading).toBeVisible(); + // TODO: will fail + await expect(heading).toBeHidden(); // Find the hash link within or near this heading const link = page From 51e7a90b48d069826d79150e0df199d3fd003647 Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Mon, 10 Nov 2025 18:07:26 +0700 Subject: [PATCH 3/3] fix test --- e2e/hashlink.spec.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/hashlink.spec.ts b/e2e/hashlink.spec.ts index a1366091b..5f2fa6553 100644 --- a/e2e/hashlink.spec.ts +++ b/e2e/hashlink.spec.ts @@ -107,8 +107,7 @@ test.describe('Hash Links', () => { if (!headingId) continue; // Verify heading exists and is visible - // TODO: will fail - await expect(heading).toBeHidden(); + await expect(heading).toBeVisible(); // Find the hash link within or near this heading const link = page