Angularjs trying to run protractor - angularjs

I am completing this angularjs tutorial
on step 3 they tell you to run the protractor by npm run protractor
when i do this inside the angular-phonecat folder nothing happens:
I have run the npm install and npm run update-webdriver command as directed beforehand.
Whats more i downloaded the android seed project and copied the code from step 3 in the tutorial to the controlers.js index.html and scenerios.js
When i run the protractor I get the following error (after my browser opens):
> angular-seed#0.0.0 protractor C:\wamp\www\angularSite
> protractor test/protractor-conf.js
Starting selenium standalone server...
Selenium standalone server started at http://10.0.7.22:55840/wd/hub
C:\wamp\www\angularSite\node_modules\protractor\node_modules\selenium-webdriver\
lib\webdriver\promise.js:1549
throw error;
^
Error: Angular could not be found on the page http://localhost:8000/app/index.ht
ml : retries looking for angular exceeded
at assertAngularOnPage (C:\wamp\www\angularSite\node_modules\protractor\lib\
protractor.js:668:13)
at C:\wamp\www\angularSite\node_modules\protractor\node_modules\selenium-web
driver\lib\goog\base.js:1178:15
at webdriver.promise.ControlFlow.runInNewFrame_ (C:\wamp\www\angularSite\nod
e_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:14
45:20)
at notify (C:\wamp\www\angularSite\node_modules\protractor\node_modules\sele
nium-webdriver\lib\webdriver\promise.js:328:12)
at notifyAll (C:\wamp\www\angularSite\node_modules\protractor\node_modules\s
elenium-webdriver\lib\webdriver\promise.js:297:7)
at fulfill (C:\wamp\www\angularSite\node_modules\protractor\node_modules\sel
enium-webdriver\lib\webdriver\promise.js:402:7)
at Object.webdriver.promise.asap (C:\wamp\www\angularSite\node_modules\protr
actor\node_modules\selenium-webdriver\lib\webdriver\promise.js:678:5)
at webdriver.promise.ControlFlow.runInNewFrame_ (C:\wamp\www\angularSite\nod
e_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:14
56:25)
at notify (C:\wamp\www\angularSite\node_modules\protractor\node_modules\sele
nium-webdriver\lib\webdriver\promise.js:328:12)
at notifyAll (C:\wamp\www\angularSite\node_modules\protractor\node_modules\s
elenium-webdriver\lib\webdriver\promise.js:297:7)
==== async task ====
WebDriver.executeScript()
at webdriver.WebDriver.schedule (C:\wamp\www\angularSite\node_modules\protra
ctor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:267:15)
at webdriver.WebDriver.executeAsyncScript (C:\wamp\www\angularSite\node_modu
les\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:507:15
)
at Protractor.get (C:\wamp\www\angularSite\node_modules\protractor\lib\protr
actor.js:675:15)
at null.<anonymous> (C:\wamp\www\angularSite\test\e2e\scenarios.js:7:11)
at jasmine.Env.describe_ (C:\wamp\www\angularSite\node_modules\protractor\no
de_modules\minijasminenode\lib\jasmine-1.3.1.js:907:21)
at jasmine.Env.describe (C:\wamp\www\angularSite\node_modules\protractor\nod
e_modules\minijasminenode\lib\jasmine-1.3.1.js:892:15)
at describe (C:\wamp\www\angularSite\node_modules\protractor\node_modules\mi
nijasminenode\lib\jasmine-1.3.1.js:652:27)
at Object.<anonymous> (C:\wamp\www\angularSite\test\e2e\scenarios.js:5:1)
at Module._compile (module.js:456:26)
npm ERR! angular-seed#0.0.0 protractor: `protractor test/protractor-conf.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the angular-seed#0.0.0 protractor script.
npm ERR! This is most likely a problem with the angular-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor test/protractor-conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-seed
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.0.6002
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
npm ERR! cwd C:\wamp\www\angularSite
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\wamp\www\angularSite\npm-debug.log
npm ERR! not ok code 0
Here is the contents of my log file (just in case) npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'protractor' ]
2 info using npm#1.4.3
3 info using node#v0.10.26
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'preprotractor', 'protractor', 'postprotractor' ]
6 info preprotractor angular-seed#0.0.0
7 info protractor angular-seed#0.0.0
8 verbose unsafe-perm in lifecycle true
9 info angular-seed#0.0.0 Failed to exec protractor script
10 error angular-seed#0.0.0 protractor: `protractor test/protractor-conf.js`
10 error Exit status 8
11 error Failed at the angular-seed#0.0.0 protractor script.
11 error This is most likely a problem with the angular-seed package,
11 error not with npm itself.
11 error Tell the author that this fails on your system:
11 error protractor test/protractor-conf.js
11 error You can get their info via:
11 error npm owner ls angular-seed
11 error There is likely additional logging output above.
12 error System Windows_NT 6.0.6002
13 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
14 error cwd C:\wamp\www\angularSite
15 error node -v v0.10.26
16 error npm -v 1.4.3
17 error code ELIFECYCLE
18 verbose exit [ 1, true ]
I run windows vista x64 on my machine if that helps at all.

I have encountered this when I forgot to run my webserver. You can solve it by simply running npm start in a separate shell. Protractor does not do this for you.

Had the same issue. For me, the problem was that I had not ran "bower install". Try running "bower install" and then "npm run protractor".

