Skip to content

Conversation

@cacieprins
Copy link
Contributor

  • Closes

Additional details

Browser process spawning was a little unwieldy. This applies the stranger fig pattern by:

  • writing tests for packages/launcher/lib/launch.ts (renamed from browsers.ts to match its export) that focus on its side effects rather than implementation
  • extracting platform specific behavior (darwin arm64) and using template methods for the rest of the platforms
  • using the factory pattern to select which platform to create

Several of the platform classes are empty as placeholders for browser detection logic, and should be expanded as strangler fig is applied to detect and detectByPath. Once the public interface here is strangled, we should consider whether the public interface for @packages/launcher still fits its requirements, or if there are better patterns to expose.

Steps to test

How has the user experience changed?

PR Tasks

@cacieprins cacieprins force-pushed the chore/launcher-launch-refactor branch from 6e623b6 to c238b66 Compare October 9, 2025 19:23
debug('launching browser %o', { browser, url })

// We shouldn't need to check this, because FoundBrowser.path is
// not optional.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of places explicitly coerce unknown POJOs to FoundBrowser, though, so it's important to keep it

import { removeDuplicateBrowsers } from '@packages/data-context/src/sources/BrowserDataSource'
import { knownBrowsers } from './known-browsers'
import * as darwinHelper from './darwin'
import * as darwinHelper from './darwinHelpers'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were renamed because intellisense was complaining that

/lib/darwin/index.ts was too similar to /lib/platforms/Darwin.ts 🤷

@cypress
Copy link

cypress bot commented Oct 14, 2025

cypress    Run #67450

Run Properties:  status check passed Passed #67450  •  git commit 62ca409e7b: Merge branch 'develop' into chore/launcher-launch-refactor
Project cypress
Branch Review chore/launcher-launch-refactor
Run status status check passed Passed #67450
Run duration 19m 31s
Commit git commit 62ca409e7b: Merge branch 'develop' into chore/launcher-launch-refactor
Committer Cacie Prins
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 12
Tests that did not run due to a developer annotating a test with .skip  Pending 1098
Tests that did not run due to a failure in a mocha hook  Skipped 4
Tests that passed  Passing 26694
View all changes introduced in this branch ↗︎

Warning

Partial Report: The results for the Application Quality reports may be incomplete.

UI Coverage  45.48%
  Untested elements 188  
  Tested elements 161  
Accessibility  97.99%
  Failed rules  4 critical   8 serious   2 moderate   2 minor
  Failed elements 101  

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.

2 participants