Reputation: 108
I am currently trying to integrate protractor tests into a Jenkins build by putting it into the maven build that is being executed. As protractor isn't installed on the machine I am trying to test on, I've put this into my pom.xml:
<execution>
<id>run npm install protractor </id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install -g protractor</arguments>
</configuration>
</execution>
This produces the following output via Jenkins:
[INFO] --- frontend-maven-plugin:1.6:npm (run npm install protractor) @ cpc-fe-impl ---
[INFO] Running 'npm install -g protractor' in /var/lib/jenkins/workspace/VF-CPC/cpc-fe/cpc-fe/cpc-fe-impl/angular
[WARNING] npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
[INFO] /var/lib/jenkins/workspace/VF-CPC/cpc-fe/cpc-fe/cpc-fe-impl/target/bin/protractor -> /var/lib/jenkins/workspace/VF-CPC/cpc-fe/cpc-fe/cpc-fe-impl/target/lib/node_modules/protractor/bin/protractor
[INFO] /var/lib/jenkins/workspace/VF-CPC/cpc-fe/cpc-fe/cpc-fe-impl/target/bin/webdriver-manager -> /var/lib/jenkins/workspace/VF-CPC/cpc-fe/cpc-fe/cpc-fe-impl/target/lib/node_modules/protractor/bin/webdriver-manager
[INFO] + [email protected]
[INFO] added 151 packages from 191 contributors in 8.082s
But when I try to execute the tests later in that same pom.xml with greengerong's maven-ng-protractor plugin:
<plugin>
<groupId>com.github.greengerong</groupId>
<artifactId>maven-ng-protractor</artifactId>
<version>0.0.2</version>
<configuration>
<configFile>angular/e2e/protractor-jenkins.conf.js</configFile>
</configuration>
<executions>
<execution>
<id>ng-protractor</id>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
the protractor installation seems to be gone and the tests aren't executed
[INFO] --- maven-ng-protractor:0.0.2:run (ng-protractor) @ cpc-fe-impl ---
[INFO] protractor:protractor
[INFO] configFile:/var/lib/jenkins/workspace/VF-CPC/cpc-fe/cpc-fe/cpc-fe-impl/angular/e2e/protractor-jenkins.conf.js
[INFO] Executing protractor test Suite ...
[INFO] Command:/var/lib/jenkins/workspace/VF-CPC/cpc-fe/cpc-fe/cpc-fe-impl/angular/e2e/protractor-jenkins.conf.js
[ERROR] Run protractor test error:
java.io.IOException: Cannot run program "protractor": error=2, Datei oder Verzeichnis nicht gefunden
at java.lang.ProcessBuilder.start (ProcessBuilder.java:1048)
at com.github.greengerong.ProtractorService.exec (ProtractorService.java:34)
...
Does anyone have an idea how to fix this? I have tried to run the protractor tests without maven by configuring the Jenkins build and executing my commands as a shell script, but protractor (and npm) can't be found there either. Thanks in advance!
Upvotes: 0
Views: 179
Reputation: 108
Solved this by installing protractor globally through the NodeJS Plugin for Jenkins
Upvotes: 0