angularjs-e2e

Mocking API with httpBackend [Protractor]

99封情书 提交于 2019-12-04 14:58:08
I'm developing a frontend app for a REST API. I'm using Protractor for end-to-end tests with the API mocked out. I was able to mock AUTHtoken API response and navigate to chosen URL, but page displayed under destined URL renders empty. Here's my code: describe('e2e tests', function() { it('FO tests', function() { browser.addMockModule('WebClientApp', function() { console.log('test'); angular.module('WebClientApp', ['ngMockE2E']) .run(function($httpBackend) { console.log('test2'); $httpBackend.whenPOST('http://0.0.0.0:9000/api/organizations').respond(200); $httpBackend.whenPOST('/api/auth/get

Protractor - upload file/ running exe via protractor

二次信任 提交于 2019-12-04 14:37:33
I have a web site written in Angular and I'm trying to do end-to-end testing using Protractor. The website has a "add button", that opens "choose file dialog box". I want to be able add a file from protractor, but it doesn't upload the file or closes the dialog box. I tried to create a .exe file that controls the dialog box via (autoIt) and it works fine (when the dialog box pop up i run the .exe and everything is working fine). However, I don't understand how to tell the protractor to launch an .exe after the dialog box appears. var path = require('path'); it('should upload a file', function(

How to getText from all rows & columns in an infinite scrolling ng-grid using protractor?

拈花ヽ惹草 提交于 2019-12-04 14:05:48
问题 I am trying to write a function which returns the complete grid content in an array. Our ng-grid has infinite scrolling through the rows and also have scrolling through the columns. I have found an answer for scrolling here Protractor: Scrolling a table and testing for infinite scroll But I am looking to scroll through the grid fully and get the data, So that I can validate the data when I apply filters to the grid. Any help on this is highly appreciated, thanks Sample HTML Code for the rows

verify that element disappear in protractor

柔情痞子 提交于 2019-12-04 12:56:56
For wait purposes I use such kind of wait function: browser.wait(function() { return browser.isElementPresent(by.repeater('recentName in recentNames').row(0)); }, 10000); How I can wait for element to disappear from the page? I have project which have lots of modal windows and because elements are always presented on the page I have difficulties and test failures from time to time, because I used wrong elements to wait. For example I have such element which disappear when modal window closes after clicking Enter: <div class="modal-backdrop in"></div> You can use a custom waitAbsent() helper

Angular e2e tests affecting database

允我心安 提交于 2019-12-04 11:05:21
Here's my issue, steb by step :)) I thought it reads better this way, unlike a wall of text pitifully trying to explain my very domain-specific problem. 1) We have a Angular.js app with PHP back-end backed with MongoDB storage. 2) Protractor for End-to-end tests. 3) Need to test pages which alter the database, i.e. registration scenario - I'm going through all registration steps in a test, so the db gets a new user record. 4) Predictably, test will fail after it was run, since the db has a record for the test user and no registration is needed - user is redirected to homepage instead. I was

AngularJS Protractor E2E Mocking

老子叫甜甜 提交于 2019-12-04 09:41:31
I have an Angular SPA retrieving its data from a node backend. Since the node project is fully covered with tests I want to mock the Angular HTTP calls. (I do not want to start a discussion about functional-/smoke-tests in general, thanks). What I'd like to have is s.th. like this Api = $injector.get('Api'); sinon.mock(Api, 'getSomethingFromServer').andRespondWith({foo: 'bar'}) assert(Api.getSomethingFromServer.wasCalledOnce); But no matter how I can't find a nice solution. I found several posts regarding the same issue. For example this one . Since protractor is changing a lot and frequently,

Protractor how to run login test script first

大兔子大兔子 提交于 2019-12-04 09:34:38
问题 I am trying to test an Angular Single Page application with protractor. I need to run the login script first. Only then I can move to other routes since there is a check for token in localStorage on route change. Is this testing approach correct?. In that case I need to run the login script first. Does protractor allows to control the spec file order. Or should I run the each script independently by hardcoding the token in localStorage (Should I do login api call independently before each

Mocking angularjs http requests

你。 提交于 2019-12-04 09:28:26
So i have done quite a research already before asking this and none of them is what i want. I have an app bootstrapped with angular module. The controller inside the module makes some http requests. Now i am unit testing my app for ui and i need to mock the http requests. All the mocking that i have read is done with jasmine, but i don't want to use it. I want that whenever i open the app, all the requests get mocked. I have already tried angular mock and the backend mocks, none of them workes. And i dont want to prepopulate the scope elements because the code should be deployment ready. If

Protractor e2e throwing webdriver is not defined

不打扰是莪最后的温柔 提交于 2019-12-04 06:11:32
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.emit (events.js:120:20) at TCP.close (net.js:459:12) **************************** on further digging

A Jasmine spec timed out. Resetting the WebDriver Control Flow - when redirect to new page

若如初见. 提交于 2019-12-04 04:29:48
I'm bedinner in e2e testing and have a problem. When I do login - I make redirect from login.php to index.php page. But my test is fails with following errors: ..A Jasmine spec timed out. Resetting the WebDriver Control Flow. F Failures: 1) Login Page should login and redirect to overview page with CR Operators rights Message: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. Stack: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. 3 specs, 1 failure My code: it('should login