how to test angularjs app with angularjs e2e with multiple inputs with same ng-model

Issue in our program we have a directive that occurs multiple times with an input field. Our code looks something like this <li> <label>AMI</label> <div class=”searchbox” searchbox=”” filter=”search.ami”> <form ng-submit=”doFilter()” class=”ng-pristine ng-valid”> <input class=”span12 ng-pristine ng-valid” type=”text” placeholder=”” ng-model=”filter”> </form>

Continue reading

Angular e2e test to check a list of elements

Issue My case is as follows – I have a simple page which lists available products: <ul class=”products ng-scope” id=”products”> <!– ngRepeat: tag in products –> <li ng-repeat=”product in products” class=”ng-scope”> <a ng-href=”/#/viewProduct/1″ class=”ng-binding” href=”/#/viewProduct/1″>Product A</a> </li><li ng-repeat=”product in products”

Continue reading

Angular E2E test binding for Radio buttons

Issue I have an angular page with some radio options, that section looks like this (abridged): div.row-fluid(ng-controller=”SearchCtrl”) … form(name=”pForm”) … div.span4 input(ng-model=’form.worktype’, type=’radio’, value=’fulltime’, name=’worktype’) | &nbsp; &nbsp; Full Time &nbsp; &nbsp; input(ng-model=’form.worktype’, type=’radio’, value=’parttime’, name=’worktype’) | &nbsp; &nbsp; Part

Continue reading

when running protractor with phantomjs browser, only able to run tests once

Issue test code: describe(‘mysite’, function(){ var init_url = ‘http://localhost/mySite/#/home’; beforeEach(function(){ // driver = new webdriver.Builder(). // withCapabilities(webdriver.Capabilities.phantomjs()).build(); }) it(‘should click on toolbox and do stuff’, function(){ browser.get(init_url); browser.waitForAngular(); browser.getCurrentUrl().then(function(url){ console.log(‘current_url’, url); expect(init_url).toEqual(init_url); }) expect(true).toBe(true); browser.sleep(2000); }) result 1st time run,

Continue reading

Setting up $httpBackend inside test files

Issue when running my e2e tests i setup fixtures like this in a bootstrap file: var myApp = angular.module(‘myApp’, [dependencies]); var appTest = angular.module(‘appTest’, [‘myApp’, ‘ngMockE2E’]); appTest.run(function($httpBackend) { $httpBackend.whenGET(‘/api/products’).respond(someResponseObject); }); then a have separated files for each the scenarios i

Continue reading

AngularJS E2E : Find element by tag name

Issue According to this link : https://docs.angularjs.org/api/ng/function/angular.element, the method “find()” allows to find an HTML element by tag name. I tried this in my code : element.find(‘button’).click(); And my HTML code is : <button ng-click=”getMessage()”>Request service as {{name}}</button> But the

Continue reading

protractor integration with IDE

Issue I have configured webstorm for using protractor, but when I launch my test suit, it does not recognize this param from my config file: // conf.js exports.config = { seleniumAddress: ‘http://localhost:4444/wd/hub’, specs: [‘spec.js’], capabilities: { browserName: ‘firefox’ } };

Continue reading

AngularJS and Visual Studio

Issue Is there an option to use AngularJS and all its features (including unit testing feature) in Visual Studio, without having NodeJS installed? Apart from this, is there any Visual Studio template/extension for AngularJS? Thanks and regards Solution have a

Continue reading

need protractor to wait for a service to return prior to testing

Issue I am relatively new to protractor, and I have not been able to make protractor to wait for a page to unload prior to testing. Example below: //in loginPage object function login(email, password) { element(by.id(‘inputEmail’)).sendKeys(email); element(by.id(‘inputPassword’)).sendKeys(password); element(by.css(‘.btn.btn-primary’)).click(); browser.driver.sleep(4000); return

Continue reading

Protractor e2e throwing webdriver is not defined

Issue 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 ****

Continue reading

Protractor get element by model in repeater array

Issue For example, in HTML page: <tr ng-repeat=”post in posts”> <td ng-click=”activePost(post)” class=”title”>{{post.title}}</td> <td><button class=”btn btn-danger” ng-click=”delete(post)”>Delete</button></td> <td><input type=”checkbox” ng-model=”post.active” id=”{{post.id}}” /></td> </tr> Then, I want something like: element.all(by.repeater(‘post in posts’)).then(function(posts) { var activePost = posts[0].element(by.model(‘active’)); expect(activePost).toEqual(true); }); This returns

Continue reading

How to identify page elements in protractor with no obvious identifiable property

Issue Background I have some (Angular JS template) HTML as follows: <div class=”data-handler-container”> <div class=”row”> <div class=”data-handler” ng-if=”dataController.showDistance()”> <p>{{ ‘Item Count’ | translate}} <p class=”metric”>{{dataController.project.item_total | converter:dataController.user.unit | number: 6}}<span class=”unit”>{{dataController.user.unit}}</span></p> </div> <div class=”data-handler”> <p>{{ ‘Total Time’ | translate}}</p> <p

Continue reading

Unable to click button in angular application using angular e2e testing

Issue This is the test case that I have wriiten : describe(‘Checkout flow testing’, function () { it(‘Testing Checkout’,function(){ console.log(‘navigating to product page’); browser().navigateTo(“/product/test-product5″) element(‘:button.add-cart’).click(); sleep(2); }) }) And the template of the button is as follows: <!– <button data-ng-if=”product.available”

Continue reading