angularjs-e2e

Accessing $http data in Protractor / E2E tests (AngularJS)

谁都会走 提交于 2020-01-01 12:24:01
问题 I have a bunch of Unit tests that are going well, and I've started to add Protractor E2E tests to my project. I'm doing okay testing interactive elements on the page, but I'm having trouble testing for certain data being sent out of the browser. For instance, I want to see if clicking a certain button produces a POST to a certain endpoint. I have protractor set up using the following: /*globals global*/ module.exports = function() { 'use strict'; var chai = require('chai') , promised =

Protractor e2e throwing webdriver is not defined

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 09:43:42
问题 I had my protractor running untill few days ago when i started encountering: Using the selenium server at http://localhost:4444/wd/hub **** UNCAUGHT EXCEPTION **** Error: connect ECONNREFUSED at exports._errnoException (util.js:682:11) at Object.afterConnect [as oncomplete] (net.js:947:19) **************************** **** UNCAUGHT EXCEPTION **** Error: socket hang up at createHangUpError (_http_client.js:182:15) at Socket.socketCloseListener (_http_client.js:214:23) at Socket.EventEmitter

Protractor instance vs browser

假如想象 提交于 2020-01-01 01:12:06
问题 I have tried to looked up for similar QA's but i couldn't find one to satisfy me. So basically i saw that in some examples it's used ptor = protractor.getInstance(); ptor.get(url); And in some other examples it's used. browser.get(url); So th question is: What's the difference using protractor instance and browser for getting specific url? Also if my assumption in the P.S. is right, which is better practice: to use only protractor, or to mix them? P.S. Also i saw same difference in usage with

How to find element by two attributes

烂漫一生 提交于 2019-12-30 13:12:30
问题 I have radio buttons like, how can I get the second one clicked finding first by ng-model then ng-value : <input type="radio" ng-model="vm.ist.educationVsInternship" ng-value=false /> <input type="radio" ng-model="vm.ist.educationVsInternship" ng-value=true /> I tried something like element(by.model('vm.ist.educationVsInternship')).all(by.css('[ng-value=true]')).click(); says and does not click any of them more than one element found for locator by.model("vm.ist.educationVsInternship") - the

How to find element by two attributes

…衆ロ難τιáo~ 提交于 2019-12-30 13:12:08
问题 I have radio buttons like, how can I get the second one clicked finding first by ng-model then ng-value : <input type="radio" ng-model="vm.ist.educationVsInternship" ng-value=false /> <input type="radio" ng-model="vm.ist.educationVsInternship" ng-value=true /> I tried something like element(by.model('vm.ist.educationVsInternship')).all(by.css('[ng-value=true]')).click(); says and does not click any of them more than one element found for locator by.model("vm.ist.educationVsInternship") - the

How to validate when a checkbox is checked in AngularJS e2e tests?

旧城冷巷雨未停 提交于 2019-12-30 03:45:06
问题 I've been trying out the AngularJS e2e tests and am getting stuck determining whether or not a checkbox is checked. I used the end to end test for the checkbox input as a sample (see the End to end test tab in the Example ). Html snippet: Value1: <input type="checkbox" ng-model="value1"> <br/> Controller snippet: function Ctrl($scope) { $scope.value1 = true; } Here is what I tried: 1) expect(binding('value1')).toEqual('true'); This works in the sample end to end test as long as value1 is

Getting error: Error while waiting for Protractor to sync with the page: {}

荒凉一梦 提交于 2019-12-29 04:48:08
问题 My e2e.conf.coffee file is: exports.config = baseUrl: 'http://localhost:9001' specs: [ 'e2e/**/*.coffee' ] framework: 'jasmine' I have my node project running and listening on port 9001. My test is: describe 'Happy Path', -> it 'should show the login page', -> console.log browser expect(browser.getLocationAbsUrl()).toMatch("/view1"); it 'should fail to login', -> setTimeout -> console.log "FAIL!" , 1200 And the error that I get is: Failures: 1) Happy Path should show the login page Message:

Why I am not able be see any expect methods like .toBe () in Protractor?

强颜欢笑 提交于 2019-12-25 05:02:03
问题 Why I am not able to see any methods for expect in protractor? For example when use expect in protractor like below expect(true).toBe(true); After the dot I don't find any method as shown above toBe() C:\>npm -g list C:\Users\x216526\AppData\Roaming\npm +-- protractor@4.0.3 | +-- adm-zip@0.4.7 | +-- chalk@1.1.3 | | +-- ansi-styles@2.2.1 | | +-- escape-string-regexp@1.0.5 | | +-- has-ansi@2.0.0 | | | `-- ansi-regex@2.0.0 | | +-- strip-ansi@3.0.1 | | `-- supports-color@2.0.0 | +-- glob@7.0.5 |

Get back the webdriver.Locator out of an elementFinder

纵饮孤独 提交于 2019-12-24 00:56:18
问题 Given I have the elmFinder variable: var elmFinder = element(by.css('.thing')); What if i need to get back the webdriver.Locator, a.k.a locator strategy? i.e. elmFinder.??? //=> by.css('.thing') I'm looking after the function ??? if it exists. UPDATE: This feature has been merged and we can now do: elmFinder.locator(); 回答1: UPDATE: This feature has been merged and we can now do: elmFinder.locator(); Old answer: You cannot. The element finder does not keep a reference to the locator: https:/

AngularJS e2e tests hang when changing between two separate angular apps

て烟熏妆下的殇ゞ 提交于 2019-12-22 19:31:16
问题 I have a frustrating problem: I want to write end to end tests for a complex angular app. The problem is that the login screen is a separate app. The initial idea was that it would branch out to separate other angular apps in our ecosystem based on the login credentials. It works like a charm. For the tests it is a nightmare though. The tests work as expected but as soon as correct credentials are entered and the main angular app is loaded the tests just time out. No error message or debug