npm install fails due to package.json issues (and protractor tests fail)
yoav-zibin opened this issue · 5 comments
-
normal users don't have access to this:
"angular-material": "git+ssh://git@github.com/angular/bower-material.git#master"
so I changed it to:
"angular-material": "*" -
Then I got these warnings:
├── UNMET PEER DEPENDENCY angular-route@>=1.3 <1.6
├── UNMET PEER DEPENDENCY angular-sanitize@>=1.3 <1.6
npm WARN angular-material@1.0.8 requires a peer of angular-route@>=1.3 <1.6 but none was installed.
npm WARN angular-material@1.0.8 requires a peer of angular-sanitize@>=1.3 <1.6 but none was installed.
So I added:
"angular-route": "^1.5.5",
"angular-sanitize": "^1.5.5",
-
Protractor is not listed as devDependency, so I added:
"http-server": "",
"protractor": "" -
Did:
./node_modules/protractor/bin/webdriver-manager update -
Then I got:
Error: Invalid path to plugin: ./node_modules/protractor/plugins/accessibility/index.js
because you have:
plugins: [{
chromeA11YDevTools: true,
path: './node_modules/protractor/plugins/accessibility/index.js'
}],
I removed that. BTW, How do I install that plugin?
- Then changed:
'./test/e2e//*.js'
to
'e2e//*.js'
Also changed:
seleniumAddress:'http://127.0.0.1:4444/wd/hub',
to:
directConnect: true,
- I changed all the includes that use node_modules to:
and
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc4/angular-material.js"></script>- and finally run from app/ folder:
./node_modules/http-server/bin/http-server -p 8080
and from the root folder:
./node_modules/protractor/bin/protractor test/protractor.conf.js
and then all the tests fail :(
(despite the fact that the app works fine in the browser)
./node_modules/protractor/bin/protractor test/protractor.conf.js
[15:29:04] I/direct - Using ChromeDriver directly...
[15:29:04] I/launcher - Running 1 instances of WebDriver
Started
.F
Failures:
- my app selecting a user should set focus on first button in the bottomsheet view
Message:
Failed: No element found using locator: By(css selector, button.contact)
Stack:
NoSuchElementError: No element found using locator: By(css selector, button.contact)
at WebDriverError (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/error.js:26:26)
at NoSuchElementError (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/error.js:229:26)
at /Users/yzibin/git/material-start/node_modules/protractor/built/element.js:662:27
at Promise.invokeCallback_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:1329:14)
at TaskQueue.execute_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2773:21)
at /Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2652:27
at /Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:639:7
at process.tickCallback (internal/process/next_tick.js:103:7)
Error
at ElementArrayFinder.applyAction (/Users/yzibin/git/material-start/node_modules/protractor/built/element.js:371:27)
at ElementArrayFinder.this.(anonymous function) as click
at ElementFinder.this.(anonymous function) as click
at [object Object].contactUser (/Users/yzibin/git/material-start/test/e2e/pages/UserDetails.js:5:25)
at Object. (/Users/yzibin/git/material-start/test/e2e/scenarios/users.js:24:22)
at /Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:96:23
at new Promise (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:1043:7)
at controlFlowExecute (/Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:82:18)
at TaskQueue.execute (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2773:21)
From: Task: Run beforeEach in control flow
at Object. (/Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:81:14)
at /Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:18:5
at Promise.invokeCallback_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:1329:14)
at TaskQueue.execute_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2773:21)
at /Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2652:27
From asynchronous test:
Error
at Suite. (/Users/yzibin/git/material-start/test/e2e/scenarios/users.js:23:5)
at Suite. (/Users/yzibin/git/material-start/test/e2e/scenarios/users.js:21:3)
at Object. (/Users/yzibin/git/material-start/test/e2e/scenarios/users.js:7:1)
Message:
Expected 0 to be 4.
Stack:
Error: Failed expectation
at Object. (/Users/yzibin/git/material-start/test/e2e/scenarios/users.js:28:43)
at /Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:96:23
at new Promise (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:1043:7)
at controlFlowExecute (/Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:82:18)
at TaskQueue.execute_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2773:21)
at /Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2697:25
at /Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:639:7
at process.tickCallback (internal/process/next_tick.js:103:7)
Message:
Failed: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By(css selector, [ng-click="cp.submitContact(item)"])
Stack:
NoSuchElementError: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By(css selector, [ng-click="cp.submitContact(item)"])
at WebDriverError (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/error.js:26:26)
at NoSuchElementError (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/error.js:229:26)
at /Users/yzibin/git/material-start/node_modules/protractor/built/element.js:248:27
at Promise.invokeCallback (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:1329:14)
at TaskQueue.execute_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2773:21)
at /Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2652:27
at /Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:639:7
at process.tickCallback (internal/process/next_tick.js:103:7)
Error
at ElementArrayFinder.applyAction (/Users/yzibin/git/material-start/node_modules/protractor/built/element.js:371:27)
at ElementArrayFinder.this.(anonymous function) as getText
at ElementFinder.this.(anonymous function) as getText
at Object. (/Users/yzibin/git/material-start/test/e2e/scenarios/users.js:29:41)
at /Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:96:23
at new Promise (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:1043:7)
at controlFlowExecute (/Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:82:18)
at TaskQueue.execute (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2773:21)
at /Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2697:25
From: Task: Run it("should set focus on first button in the bottomsheet view") in control flow
at Object. (/Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:81:14)
at /Users/yzibin/git/material-start/node_modules/jasminewd2/index.js:101:16
at Promise.invokeCallback_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:1329:14)
at TaskQueue.execute_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext_ (/Users/yzibin/git/material-start/node_modules/selenium-webdriver/lib/promise.js:2773:21)
From asynchronous test:
Error
at Suite. (/Users/yzibin/git/material-start/test/e2e/scenarios/users.js:27:5)
at Suite. (/Users/yzibin/git/material-start/test/e2e/scenarios/users.js:21:3)
at Object. (/Users/yzibin/git/material-start/test/e2e/scenarios/users.js:7:1)
2 specs, 1 failure
Finished in 2.513 seconds
[15:29:08] I/launcher - 0 instance(s) of WebDriver still running
[15:29:08] I/launcher - chrome #1 failed 1 test(s)
[15:29:08] I/launcher - overall: 1 failed spec(s)
[15:29:08] E/launcher - Process exited with error code 1
BTW, if I add a call to sleep in:
this.loadAll = function() {
browser.get('/#');
browser.sleep(5000);
};
then one spec passes :)
I also had an issue with:
"angular-material": "git+ssh://git@github.com/angular/bower-material.git#master"
it caused npm install to hang, and since I'm no expert I couldn't figure out why for quite some time.
Same here. Probably caused by blocked git and ssh ports on the corporate network.
Same I changed to "angular-material": "*"
and works
This should now be fixed on the es6
and es6-tutorial
branches.
Please let me know if you're still experiencing any issues.