nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.79k stars 1.31k forks source link

No working docs on how to run Nightwatch #1608

Closed leegee closed 7 years ago

leegee commented 7 years ago

New user, familiar with Selenium, Protractor, etc, following the docs and Wiki.

OS: Windows 10, fully patched npm -v : 5.3.0 node --version : v8.5.0 Selenium version: various, including selenium-server-standalone-2.53.1.jar

λ nightwatch                                                                                                                                                  

[Chai] Test Suite                                                                                                                                             
=====================                                                                                                                                         

[Nightwatch] Test Suite                                                                                                                                       
===========================                                                                                                                                   

Running:  env                                                                                                                                                 
 ✖ Error: spawn UNKNOWN                                                                                                                                       
    at _errnoException (util.js:1026:11)                                                                                                                      
    at ChildProcess.spawn (internal/child_process.js:325:11)                                                                                                  
    at Object.exports.spawn (child_process.js:493:9)                                                                                                          
    at <anonymous>                                                                                                                                            
    at process._tickCallback (internal/process/next_tick.js:188:7)                                                                                            
From: Task: WebDriver.createSession()                                                                                                                         
    at Object.<anonymous> (C:\Users\User\src\izel\tests\chai.js:5:4)                                                                                          
    at Module._compile (module.js:624:30)                                                                                                                     
    at Object.Module._extensions..js (module.js:635:10)                                                                                                       
    at Module.load (module.js:545:32)                                                                                                                         
    at tryModuleLoad (module.js:508:12)                                                                                                                       
    at Function.Module._load (module.js:500:3)                                                                                                                

FAILED:  1 errors (100ms)                                                                                                                                     

[Sel] Test Suite                                                                                                                                              
====================                                                                                                                                          

 _________________________________________________                                                                                                            

 TEST FAILURE: 1 error during execution,  0 assertions failed, 0 passed. (369ms)                                                                              

 × nightwatch                                                                                                                                                 

   - env (100ms)                                                                                                                                              

There was an error while starting the test runner:                                                                                                            

Error: spawn UNKNOWN                                                                                                                                          
    at _errnoException (util.js:1026:11)                                                                                                                      
    at ChildProcess.spawn (internal/child_process.js:325:11)                                                                                                  
    at Object.exports.spawn (child_process.js:493:9)                                                                                                          
    at exec (C:\Users\User\src\izel\node_modules\selenium-webdriver\io\exec.js:116:27)                                                                        
    at resolveCommandLineFlags.then.args (C:\Users\User\src\izel\node_modules\selenium-webdriver\remote\index.js:219:25)                                      
    at <anonymous>                                                                                                                                            
    at process._tickCallback (internal/process/next_tick.js:188:7)                                                                                            
From: Task: WebDriver.createSession()                                                                                                                         
    at Function.createSession (C:\Users\User\src\izel\node_modules\selenium-webdriver\lib\webdriver.js:769:24)                                                
    at Function.createSession (C:\Users\User\src\izel\node_modules\selenium-webdriver\chrome.js:761:15)                                                       
    at createDriver (C:\Users\User\src\izel\node_modules\selenium-webdriver\index.js:170:33)                                                                  
    at Builder.build (C:\Users\User\src\izel\node_modules\selenium-webdriver\index.js:642:16)                                                                 
    at Object.<anonymous> (C:\Users\User\src\izel\tests\chai.js:5:4)                                                                                          
    at Module._compile (module.js:624:30)                                                                                                                     
    at Object.Module._extensions..js (module.js:635:10)                                                                                                       
    at Module.load (module.js:545:32)                                                                                                                         
    at tryModuleLoad (module.js:508:12)                                                                                                                       
    at Function.Module._load (module.js:500:3)                                                                                                                
