karma-runner / karma-safari-launcher

A Karma plugin. Launcher for Safari.
MIT License
19 stars 17 forks source link

Fails to launch Safari #12

Open stevebroshar opened 9 years ago

stevebroshar commented 9 years ago

We use safari for unit testing on Mac. But the karma safari launcher has been failing to launch safari since January. I did see that Safari was upgraded (to version 7.1.2) on the test runner machine at about that date so maybe it's due to that. I decided to wait a while until seeking assistance since maybe the problem would go away with an even newer version of safari or the launcher. But, even with the latest safari (7.1.6) and the latest launcher it still fails.

Does it only fail for me? If not, then it seems no one uses this component. Is it unloved?

From the build log:

[14:34:24][Step 1/1] INFO [karma]: Karma v0.12.32 server started at http://localhost:9876/
[14:34:24][Step 1/1] INFO [launcher]: Starting browser Safari
[14:34:24][Step 1/1] WARN [preprocess]: Can not load "html2js", it is not registered!
[14:34:24][Step 1/1]   Perhaps you are missing some plugin?
[14:35:24][Step 1/1] WARN [launcher]: Safari have not captured in 60000 ms, killing.
[14:35:24][Step 1/1] INFO [launcher]: Trying to start Safari again (1/2).
[14:36:24][Step 1/1] WARN [launcher]: Safari have not captured in 60000 ms, killing.
[14:36:24][Step 1/1] INFO [launcher]: Trying to start Safari again (2/2).
[14:37:24][Step 1/1] WARN [launcher]: Safari have not captured in 60000 ms, killing.
[14:37:24][Step 1/1] ERROR [launcher]: Safari failed 2 times (timeout). Giving up.
[14:37:24][Step 1/1] Process exited with code 1
[14:37:24][Step 1/1] Step Command Line failed

We get the warning about html2js even for successful runs (using chrome or firefox) so I don't think it's an issue.

dignifiedquire commented 9 years ago

Thanks for reporting, luckily I'm a mac user, so I should be able to test this easily.

dignifiedquire commented 9 years ago

I just tested it and all is fine under OS X 10.10.3 with Safari 8.0.6. Maybe fixing this line

WARN [preprocess]: Can not load "html2js", it is not registered!
[14:34:24][Step 1/1]   Perhaps you are missing some plugin?

could help?

valkirilov commented 8 years ago

The same problem, but with Safari on Windows

01 12 2015 16:18:40.625:INFO [karma]: Karma v0.13.15 server started at http://localhost:9876/
01 12 2015 16:18:40.687:INFO [launcher]: Starting browser Safari
01 12 2015 16:19:40.701:WARN [launcher]: Safari have not captured in 60000 ms, killing.
01 12 2015 16:19:42.701:WARN [launcher]: Safari was not killed in 2000 ms, sending SIGKILL.
01 12 2015 16:19:44.706:WARN [launcher]: Safari was not killed by SIGKILL in 2000 ms, continuing.
adambiggs commented 8 years ago

+1

Not working using Safari 9.0.3 under OSX 10.11.3.

refractalize commented 8 years ago

Not sure if this is related, or even the fault of the launcher, but I'm getting "Safari quit unexpectedly" on Safari 9.0.3 under OS X 10.11.3. Is this what you're seeing @adambiggs?

image

31 03 2016 09:29:38.121:WARN [karma]: No captured browser, open http://localhost:9876/
31 03 2016 09:29:38.123:DEBUG [watcher]: Watching "/var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/fa9981847e31dbcca4efa33e90115c2e.browserify"
31 03 2016 09:29:38.123:DEBUG [watcher]: Watching "/Users/tim/dev/plastiq/test/browser"
31 03 2016 09:29:38.126:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
31 03 2016 09:29:38.134:INFO [launcher]: Starting browser Safari
31 03 2016 09:29:38.135:DEBUG [temp-dir]: Creating temp dir at /var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/karma-93118393
31 03 2016 09:29:38.153:DEBUG [launcher]: /Applications/Safari.app/Contents/MacOS/Safari /var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/karma-93118393/redirect.html
31 03 2016 09:29:45.213:DEBUG [launcher]: Process Safari exited with code 0
31 03 2016 09:29:45.213:ERROR [launcher]: Cannot start Safari

31 03 2016 09:29:45.213:DEBUG [temp-dir]: Cleaning temp dir /var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/karma-93118393
31 03 2016 09:29:45.223:INFO [launcher]: Trying to start Safari again (1/2).
31 03 2016 09:29:45.224:DEBUG [launcher]: Restarting Safari
31 03 2016 09:29:45.224:DEBUG [temp-dir]: Creating temp dir at /var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/karma-93118393
31 03 2016 09:29:45.225:DEBUG [launcher]: /Applications/Safari.app/Contents/MacOS/Safari /var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/karma-93118393/redirect.html
31 03 2016 09:29:52.129:DEBUG [launcher]: Process Safari exited with code 0
31 03 2016 09:29:52.129:ERROR [launcher]: Cannot start Safari