I managed to get to a different error by updating the karma and karma-jasmine version in package.json
"devDependencies": {
"karma": "~0.12",
"karma-jasmine": "~0.2.0",
I then fixed something else:
https://stackoverflow.com/a/23772014/329367

I had the same problem and installing a Java Runtime fixed it for me.
The Selenium driver requires java.
Be sure to open a new console after installing so java is added to the path.

Error: Angular could not be found on the page
means protractor could probably not find ng-app on the page.
<html ng-app="yourAppName">
check your html page. some people had problems with this when the ng-app tag was not inside the outest of html elements. at level might be sufficient. (or protractor could not access your page at all).

In my case there was a problem with versions in package.json. I've tried the examples from Jonh Papa and, with my code, extracted from the AngularJS tutorial, it didn't work.
I've taken the package.json from the AngularJS tutorial, removed that of Papa, moved node_modules to node_modules__ and run npm install and now everything works as expected.

This is what solved the issue for me:
1. Delete node_modules folder
2. Run npm install

Related

Ionic 5 when im trying to take cordova android build this error is displaying?

I'm getting the following errors:
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for cordova-android#0.0.8
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\FSTECH-17\AppData\Roaming\npm-cache\_logs\2020-07-20T06_20_28_398Z-debug.log
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android --save exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I suppose your version doesn't exist. I'm using cordova-android at version "8.1.0".

Angular-seed protractor throws error

I try run angular-seed on my computer (Windows 10, last update) https://github.com/angular/angular-seed. Web works fine, but I have problem with protractor. Karma runs, but when I try protractor > npm run protractor I get these error.
E:\angular-seed>npm run protractor
> angular-seed#0.0.0 preprotractor E:\angular-seed
> npm run update-webdriver
> angular-seed#0.0.0 preupdate-webdriver E:\angular-seed
> npm install
npm WARN install Couldn't install optional dependency: Unsupported
> angular-seed#0.0.0 postinstall E:\angular-seed
> bower install
> angular-seed#0.0.0 update-webdriver E:\angular-seed
> webdriver-manager update
selenium standalone is up to date.
chromedriver is up to date.
> angular-seed#0.0.0 protractor E:\angular-seed
> protractor e2e-tests/protractor.conf.js
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn java ENOENT
at exports._errnoException (util.js:855:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:455:9)
at process._tickCallback (node.js:369:17)
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
npm ERR! node v5.3.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! angular-seed#0.0.0 protractor: `protractor e2e-tests/protractor.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-seed#0.0.0 protractor script 'protractor e2e-tests/protractor.conf.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor e2e-tests/protractor.conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-seed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! E:\angular-seed\npm-debug.log
I have all up to date. I clone from git today and run npm update. It is my problem or it is package problem?
Home page of Angular seed doesn't mentioned that, but protractor has dependency on JDK. Do you have it installed? You can check this by
java --version

Trying to run protractor in Step 3 in angular js tutorial

I am unable to run e2e test using protractor
When I am trying to run the angular phonecat app code from https://docs.angularjs.org/tutorial
It is showing this error
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver [launcher] Process exited with error code 1
events.js:85
throw er; // Unhandled 'error' event
^ Error: spawn java ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\no un" "protractor"
npm ERR! node v0.12.7
npm ERR!
npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat#0.0.0 protractor: `protractor test/protractor-conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 protractor script 'protractor test/pro
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor test/protractor-conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\xxxxx\Documents\GitHub\angular-phonecat\npm-debug.log
You have chrome and chrome driver installed?
Try this:
In 'protractor-conf.js' remove 'chromeOnly: true,' and put 'directConnect: true,'.
you can find it in angular_phonecat\test
plus, run node cmd in administrator mode. That was the missing link for me!

Errors running e2e tests in Protractor

I am trying to run the scenarios.js Protractor e2e test in the angularjs tutorial, here https://docs.angularjs.org/tutorial. I am following the instructions on the tutorial step two in the blue box.
If I cd into the angular-phonecat directory like they say, I can run npm install, npm run update-webdriver and npm start without errors. I have Version 2.1.0 of protractor installed but when I try to run it I get these errors:
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "protractor"
npm ERR! node v0.12.4
npm ERR! npm v2.11.1
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat#0.0.0 protractor: `protractor test/protractor-conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 protractor script 'protractor test/protractor-conf.js'.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor test/protractor-conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/cohenwan/Sites/angular-phonecat/npm-debug.log
I am not sure if the documentation for the app tutorial is faulty, but I would really like to learn how to end2end test in Protractor, but this isn't helpful. Any recommendations? Or suggestions of better ways to learn Protractor?
I found out I needed to download chrome driver here: http://chromedriver.storage.googleapis.com/index.html?path=2.15/. I downloaded the mac32.zip. And now it is working.

angular phonecat tutorial protractor testcase failure

I've just installed the angular phonecat tutorial here on an old laptop running Lubuntu 14.04. When I run npm run protractor it fails on the 5th testcase listed in the scenarios.js file. The testcase in question is:
it('should display nexus-s page', function() {
expect(element(by.binding('phone.name')).getText()).toBe('Nexus S');
});
the response at the terminal I get is:
selenium standalone is up to date.
chromedriver is up to date.
> angular-phonecat#0.0.0 protractor /home/david/angular-phonecat
> protractor test/protractor-conf.js
Using ChromeDriver directly...
....F..
Failures:
1) PhoneCat App Phone detail view should display nexus-s page
Message:
Expected '' to be 'Nexus S'.
Stacktrace:
Error: Failed expectation
at [object Object].<anonymous> (/home/david/angular-phonecat/test/e2e/scenarios.js:84:59)
Finished in 19.212 seconds
7 tests, 11 assertions, 1 failure
npm ERR! angular-phonecat#0.0.0 protractor: `protractor test/protractor-conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 protractor script.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor test/protractor-conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-39-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "run" "protractor"
npm ERR! cwd /home/david/angular-phonecat
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/david/angular-phonecat/npm-debug.log
npm ERR! not ok code 0
I'm running this on a fairly old laptop so I wonder if its a performance issue.

Resources