Skip to content

Conversation

helloworld
Copy link
Contributor

Removed duplicate BrowserTool initialization code that was repeated across multiple test files by creating a shared createBrowserTool helper function.

What changed

  • Created test-helpers.ts with createBrowserTool function that encapsulates the common setup
  • Updated 5 test files to use the shared helper instead of duplicating the initialization code

The helper encapsulates:

  • BrowserTool instantiation with default dimensions (1920x1080)
  • Test context setup including page, browser, and testRun
  • Playwright object enhancement with custom request.newContext

Impact

  • test-browser.ts: -25 lines
  • test-github-login.ts: -75 lines (had 3 duplicate occurrences!)
  • test-keyboard.ts: -25 lines
  • test-email-rendering.ts: -22 lines
  • test-helpers.ts: +55 lines (new file)

Net reduction: 92 lines removed 🎉

This makes the test code more maintainable and reduces duplication significantly.

Removed duplicate BrowserTool initialization code that was repeated across
multiple test files by creating a shared createBrowserTool helper function.

The helper encapsulates:
- BrowserTool instantiation with default dimensions
- Test context setup including page, browser, and testRun
- Playwright object enhancement with custom request.newContext

Changes:
- Created test-helpers.ts with createBrowserTool function (+55 lines)
- Simplified test-browser.ts (-25 lines)
- Simplified test-github-login.ts (-75 lines, 3 occurrences)
- Simplified test-keyboard.ts (-25 lines)
- Simplified test-email-rendering.ts (-22 lines)

Net reduction: 92 lines removed
Copy link

vercel bot commented Jun 24, 2025

@helloworld is attempting to deploy a commit to the Antiwork Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Jun 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
shortest ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2025 7:12pm

@rmarescu rmarescu changed the title Extract duplicate test setup code into shared helper chore: extract duplicate test setup code into shared helper Jun 26, 2025
@rmarescu rmarescu merged commit 28da065 into antiwork:main Jun 26, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants