Issue
I'm trying to run my protractor test on a jenkins server. But i get every time following error message:
TypeError: Cannot read property 'visibilityOf' of undefined
Stacktrace: TypeError: Cannot read property 'visibilityOf' of undefined at waitingForElement (/var/lib/jenkins/jobs/workspace/project/dist/dev/scripts/test/e2e/helper.e2e.js:9:20) at Object.switchTab (/var/lib/jenkins/jobs/workspace/project/dist/dev/scripts/test/e2e/helper.e2e.js:135:5) at null. (/var/lib/jenkins/jobs/workspace/project/dist/dev/scripts/test/e2e/test-employee.e2e.js:87
This is the respective code:
function waitingForElement(elem, timeOut) {
var EC = protractor.ExpectedConditions;
browser.wait(EC.visibilityOf(elem), timeOut);
....
}
And at the top line line i have a reference to the angular-protractor typings:
/// <reference path="../../../../typings_custom/angular-protractor/index.d.ts" />
And this is my jenkins configuration:
echo "build tests"
npm run build.e2e
#Run protractor
protractor protractor-config.js --params.url "http://localhost:90" --suite testSuite
But when i'm runnig the protractor test locally or in a server terminal then they are working, but not as Jenkins job.
Any ideas?
With best regards.
Solution
The error results in missing rights to execute the globale protractor installation.
The solution is quite simple, i need to use the local "installation"
of protractor:
./node_modules/protractor/bin/protractor ...
Answered By - Batajus