Skip to content

refactor: extract navigateToApiKeys helper to pages/settings.ts#823

Open
empiricalrun[bot] wants to merge 3 commits intomainfrom
chat-session_HClhuVPYgnnl
Open

refactor: extract navigateToApiKeys helper to pages/settings.ts#823
empiricalrun[bot] wants to merge 3 commits intomainfrom
chat-session_HClhuVPYgnnl

Conversation

@empiricalrun
Copy link
Copy Markdown
Contributor

@empiricalrun empiricalrun Bot commented Apr 7, 2026

Summary

Identified a repeated 3-line navigation pattern in tests/api-keys.spec.ts that appeared 15 times:

await page.goto("/");
await page.getByRole('link', { name: 'Settings' }).click();
await page.getByRole('link', { name: 'API Keys' }).click();

Changes

New file: tests/pages/settings.ts

Added a navigateToApiKeys(page) helper that:

  1. Navigates to /
  2. Clicks the Settings nav link
  3. Clicks the API Keys sub-link
  4. Waits for the API Keys heading to confirm the page has loaded

Updated: tests/api-keys.spec.ts

  • Imported navigateToApiKeys from ./pages/settings
  • Replaced all 15 occurrences of the 3-line pattern with a single await navigateToApiKeys(page) call

Result

  • ~30 lines of repeated boilerplate removed from api-keys.spec.ts
  • Navigation logic is now centralised in one place — if the UI changes (e.g. the link label changes), only settings.ts needs updating
  • TypeScript compilation passes with no errors

PR created from session #112363

Updated at 2026-04-07 04:55:15.165 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