31 03 2016 09:29:52.129:DEBUG [temp-dir]: Cleaning temp dir /var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/karma-93118393
31 03 2016 09:29:52.131:INFO [launcher]: Trying to start Safari again (2/2).
31 03 2016 09:29:52.132:DEBUG [launcher]: Restarting Safari
31 03 2016 09:29:52.132:DEBUG [temp-dir]: Creating temp dir at /var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/karma-93118393
31 03 2016 09:29:52.132:DEBUG [launcher]: /Applications/Safari.app/Contents/MacOS/Safari /var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/karma-93118393/redirect.html
31 03 2016 09:29:59.084:DEBUG [launcher]: Process Safari exited with code 0
31 03 2016 09:29:59.084:ERROR [launcher]: Cannot start Safari

31 03 2016 09:29:59.084:DEBUG [temp-dir]: Cleaning temp dir /var/folders/dd/hq6scdcs1tvcq0xvyrh577l40000gn/T/karma-93118393
31 03 2016 09:29:59.086:ERROR [launcher]: Safari failed 2 times (cannot start). Giving up.
ericperez commented 7 years ago

Hello,

I realize this is an older thread but I'm having a similar problem, only with Safari 10. I just updated Safari to 10.0 on Mac OS 10.11.6 (El Capitan) yesterday and after rebooting now my karma tests do not run in Safari. I'm using karma-safari-launcher@1.0.0. I thought this was similar enough to this issue to put here but I can open a new issue that's more helpful. Before upgrading to Safari 10, the tests were working fine in Safari 9. The launcher appears to start Safari 10 up but the karma tests don't appear to run and so it just times outs.

Here's what the console says:

Chrome 53.0.2785 (Mac OS X 10.11.6): Executed 33 of 36 (skipped 3) SUCCESS (0.178 secs / 0.072 secs) Firefox 49.0.0 (Mac OS X 10.11.0): Executed 33 of 36 (skipped 3) SUCCESS (0.698 secs / 0.395 secs) 13 10 2016 11:05:29.292:WARN [launcher]: Safari have not captured in 60000 ms, killing. 13 10 2016 11:05:29.366:INFO [launcher]: Trying to start Safari again (1/2). 13 10 2016 11:06:29.367:WARN [launcher]: Safari have not captured in 60000 ms, killing. 13 10 2016 11:06:29.438:INFO [launcher]: Trying to start Safari again (2/2). 13 10 2016 11:07:29.443:WARN [launcher]: Safari have not captured in 60000 ms, killing. 13 10 2016 11:07:29.559:ERROR [launcher]: Safari failed 2 times (timeout). Giving up.

EDIT: It appears that this is due to a change in URL handling in Safari 10. If I type: "localhost:9876/?id=7444926" (without the quotes) into the Address Bar, instead of making a request to localhost on port 9876, Safari 10 treats that as a 'search query' and routes it to my default search engine.

EDIT 2: My problems were actually coming from an errant Safari plugin that apparently was not compatible with Safari 10. Once uninstalled, the the karma safari launcher started working again.

falsandtru commented 7 years ago

I did see the failures with another reason.

30 10 2016 22:37:28.416:WARN [Safari 9.1.3 (Mac OS X 10.11.6)]: Disconnected (1 times), because no message in 100000 ms. Safari 9.1.3 (Mac OS X 10.11.6) ERROR Disconnected, because no message in 100000 ms. Safari 9.1.3 (Mac OS X 10.11.6): Executed 0 of 0 DISCONNECTED (1 min 40.013 secs / 0 secs)

https://travis-ci.org/falsandtru/spica/jobs/171850940

jfarago commented 7 years ago

@falsandtru I just ran into this problem as well. I figured out that this can be caused by two scenarios. One, another karma tab is open. Two, when safari does not have focus. Im trying to figure out work arounds for both.

edit: our issue was tied to the grunt-karma runner. Running it with karma-cli works fine.

falsandtru commented 7 years ago

Thanks and sorry for delaying. I missed your comment. I tried with concurrency: 1 to focus Safari but still have failed.

https://travis-ci.org/falsandtru/spica/jobs/273768584

falsandtru commented 7 years ago

@dignifiedquire Seems like this plugin doesn't work with other launchers on Travis. Is there an project that works fine?

heidemn-faro commented 3 years ago

Safari fails to launch for us on an Azure Pipelines agent.

Pipeline:

pool:
  vmImage: macOS-10.15

package.json:

    "@chiragrupani/karma-chromium-edge-launcher": "2.1.0",
    ...
    "karma": "5.1.0",
    "karma-chrome-launcher": "3.1.0",
    "karma-coverage": "2.0.3",
    "karma-edge-launcher": "0.4.2",
    "karma-firefox-launcher": "2.1.0",
    "karma-jasmine": "0.1.6",
    "karma-junit-reporter": "2.0.1",
    "karma-safari-launcher": "^1.0.0",
    ...

image

Any help would be appreciated :-)

Update: In our case, it was this problem: https://github.com/karma-runner/karma-safari-launcher/issues/29 Using karma-safarinative-launcher works for us in general (but not 100% reliable).

burtonator commented 2 years ago

Fails to load for me... I get the error:

"confirm the file to load" and a confirm dialog:

CleanShot 2022-01-21 at 16 12 09@2x