1

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
7
  • well is the machine even windows? and if it is, is there npm and protractor installed?
    – ne2dmar
    Commented Dec 7, 2017 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.
    – Bustaq
    Commented Dec 7, 2017 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
    Commented Dec 11, 2017 at 8:22
  • @Bhavani yes i do added. tried again , still same error
    – Bustaq
    Commented Dec 11, 2017 at 13:00
  • Forgot to mention. Please can you restart your system once and retry to execute again.
    – Bhavani
    Commented Dec 11, 2017 at 16:20

1 Answer 1

1

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 agree to our terms of service and acknowledge you have read our privacy policy.

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