Skip to content

refactor: extract waitForPullRequestCreated helper#892

Open
empiricalrun[bot] wants to merge 12 commits intomainfrom
chat-session_DTePoNRFdNHK
Open

refactor: extract waitForPullRequestCreated helper#892
empiricalrun[bot] wants to merge 12 commits intomainfrom
chat-session_DTePoNRFdNHK

Conversation

@empiricalrun
Copy link
Copy Markdown
Contributor

@empiricalrun empiricalrun Bot commented May 2, 2026

Summary

Extracted a repeated inline assertion into a named helper function waitForPullRequestCreated in tests/pages/sessions.ts.

Problem

The pattern below appeared 7 times across 5 test files, always with the same 5-minute timeout:

await expect(page.getByText("Used createPullRequest")).toBeVisible({ timeout: 300000 });

Change

Added one helper to tests/pages/sessions.ts:

export async function waitForPullRequestCreated(page: Page, nth: number = 0): Promise<void> {
  await expect(page.getByText('Used createPullRequest').nth(nth)).toBeVisible({ timeout: 300000 });
}

The optional nth parameter handles the case in session-two-prs.spec.ts where a second PR occurrence needs to be awaited (waitForPullRequestCreated(page, 1)).

Files updated

File Change
tests/pages/sessions.ts Added waitForPullRequestCreated helper
tests/merge-conflicts.spec.ts 2 call-sites replaced
tests/merge-conflicts-impacted-tests.spec.ts 2 call-sites replaced
tests/edit-message-branch-restore.spec.ts 1 call-site replaced
tests/my-sessions.spec.ts 1 call-site replaced
tests/session-two-prs.spec.ts 2 call-sites replaced (including nth(1))

TypeScript compiles with no errors.

PR created from session #127680

Updated at 2026-05-02 04:55:21.855 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants