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 249302 - Mocha: Rerun action does not work properly
Summary: Mocha: Rerun action does not work properly
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Testing (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-11 20:12 UTC by Vladimir Riha
Modified: 2015-08-27 01:21 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (75.77 KB, text/plain)
2014-12-11 20:12 UTC, Vladimir Riha
Details
sample project (19.47 KB, application/zip)
2014-12-11 22:34 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2014-12-11 20:12:49 UTC
Created attachment 151052 [details]
IDE log

Please check the attached project and:
 - invoke npm install on the project, after that set Mocha in project properties->Selenium testing 
 - open Selenium Tests | browser.js
 - set "preferredBrowser" on line 51 to either Chrome or Firefox
 - set path to ChromeDriver/Firefox binary on line 46 and 50 (of course set just the path for "preferredBrowser")
 - right click on project and select Run Selenium Tests
 - Output window is opened, everything works fine
 - press the Re-run button in output window

=> tests are running, but the output window contains only

"C:\Program Files\nodejs\node.exe" "C:\Users\vlriha\Downloads\MessagesMocha\node_modules\mocha/bin/mocha" "-t" "10000" "-R" "C:\Users\vlriha\Downloads\netbeans-trunk-nightly-201412111033-php\netbeans\webcommon\mocha\netbeans-reporter.js" "browser_tests/**/*.js"
Done.

and it is no longer bold right after the last line. So it looks like tests are finished but in reality tests are still running and there is not output in output window and there is no bubble notification about finished tests



Product Version: NetBeans IDE Dev (Build 201412111033)
Java: 1.8.0_11; Java HotSpot(TM) 64-Bit Server VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Theofanis Oikonomou 2014-12-11 22:10:14 UTC
(In reply to Vladimir Riha from comment #0)
> Created attachment 151052 [details]
> IDE log
> 
> Please check the attached project and:

Lada, please attach also the project :)
Thanks
Comment 2 Vladimir Riha 2014-12-11 22:34:15 UTC
Created attachment 151055 [details]
sample project

Sorry, I didn't notice this  :-)
Comment 3 Theofanis Oikonomou 2014-12-15 15:24:00 UTC
I get the following whenever I invoke run selenium tests action or the rerun action from output or test results windows.

"/usr/local/bin/node" "/Users/fanis/selenium2_work/MessagesMocha/node_modules/mocha/bin/mocha" "-t" "10000" "-R" "/Users/fanis/repositories/web-main/nbbuild/netbeans/webcommon/mocha/netbeans-reporter.js" "browser_tests/**/*.js"
1..2
ok 1 Download page test should find correct title
ok 2 Homepage tests should find correct title

Done.

and I do not see any of the other symptoms you are describing. Can you reproduce still in todays latest build (Build 20141215-2b6decbf2756)? Thanks
Comment 4 Vladimir Riha 2014-12-16 10:28:40 UTC
I can still reproduce it on Windows, I'll try Linux as well


Product Version: NetBeans IDE Dev (Build 201412160001)
Java: 1.8.0_11; Java HotSpot(TM) 64-Bit Server VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 5 Vladimir Riha 2014-12-16 12:22:36 UTC
After offline attempts, the steps are:
 - invoke Run Selenium Tests on project
 - in output window, don't wait for tests to finish and press Stop button
 - try to re-run tests from output window using the >> button
=> does not work correctly

 - to "recover", one must invoke the Run Selenium Tests on the project again
Comment 6 Theofanis Oikonomou 2014-12-16 14:55:21 UTC
This happens only if the started process is not let to finish normally and stop button is clicked in output window. It seems to me that the problem is in extexecution  api. I see a comment like:

//uncomment this if state after cancel should be the same as when completed normally

in org.netbeans.api.extexecution.ExecutionService.java line 266. Probably IO stream is not closed/initialized properly or something like that happens. I am not sure how to handle it from selenium support. 

Petr can you please have a look and comment on this? Thank you
Comment 7 Vladimir Riha 2015-01-06 08:21:49 UTC
I'm having the same problem with Protractor even if I let the Protractor finish without stopping it. Steps are:
 - right click on project and run selenium tests
 - let tests finish
 - in Output window, press >> to Re-run

=> output window contains

"/usr/local/bin/node" "/usr/local/bin/protractor" "/home/vriha/Downloads/netbeans/webcommon/protractor/netbeans-configuration.js"
WARNING - chromeOnly is deprecated. Use directConnect
WARNING - chromeOnly is deprecated. Use directConnect
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
Done.


And again, no bubble notification about finished tests, Test Results window shows "Running...".


Fanis, should I report it as a new issue?

Thank you


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 8 Theofanis Oikonomou 2015-01-08 11:05:24 UTC
(In reply to Vladimir Riha from comment #7)
> I'm having the same problem with Protractor even if I let the Protractor
> finish without stopping it. Steps are:
>  - right click on project and run selenium tests
>  - let tests finish
>  - in Output window, press >> to Re-run
> 
> => output window contains
> 
> "/usr/local/bin/node" "/usr/local/bin/protractor"
> "/home/vriha/Downloads/netbeans/webcommon/protractor/netbeans-configuration.
> js"
> WARNING - chromeOnly is deprecated. Use directConnect
> WARNING - chromeOnly is deprecated. Use directConnect
> Using ChromeDriver directly...
> [launcher] Running 1 instances of WebDriver
> Done.
> 
> 
> And again, no bubble notification about finished tests, Test Results window
> shows "Running...".
> 
> 
> Fanis, should I report it as a new issue?

I think this is not related to this bug but to bug 249654 and should be fixed. At least I saw identical behavior while trying to fix it.
Comment 9 Theofanis Oikonomou 2015-01-08 13:20:39 UTC
(In reply to Theofanis Oikonomou from comment #6)
> This happens only if the started process is not let to finish normally and
> stop button is clicked in output window. It seems to me that the problem is
> in extexecution  api. I see a comment like:
> 
> //uncomment this if state after cancel should be the same as when completed
> normally
> 
> in org.netbeans.api.extexecution.ExecutionService.java line 266. Probably IO
> stream is not closed/initialized properly or something like that happens. I
> am not sure how to handle it from selenium support. 
> 
> Petr can you please have a look and comment on this? Thank you

while debugging the above mentioned code is invoked, so it seems there is a problem with extexecution or I am not using the api the correct way, in which case I would appreciate some hints on what I am doing wrong. re-assigning for evaluation. thank you
Comment 10 Vladimir Riha 2015-01-09 09:27:56 UTC
(In reply to Theofanis Oikonomou from comment #8)
> 
> I think this is not related to this bug but to bug 249654 and should be
> fixed. At least I saw identical behavior while trying to fix it.

You are right, it works fine now. Thank you
Comment 11 Petr Hejl 2015-04-30 14:57:26 UTC
Looks like there are assertions being thrown at TestRunnerReporter:269 in case of rerun. Change org.netbeans.api.extexecution.base.input.InputReaderTask:225 to catch and report throwable and see for yourself. Looks like some state invariants Of TestRunnerReporter are being corrupted when stopped. Doeas not seem to be extexecution problem.
Comment 12 Petr Hejl 2015-04-30 21:30:52 UTC
Making assertions better visible - web-main 6bb00f54d866.
Comment 13 Quality Engineering 2015-05-02 07:17:56 UTC
Integrated into 'main-silver', will be available in build *201505020001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6bb00f54d866
User: Petr Hejl <phejl@netbeans.org>
Log: #249302 - Mocha: Rerun action does not work properly
Comment 14 Theofanis Oikonomou 2015-08-26 13:09:27 UTC
Changeset: 688496315298
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2015-08-26 16:08
Message:
Comment 15 Theofanis Oikonomou 2015-08-26 13:10:43 UTC
Thank you Petr for the more readable logging. Re-run from output window should work now as expected.
Comment 16 Quality Engineering 2015-08-27 01:21:51 UTC
Integrated into 'main-silver', will be available in build *201508270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/688496315298
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Task #249302 - Mocha: Rerun action does not work properly