From 3c73da51b95d76b8ad4d86aee1416053e4cf6438 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 28 May 2026 07:09:21 +0200 Subject: [PATCH] test: fix flaky `issue-comment` close test (#37880) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After posting a comment the page reloads via fetch-action. Clicking "Close Issue" before the form re-initializes triggers a native form submit, which navigates to the raw JSON redirect response (`{"redirect":...}`) instead of the issue, so "Reopen Issue" never appears and the test times out (observed on Firefox in CI). Wait for the comment button to become disabled — which only happens once the form re-initializes — before clicking "Close Issue". --- This PR was written with the help of Claude Opus 4.7 Co-authored-by: Claude (Opus 4.7) Co-authored-by: Nicolas --- tests/e2e/issue-comment.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/e2e/issue-comment.test.ts b/tests/e2e/issue-comment.test.ts index d3de59ba5f..414e0567ce 100644 --- a/tests/e2e/issue-comment.test.ts +++ b/tests/e2e/issue-comment.test.ts @@ -18,7 +18,9 @@ test('comment on and close an issue', async ({page, request}) => { await page.getByRole('button', {name: 'Comment', exact: true}).click(); await expect(page.locator('.comment-body').filter({hasText: body})).toBeVisible(); - // posting reloaded the page with an empty box, so the status button now reads "Close Issue" + // wait for the form to re-initialize (the empty box disables the comment button); a close click + // before that does a native submit which lands on a raw JSON page instead of reloading the issue + await expect(page.getByRole('button', {name: 'Comment', exact: true})).toBeDisabled(); await page.getByRole('button', {name: 'Close Issue'}).click(); await expect(page.getByRole('button', {name: 'Reopen Issue'})).toBeVisible(); });