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 249653 - IDE should prefer global protractor over local one
Summary: IDE should prefer global protractor over local one
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Testing (show other bugs)
Version: 8.1
Hardware: PC Linux
: P2 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
: 250962 (view as bug list)
Depends on: 249739
Blocks:
  Show dependency tree
 
Reported: 2015-01-06 08:41 UTC by Vladimir Riha
Modified: 2015-03-07 08:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2015-01-06 08:41:53 UTC

    
Comment 1 Vladimir Riha 2015-01-06 08:48:01 UTC
Sorry for the accidentally submit...


I had some troubles running protractor tests.

I used [1] as a "reference" project for testing. In theory, it should work (I think) in IDE without much user's input. But the problem is that protractor-conf.js file in the project does not specify location of ChromeDriver. I have it on PATH and running 

$ protractor test/protractor-conf.js

works just fine and discovers the ChromeDriver on my PATH. But IDE uses

$ "/usr/local/bin/node" "/home/vriha/NetBeansProjects/AngularJSPhoneCat1/node_modules/.bin/protractor" "/home/vriha/Downloads/netbeans/webcommon/protractor/netbeans-configuration.js"

And this way it fails to find the ChromeDriver on PATH. The output is now

Using ChromeDriver directly...
[launcher] Error: Could not find chromedriver at /home/vriha/NetBeansProjects/AngularJSPhoneCat1/node_modules/protractor/selenium/chromedriver.exe


More interestingly, even if I change browser in the config file to "firefox", it still fails due to this ChromeDriver problem. This is a problem of Protractor though, because the same happens if I don't run it with the netbeans-configuration.js but it is a problem that likely is happening only with running local protractor.

The protractor tutorial uses globally installed protractor. So if I set it in NetBeans instead of the local one, IDE runs following command

"/usr/local/bin/node" "/usr/local/bin/protractor" "/home/vriha/Downloads/netbeans/webcommon/protractor/netbeans-configuration.js"


and this way it works like a charm. So my question is, could IDE prefer this global protractor and if not found, fallback to the local one? NetBeans autodiscovers path to protractor upon 1st usage so could it prefer global one from PATH instead? It seems to solve these problem

That being said, I'm not sure how global protractor looks like on Windows, I guess it could be probably protractor.cmd and I'm not sure if 

$ node protractor.cmd ...

would work. But perhaps in folder with protractor.cmd there could be also file "protractor".


Thank you

[1] https://github.com/angular/angular-phonecat



Product Version: NetBeans IDE Dev (Build 201501060001)
Java: 1.7.0_71; Java HotSpot(TM) Client VM 24.71-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_71-b14
System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)
Comment 2 Vladimir Riha 2015-01-06 10:29:48 UTC
On Windows, the globally installed Protractor is in

C:\Users\vlriha\AppData\Roaming\npm

and there are 2 files:
 - protractor
 - protractor.cmd

The "protractor" is a bash script
Comment 3 Theofanis Oikonomou 2015-01-07 22:46:38 UTC
Changeset: f9d9aa93b4ec
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2015-01-07 23:45
Message:
Comment 4 Theofanis Oikonomou 2015-01-07 22:48:18 UTC
"protractor.cmd" or "protractor" is firstly searched in user's PATH.
Comment 5 Quality Engineering 2015-01-09 03:38:12 UTC
Integrated into 'main-silver', will be available in build *201501090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f9d9aa93b4ec
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Task #249653 - IDE should prefer global protractor over local one
Comment 6 Vladimir Riha 2015-01-09 09:27:03 UTC
Thank you, but unfortunately it does not fully work for me (so far tested on Ubuntu)

I have protractor in /usr/local/bin/protractor but on PATH I have /usr/local/bin thus the condition

 if (path.endsWith(execName)) {


is not fulfilled although protractor is globally installed and available on PATH. I assume the same situation will be on Windows as well. If I add whole "/usr/local/bin/protractor" to PATH, it works but I think that "my" configuration could be also often.


Thank you


Product Version: NetBeans IDE Dev (Build 201501080001)
Java: 1.7.0_67; Java HotSpot(TM) Client VM 24.65-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_67-b01
System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)
Comment 7 Theofanis Oikonomou 2015-01-09 19:48:20 UTC
Changeset: 6b2e6f021a3b
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2015-01-09 20:46
Message:
Comment 8 Theofanis Oikonomou 2015-01-09 19:50:29 UTC
(In reply to Vladimir Riha from comment #6)
> PATH. I assume the same situation will be on Windows as well. If I add whole
> "/usr/local/bin/protractor" to PATH, it works but I think that "my"
> configuration could be also often.
> 

sorry for not taking this into account the first time. Actually I think "your" configuration is more often :)
Comment 9 Quality Engineering 2015-01-10 18:26:46 UTC
Integrated into 'main-silver', will be available in build *201501101317* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6b2e6f021a3b
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Task #249653 - IDE should prefer global protractor over local one
Comment 10 Vladimir Riha 2015-03-06 09:56:09 UTC
Unfortunately still does not work for me, the local protractor is being pre-selected. I'll try to  debug it.
Comment 11 Vladimir Riha 2015-03-06 10:17:13 UTC
I'm sorry for reopening. Turns out I have not only

