When running tests against Safari using Karma, you may find that Karma is able to start a Sauce Labs session and the browser loads the initial Karma runner, but none of your tests ever run. The Karma console is full of keepalive messages, but eventually it times out. What gives?
Turns out, Safari needs two changes made to your Karma config.
First, you'll need to set a hostname, because of the issue Safari has with connecting to localhost. You'll also need to alter your Karma config file to add the
hostnamekey as described in the Karma documentation.
Secondly, you'll need to disable Sauce Connect's SSL re-signing feature. This is on by default and allows users with invalid SSL certificates to run tests. Occasionally though (as with Karma) the replacement certificate is not trusted, and connections fail.
To disable this, edit your Karma config by adding the
connectOptions key to the
sauceLabs object, and have it disable SSL re-signing for all domains:
Check out the documentation for the Karma Sauce Launcher here.
If you don't want to disable SSL re-signing for all your domains, you can do so for selective domains by passing a comma-separated list. You can even use * as a wildcard: