This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 241845

Summary: Starting karma does not allow me to run project
Product: web Reporter: kimsp <kimsp>
Component: HTML ProjectAssignee: Tomas Mysik <tmysik>
Status: RESOLVED WONTFIX    
Severity: normal CC: vriha
Priority: P3    
Version: 8.0   
Hardware: Macintosh   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Attachments: IDE log

Description kimsp 2014-02-13 19:43:06 UTC
Product Version = NetBeans IDE 8.0 Beta (Build 201401091443)
Operating System = Mac OS X version 10.9.1 running on x86_64
Java; VM; Vendor = 1.7.0_51
Runtime = Java HotSpot(TM) 64-Bit Server VM 24.51-b03

Hi,

I have an HTML5 project with some jasmine tests that I run using Karma.

If I start karma first and then run project, chrome starts up, but the page displayed is just white (not my app).

If I run my app first (before starting karma), chrome starts up and the page displayed is my app. 

From a user perspective this does not make sense. I both cases I such seemy app.
Comment 1 kimsp 2014-02-13 19:43:09 UTC
Created attachment 145166 [details]
IDE log
Comment 2 kimsp 2014-02-13 19:45:08 UTC
The page displayed when I have started karma first has this source code (if it helps):

<html :netbeans_temporary="true"></html>
Comment 3 Vladimir Riha 2014-02-13 20:02:04 UTC
I'm not sure I understand. Running project and running tests on Karma are 2 independent actions.
 - to run tests, right click on project in Projects window and select Test
 - if you only start Karma, it starts Karma server and (if defined to) opens browser window with page containing something like "Karma v0.10.4 - connected", but it doesn't run tests. Again, you need to invoke Test action
 - running project is not related to Karma at all (afaik)
Comment 4 Tomas Mysik 2014-02-14 06:25:47 UTC
Nothing suspicious in your IDE log. However, to be sure we know exactly what you are talking about, please attach a sample project and provide exact steps to reproduce.

Simply reopen this issue, thanks.
Comment 5 kimsp 2014-02-14 07:29:16 UTC
Hi Vladimir

You are right in that running project and running tests on Karma should be two independent actions. But they are not as will try to describe.

In a HTML5 project configure Karma and start it (from the Karma icon in the project). It will automatically run your unit tests when you change them (you don't have to anything as Karma monitors the files and executes upon save).
Starting Karma will, as you write, bring up Chrome with a screen that says something like "Karma v0.10.4 - connected".

If I have done the above and then run the project (not the tests, just the project (and the same thing can be provoked by just running one of the html files in the project), in either case from the context menu of the project or file in the project view) I don't see chrome starting up with my app. I just see a blank window in the same chrome instance as the one running karma.

However, if I have not started karma and run the project (or just one of the html files, in either case from the context menu of the project or file in the project view) I see chrome starting up with my app.
If I then start karma, a new chrome instance with the "Karma v0.10.4 - connected" starts up and runs my tests as I would expect.
Comment 6 Tomas Mysik 2014-02-14 08:23:01 UTC
I cannot reproduce your issue but I am on Linux so it could be perhaps only Mac issue... what I did exactly:
- close all Chrome browsers
- manually start Karma from IDE
-> Chrome starts
- run project (browser is set to Chrome without NB integration)
-> another Chrome window is started, with application running in it

Láďo, please try to reproduce on Mac and Windows.

@reporter: Please, correct my steps if they are incorrect.

Thanks.

Product Version: NetBeans IDE Dev (Build 20140213-97515baa5050)
Updates: Updates available
Java: 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_51-b13
System: Linux version 3.11.0-15-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 7 Tomas Mysik 2014-02-14 08:24:39 UTC
BTW not P2 since I cannot reproduce it with the current dev build and moreover, workaround is very easy.

Thanks.
Comment 8 kimsp 2014-02-14 09:32:30 UTC
Tomas Mysik, your approach is correct.
Comment 9 Tomas Mysik 2014-02-17 06:39:19 UTC
(In reply to Tomas Mysik from comment #6)
> Láďo, please try to reproduce on Mac and Windows.

Láďo, please, do not forget to try to reproduce this issue. And I am not sure whether the problem could not be in the NetBeans integration so rather try Chrome with NB Connector.

Thanks.
Comment 10 Vladimir Riha 2014-02-17 07:16:13 UTC
Of course, I'll try it today.
Comment 11 Vladimir Riha 2014-02-17 09:03:13 UTC
I can reproduce it on Mac following yours steps:

- close all Chrome browsers
- manually start Karma from IDE
-> Chrome starts
- run project (browser is set to Chrome WITH NB integration)

=> Chrome started by Karma is used to open new tab with the "placeholder" URL (file://...) and it is stuck there. I've noticed that Karma seems to be starting Chrome with some other "user profile", because the Chrome instance started by Karma is missing all installed extensions, including NB Connector and its missing any browser history
Comment 12 Vladimir Riha 2014-02-17 09:04:44 UTC
(In reply to Vladimir Riha from comment #11)
> I can reproduce it on Mac following yours steps:
> 
> - close all Chrome browsers
> - manually start Karma from IDE
> -> Chrome starts
> - run project (browser is set to Chrome WITH NB integration)
> 
> => Chrome started by Karma is used to open new tab with the "placeholder"
> URL (file://...) and it is stuck there. I've noticed that Karma seems to be
> starting Chrome with some other "user profile", because the Chrome instance
> started by Karma is missing all installed extensions, including NB Connector
> and its missing any browser history

* on Mac, Windows TBD
Comment 13 Vladimir Riha 2014-02-17 09:29:17 UTC
Works fine in Windows as well, IDE starts a new Chrome instance upon running project.
Comment 14 Tomas Mysik 2014-02-17 09:31:10 UTC
(In reply to Vladimir Riha from comment #11)
> I've noticed that Karma seems to be
> starting Chrome with some other "user profile"

Yes, exactly. And NetBeans supports only the default Chrome profile. Unfortunately, I don't know about any way how to solve this issue; moreover, I would expect that Mac OS somehow handles opening of applications to prefer multiple tabs to multiple app instances. This is IMHO not the case for Linux (at least for KDE desktop which I use). Not sure about Windows (but it is able to "group" applications in the tasks panel as well I think).

Thanks.
Comment 15 Tomas Mysik 2014-02-17 09:32:11 UTC
(In reply to Vladimir Riha from comment #13)
> Works fine in Windows as well, IDE starts a new Chrome instance upon running
> project.

Aha, this is fine.

@reporter: Sorry, no idea right now how to solve this issue. If you know how to do that, let us know :)

Thanks.
Comment 16 Tomas Mysik 2014-07-03 12:59:23 UTC
Well, it seems that this is a feature of Mac OS X. Instead of running a new app/window, it simply reuses the existing process (with the same name). There is no easy way around it, at least it seems to me.

The only option here would be to run Google Chrome with a "--user-data-dir" parameter but I really do _not_ want to do that - we could break _many_ things for _many_ users... Also, this would fix only Chrome but other browsers would be still broken I guess.

Sorry, currently I do not see any way to fix this issue. Thanks for reporting.