fix(browser): avoid safaridriver collision #4863
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4706.
Removes code from node/providers/webdriver.ts causing the following error when running
vitest --browser.name=safari
on macOS:Cause
safaridriver.start() maintains a static reference to a safaridriver instance, and will fail with this error if start() is called again before stop().
The original node/providers/webdriver.ts calls safaridriver.start() directly, and then immediately imports and calls webdriverio.remote(). This call also eventually calls safaridriver.start(), producing the error.
The fix is to remove the direct safaridriver access, as webdriverio seems to manage safaridriver successfully now.
Testing
Since Safari can't run in headless mode, I couldn't think of a way to add a test that would run in CI. However, I added a new
test:safaridriver
target intended to be run manually as needed, which runs all the existing test/browser tests under Safari.Enabling/documentation
Note that you have to enable automation in Safari via Developer > Allow remote automation, or else running with the safaridriver will fail with:
If it would be helpful to add a doc change for this, or to open a new PR for one, I'm happy to do that.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.