Skip to content

[🐛 Bug]: running tests in Safari on GitHub Actions fails #14927

@chrisguttandin

Description

@chrisguttandin

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

v9.21.0

Node.js Version

v22.17.1

Mode

Standalone Mode

Which capabilities are you using?

{
    browserName: 'safari'
    platformName: 'osx'
}

What happened?

I'm trying run tests with Vitest and its @vitest/browser-webdriverio (https://github.com/vitest-dev/vitest/tree/main/packages/browser-webdriverio) package. For some reason it works as expected when running the code locally on macOS. But it fails on GitHub Actions.

I set up a minimal demo project with a failing CI: https://github.com/chrisguttandin/vitest-webdriverio.

It ultimately fails with the following error:

Failed to execute WebDriver Bidi command "send" as no Bidi session was established. Make sure you enable it by setting "webSocketUrl: true" in your capabilities and verify that your environment and browser supports it.

But I do not set the webSocketUrl in the capabilities and I even use 'wdio:enforceWebDriverClassic' to make sure it doesn't use WebDriver Bidi.

https://github.com/chrisguttandin/vitest-webdriverio/blob/8485b85acd7482ce8da608778ada3d293c796b31/vite.config.ts#L14

What is your expected behavior?

It would expect it to run the tests on GitHub Actions as well as on a MacBook.

How to reproduce the bug.

The example repo can be used to reproduce the bug.

Relevant log output

RUN  v4.0.15 /Users/runner/work/vitest-webdriverio/vitest-webdriverio

2025-12-10T09:08:19.632Z INFO webdriver: Initiate new session using the WebDriver protocol
2025-12-10T09:08:20.103Z INFO @wdio/utils: Started SafariDriver in 429ms on port 49184
2025-12-10T09:08:20.117Z INFO webdriver: [POST] http://localhost:49184/session
2025-12-10T09:08:26.293Z INFO webdriver: COMMAND getWindowHandle()
2025-12-10T09:08:26.294Z INFO webdriver: [GET] http://localhost:49184/session/4D4428E7-BF5D-45BB-BF23-2F0EA56D6CB6/window
2025-12-10T09:08:26.891Z INFO webdriver: RESULT page-956C6AE8-86C1-443D-8273-7945B2585DA0
2025-12-10T09:08:26.892Z INFO webdriver: COMMAND navigateTo("http://127.0.0.1:63315/__vitest_test__/?sessionId=92838a22-ea27-4ada-8506-cbb1681e469b")
2025-12-10T09:08:26.892Z INFO webdriver: [POST] http://localhost:49184/session/4D4428E7-BF5D-45BB-BF23-2F0EA56D6CB6/url
2025-12-10T09:08:26.892Z INFO webdriver: DATA {"url":"http://127.0.0.1:63315/__vitest_test__/?sessionId=92838a22-ea27-4ada-8506-cbb1681e469b"}
2025-12-10T09:08:28.638Z INFO webdriver: RESULT null
2025-12-10T09:08:28.640Z INFO webdriver: COMMAND getWindowHandle()
2025-12-10T09:08:28.640Z INFO webdriver: [GET] http://localhost:49184/session/4D4428E7-BF5D-45BB-BF23-2F0EA56D6CB6/window
2025-12-10T09:08:28.758Z INFO webdriver: RESULT page-956C6AE8-86C1-443D-8273-7945B2585DA0
⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯

Vitest caught 1 unhandled error during the test run.

This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
 Test Files   (1)

      Tests  no tests
⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯
     Errors  1 error
Error: Failed to run the test /Users/runner/work/vitest-webdriverio/vitest-webdriverio/index.spec.ts.
   Start at  09:08:19
  node_modules/vitest/dist/chunks/cli-api.C7sYjHmQ.js:7237:17
   Duration  11.71s (transform 0ms, setup 0ms, import 0ms, tests 0ms, environment 0ms)
  processTicksAndRejections node:internal/process/task_queues:105:5


2025-12-10T09:08:31.330Z INFO webdriver: COMMAND deleteSession()
Caused by: Error: Failed to execute WebDriver Bidi command "send" as no Bidi session was established. Make sure you enable it by setting "webSocketUrl: true" in your capabilities and verify that your environment and browser supports it.
2025-12-10T09:08:31.331Z INFO webdriver: [DELETE] http://localhost:49184/session/4D4428E7-BF5D-45BB-BF23-2F0EA56D6CB6
  Browser.protocolCommand node_modules/webdriver/build/node.js:1341:13
2025-12-10T09:08:31.399Z INFO webdriver: RESULT null
  Browser.wrapCommandFn node_modules/@wdio/utils/build/index.js:982:32
2025-12-10T09:08:31.399Z INFO webdriver: Kill driver process with PID 1317
  Browser.<anonymous> node_modules/@wdio/utils/build/index.js:1097:20
  WebdriverBrowserProvider.setViewport node_modules/@vitest/browser-webdriverio/dist/index.js:463:22
  Object.viewport [as __vitest_viewport] node_modules/@vitest/browser-webdriverio/dist/index.js:367:25
  ProjectBrowser.triggerCommand node_modules/@vitest/browser/dist/index.js:2440:30
  Proxy.triggerCommand node_modules/@vitest/browser/dist/index.js:3109:34
  WebSocket.onMessage node_modules/@vitest/browser/dist/index.js:2839:29
  processTicksAndRejections node:internal/process/task_queues:105:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Error: Process completed with exit code 1.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions