Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Safari ci #19

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft

Conversation

armanbilge
Copy link
Member

@armanbilge armanbilge commented Sep 7, 2021

Towards #18.

@armanbilge armanbilge marked this pull request as draft September 12, 2021 15:05
@armanbilge
Copy link
Member Author

This turned out to be a bigger yak than I hoped. tl;dr scala-js-selenium-env likes to spin-up many instances of browsers, which works fine for Firefox/Chrome but makes Safari very angry. So this needs some way to close() / quit the Safari instance and/or not create so many of them.

@sjrd
Copy link
Member

sjrd commented Sep 12, 2021

You can turn off parallel testing with

Test / parallelExecution := false

which will in turn create only one browser window.

@armanbilge
Copy link
Member Author

Thanks, I'll try that.

@armanbilge
Copy link
Member Author

Still getting

org.openqa.selenium.SessionNotCreatedException: Could not create a session: The Safari instance is already paired with another WebDriver session.

@armanbilge
Copy link
Member Author

@sjrd the problem is it still seems to be creating two sessions back-to-back ... any ideas about this? Thanks.
https://github.com/scala-js/scala-js-macrotask-executor/pull/19/checks?check_run_id=3580303613#step:8:39

@armanbilge
Copy link
Member Author

@sjrd sorry to bug you about this one again. I think I have a guess what might be happening.

To recap, the problem is that sometimes, non-deterministically there are two Safari sessions being created (which Safari does not allow). Note that I've disabled parallel execution, limited global concurrency, and am only running core/test in CI (not test on the root aggregate and not for any other projects).

2022-04-28 20:00:50.564Z  info [DefaultDriverProvider] Creating a new session for Capabilities {browserName: safari, javascriptEnabled: true, safari.options: {technologyPreview: false}} 
2022-04-28 20:00:54.462Z  info [ProtocolHandshake] Detected dialect: W3C 
2022-04-28 20:00:54.859Z  info [DefaultDriverProvider] Creating a new session for Capabilities {browserName: safari, javascriptEnabled: true, safari.options: {technologyPreview: false}} 
...
 [error] Caused by: org.openqa.selenium.SessionNotCreatedException: Could not create a session: The Safari instance is already paired with another WebDriver session.

Trying to chase this down, my best guess is that the issue lies here:
https://github.com/scala-js/scala-js/blob/0708917912938714d52be1426364f78a3d1fd269/test-adapter/src/main/scala/org/scalajs/testing/adapter/TestAdapter.scala#L120

IIUC, if the getRunnerForThread() method gets invoked multiple times from different threads, you can end up with more than one session. This would explain why this failure is non-deterministic.

Any thoughts/ideas? Thanks :)

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