I’m trying to execute the sh scripts/e2e-test.sh on a Mac, then I get a message: “To view this web content, you need to install the java runtine enviroment”. I clicked more info and install java, then a try to execute sh scripts/e2e-test.sh again, but still getting the same message, also on my console I get the following timeout message:
sh scripts/e2e-test.sh
Updating WebDriver
scripts
selenium standalone is up to date.
chromedriver is up to date.
Starting Protractor tests
scripts
Starting selenium standalone server…
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1
/Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1761
throw error;
^
Error: Timed out waiting for the WebDriver server at http://192.168.1.34:57603/wd/hub
at Error ()
at onResponse (/Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:87:11)
at /Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:42:21
at /Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
at ClientRequest. (/Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:145:7)
at ClientRequest.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1552:9)
at Socket.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:442:13)
according to the stackoverflow the error is with the 2.41.0 version, but they suggest to downgrading to 2.9.248307 but I don’t know to make a downgrade.
extracted the files into a directory “angular-seed”
cd angular-seed
created test.html in angular-seed/app/
angular-seed/app/test.html:
<!doctype html>
<html lang="en" ng-app>
<head>
<title>My First AngularJS App</title>
</head>
<body ng-init="salary=0;percentage=0">
Your Salary?
<input type="text" ng-model="salary"><br/>
How much should you invest in gadgets?
<input type="text" ng-model="percentage">%<br/>
The amount to be spent in shopping will be:
<span>{{salary*percentage*0.01}}</span>
<script src="lib/angular/angular.js"></script>
</body>
</html>
Then (I already had node and npm installed), I ran node scripts/web-server.js and navigated to http://localhost:8000/app/test.html. It worked.
After that I ran the following commands from the angular-seed directory.
npm install karma
npm install jasmine
npm install karma-chrome-launcher
npm install protractor
I then made sure that the test server was still running on port 8000 (as described above) and ran:
sh scripts/e2e-test.sh
This was the output:
Updating WebDriver
scripts
-------------------------------------------------------------------
Updating selenium standalone
downloading https://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar...
Updating chromedriver
downloading https://chromedriver.storage.googleapis.com/2.14/chromedriver_linux64.zip...
chromedriver_2.14.zip downloaded to /home/jim/Desktop/angular-seed/node_modules/protractor/selenium/chromedriver_2.14.zip
selenium-server-standalone-2.44.0.jar downloaded to /home/jim/Desktop/angular-seed/node_modules/protractor/selenium/selenium-server-standalone-2.44.0.jar
Starting Protractor tests
scripts
-------------------------------------------------------------------
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.178.35:51111/wd/hub
FFF
Failures:
1) my app should automatically redirect to /view1 when location hash/fragment is empty
Message:
Expected 'http://localhost:8000/app/index.html' to match '/view1'.
Stacktrace:
Error: Failed expectation
at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:10:41)
2) my app view1 should render view1 when user navigates to /view1
Message:
Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector("[ng-view] p")
Stacktrace:
Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector("[ng-view] p")
==== async task ====
Asynchronous test function: it()
Error
at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:22:57)
Error
at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:21:5)
at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:14:3)
at Object.<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:5:1)
3) my app view2 should render view2 when user navigates to /view2
Message:
Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector("[ng-view] p")
Stacktrace:
Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector("[ng-view] p")
==== async task ====
Asynchronous test function: it()
Error
at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:37:57)
Error
at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:36:5)
at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:29:3)
at Object.<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:5:1)
Finished in 1.622 seconds
3 tests, 3 assertions, 3 failures
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 3 test(s)
[launcher] overall: 3 failed spec(s)
[launcher] Process exited with error code 1
As you can see, the test failed, but were at least executed.
So, back to your problem, the main points to check are:
is the node server running
did you install all of the dependencies
are you running the commands from within the correct directory
Ready Pullo, I did not have java install on my os x (I was trying to install java from the java.com page), I have to installed from the apple java version from this link: http://support.apple.com/kb/DL1572. Once again, thanks for your help.
Just by way of info - you can like any posts you have found helpful or that you think make a good point (by hitting the heart next to the respective posts).