/usr/local/bin/protractor

but also (probably from previous node installation and testing)


/usr/local/bin/_protractor

And since the FilenameFilter returns list of length 2, it fallbacks to local one...

Fanis, could you please close it again? I'm not sure if it is worth fixing, if such clash in names could happen often. 


Thank you
Comment 12 Vladimir Riha 2015-03-06 11:15:18 UTC
I tried it on Windows and I think it does not work on Windows (it throws issue 249739 so I can't say for sure).


On Windows my PATH is 

PATH=C:\Ruby200\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Softw are\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\Java\jdk1.7.0_03\bin;C:\Program Files (x86)\Java\jdk1.7.0_03;C:\Program Files\M ercurial\;C:\Program Files (x86)\Git\cmd;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Program Files\iojs\;C:\Users\vlriha\AppData\Roaming\npm


note the folder C:\Users\vlriha\AppData\Roaming\npm. To get a working global Protractor configuration, I must set Protractor binary in NetBeans to point to

C:\Users\vlriha\AppData\Roaming\npm\node_modules\protractor\bin\protractor

I don't think the current recognition will find it, right? Also, it shouldn't  look for "protractor.cmd", just "protractor" because "node protractor.cmd" throws syntax errors. I'm sorry if I confuse you with it in my initial comment.
Comment 13 Theofanis Oikonomou 2015-03-06 16:00:52 UTC
Changeset: 4335cf86dcc8
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2015-03-06 16:59
Message:
Comment 14 Theofanis Oikonomou 2015-03-06 16:04:27 UTC
(In reply to Vladimir Riha from comment #11)
> I'm sorry for reopening. Turns out I have not only
> 
> /usr/local/bin/protractor
> 
> but also (probably from previous node installation and testing)
> 
> 
> /usr/local/bin/_protractor
> 
> And since the FilenameFilter returns list of length 2, it fallbacks to local
> one...
> 
> Fanis, could you please close it again? I'm not sure if it is worth fixing,
> if such clash in names could happen often. 
> 
> 
> Thank you

problem is that /usr/local/bin/protractor is actually a symlink pointing to /usr/local/lib/node_modules/protractor/bin/protractor

using getCanonicalPath now in order to resolve symlinks, at least in Unix :)

(In reply to Vladimir Riha from comment #12)
> On Windows my PATH is 
> 
> PATH=C:\Ruby200\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;
> C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program
> Files\WIDCOMM\Bluetooth Softw are\;C:\Program Files\WIDCOMM\Bluetooth
> Software\syswow64;C:\Program Files (x86)\Java\jdk1.7.0_03\bin;C:\Program
> Files (x86)\Java\jdk1.7.0_03;C:\Program Files\M ercurial\;C:\Program Files
> (x86)\Git\cmd;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program
> Files\nodejs\;C:\Program Files\iojs\;C:\Users\vlriha\AppData\Roaming\npm
> 
> 
> note the folder C:\Users\vlriha\AppData\Roaming\npm. To get a working global
> Protractor configuration, I must set Protractor binary in NetBeans to point
> to
> 
> C:\Users\vlriha\AppData\Roaming\npm\node_modules\protractor\bin\protractor
> 
> I don't think the current recognition will find it, right? Also, it
> shouldn't  look for "protractor.cmd", just "protractor" because "node
> protractor.cmd" throws syntax errors. I'm sorry if I confuse you with it in
> my initial comment.

There is special support for windows now.
Comment 15 Theofanis Oikonomou 2015-03-06 16:18:29 UTC
*** Bug 250962 has been marked as a duplicate of this bug. ***
Comment 16 Quality Engineering 2015-03-07 08:41:33 UTC
Integrated into 'main-silver', will be available in build *201503070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4335cf86dcc8
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Task #249653 - IDE should prefer global protractor over local one