From: Task: WebDriver.createSession()                                                                                                                         
    at Function.createSession (C:\Users\User\src\izel\node_modules\selenium-webdriver\lib\webdriver.js:769:24)                                                
    at Function.createSession (C:\Users\User\src\izel\node_modules\selenium-webdriver\chrome.js:761:15)                                                       
    at createDriver (C:\Users\User\src\izel\node_modules\selenium-webdriver\index.js:170:33)                                                                  
    at Builder.build (C:\Users\User\src\izel\node_modules\selenium-webdriver\index.js:642:16)                                                                 
    at Object.<anonymous> (C:\Users\User\src\izel\tests\sel.js:7:6)                                                                                           
    at Module._compile (module.js:624:30)                                                                                                                     
    at Object.Module._extensions..js (module.js:635:10)                                                                                                       
    at Module.load (module.js:545:32)                                                                                                                         
    at tryModuleLoad (module.js:508:12)                                                                                                                       
    at Function.Module._load (module.js:500:3)                                                                                                                

Just noticed that after a pause, Selenium.jar outputs:

18:37:59.513 ERROR - org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "C:\Users\User\AppData\Roaming\npm\node_modules\nightwatch\lib\chromedriver" (in directory "."): CreateProcess error=193, %1 is not a valid Win32 application)

So, I I put a copy of a Chromedriver executable where nightwatch expects it (hope that can be customised?), and now a browser window opens, and I notice that the next error follows the same reporting pattern:

There was an error while starting the test runner:

Error: spawn UNKNOWN
    at _errnoException (util.js:1026:11)
    at ChildProcess.spawn (internal/child_process.js:325:11)
    at Object.exports.spawn (child_process.js:493:9)
    at exec (C:\Users\User\src\izel\node_modules\selenium-webdriver\io\exec.js:116:27)
    at resolveCommandLineFlags.then.args (C:\Users\User\src\izel\node_modules\selenium-webdriver\remote\index.js:219:25)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\Users\User\src\izel\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
    at Function.createSession (C:\Users\User\src\izel\node_modules\selenium-webdriver\chrome.js:761:15)
    at createDriver (C:\Users\User\src\izel\node_modules\selenium-webdriver\index.js:170:33)
    at Builder.build (C:\Users\User\src\izel\node_modules\selenium-webdriver\index.js:642:16)
    at Object.<anonymous> (C:\Users\User\src\izel\tests\chai.js:5:4)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
From: Task: WebDriver.createSession()
    at Function.createSession (C:\Users\User\src\izel\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
    at Function.createSession (C:\Users\User\src\izel\node_modules\selenium-webdriver\chrome.js:761:15)
    at createDriver (C:\Users\User\src\izel\node_modules\selenium-webdriver\index.js:170:33)
    at Builder.build (C:\Users\User\src\izel\node_modules\selenium-webdriver\index.js:642:16)
    at Object.<anonymous> (C:\Users\User\src\izel\tests\sel.js:7:6)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)

It would help if the docs could be a little more explicit.....

kontrollanten commented 7 years ago

How does your config file look like? How does the test file look like? Have you tried to log what happens in webdriver.js:769:24? I was starting with NW for the first time today and was able to get up and running within 5 minutes by following the docs.

leegee commented 7 years ago

Which docs dod you follow, please?

On Oct 7, 2017 06:13, "kontrollanten" notifications@github.com wrote:

How does your config file look like? How does the test file look like? Have you tried to log what happens in webdriver.js:769:24? I was starting with NW for the first time today and was able to get up and running within 5 minutes by following the docs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nightwatchjs/nightwatch/issues/1608#issuecomment-334909056, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfTMAcJzSKL4SUJXPzek71Qv5nv5TIzks5spvp4gaJpZM4PuvTF .

kontrollanten commented 7 years ago

http://nightwatchjs.org/gettingstarted and http://nightwatchjs.org/guide

leegee commented 7 years ago

I can't really expect a test framework to handle Windows-specific WebDriver issues, so closing this. (It was a conflict between Selenium and Chromedriver versions, which I've seen a lot of with other WD projects, as well as in these GitHub issue archives -- if only there was a linked matrix of working versions. Ended up using webdriver-manager)