Usually, I used to run from command line (protractor config.js). I used protractor and java script.

PLS LET ME KNOW STEPS TO ACHIEVE RUNNING FROM JENKINS

To run from Jenkins , I created a batch file run.bat containing (protractor config.js).

JENKINS:

New project ->config system -> Execute window batch command (run.bat)

ERROR:
I received following error after running my job-

Started by user aaaa
Building in workspace C:\Users\AppData\Roaming\npm\node_modules\protractor\Workspace
[Workspace] $ cmd /c call C:\Windows\TEMP\jenkins483586556774856213.bat

C:\Users\AppData\Roaming\npm\node_modules\protractor\Workspace>call run.bat 

C:\Users\AppData\Roaming\npm\node_modules\protractor\Workspace>protractor config2.js 
'protractor' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\AppData\Roaming\npm\node_modules\protractor\Workspace>exit 1 
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
  • well is the machine even windows? and if it is, is there npm and protractor installed? – ne2dmar Dec 7 '17 at 11:30
  • yes Windows, i have automated 150 testcases using protractor javascript. i run from webstorm, but i wanted the same to run from jenkins. – keasav rao Dec 7 '17 at 12:23
  • Have you setup the globally installed npm modules in the environment variable? For example, C:\Users\Administrator\AppData\Roaming\npm in the Path environment variable in the 'System Variables' section. Jenkins is not able to identify your globally installed protractor module. – Bhavani Dec 11 '17 at 8:22
  • @Bhavani yes i do added. tried again , still same error – keasav rao Dec 11 '17 at 13:00
  • Forgot to mention. Please can you restart your system once and retry to execute again. – Bhavani Dec 11 '17 at 16:20

Currently in Jenkins workspace folder is not set , so it is running and trying to search project folders in temp file.First set the workspace folder for the job.

Also make sure 'Protractor' as a npm module is installed on the machine where execution is being performed.

1). First move to the project folder.

    cd C:\Project_RootFolder_Path

2).Install it globally.

npm install -g protractor

I would recommend to run in a more abstracted way using Gulp task.

Also if you are just calling protractor conf.js in your .bat file, you can directly put that line in 'Execute windows batch command' section in Jenkins.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.