angularjs-e2e

Mocking API with httpBackend [Protractor]

∥☆過路亽.° 提交于 2019-12-06 07:25:49
问题 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

Protractor - upload file/ running exe via protractor

情到浓时终转凉″ 提交于 2019-12-06 06:43:57
问题 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

Angular e2e tests affecting database

二次信任 提交于 2019-12-06 06:18:18
问题 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

DRYing up protractor clicks tests using a For-Loops

空扰寡人 提交于 2019-12-06 06:02:21
Question: How do I click on every link in a ul > li a from one test? Problem: this test is passing; however, it isn't clicking on the links. I know this because It isn't redirecting or waiting 2000ms. Test: it("should have proper page linking to all footer link", function() { browser.driver.sleep(2000); browser.ignoreSynchronization = true; //creates an array of strings of all the menu items var titles = element.all(by.css('.leftMenu.first .submenu li a')) .map(function(elm) { return elm.getText().then(function(text){ return text; }); }); //iterates through the links via titles array for (var

verify that element disappear in protractor

狂风中的少年 提交于 2019-12-06 05:25:00
问题 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

Mocking an angular service in Protractor

假装没事ソ 提交于 2019-12-06 05:20:18
I'm trying to use Protractor's addMockModule to insert mock data in my end-2-end test. My test is supposed to go to a web site, find a button by css-class and click it. The button click calls the function dostuff() in MyService, which fetches data from the backend. My code so far: describe('should display validation error', function () { it('should work', function () { browser.get('http://my.url'); browser.addMockModule('MyService', function () { // Fake Service Implementation returning a promise angular.module('MyService', []) .value({ dostuff: function () { return { then: function (callback)

AngularJS Protractor E2E Mocking

巧了我就是萌 提交于 2019-12-06 04:06:19
问题 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

Protractor - Page Object is not updating when the DOM elements are changed

雨燕双飞 提交于 2019-12-06 03:15:58
I am testing a SPA built with angular.js and im using Page Objects pattern to write my tests. In the app we have a number of lists that will be updated. For example there is a list of attachments that will update when ever attachments are added/removed. To add an attachment we have a modal window and when we upload a file and click ok. The file uploads and the lists update. I have written 2 page objects, one for the upload modal window and the other one for the preview of the attachment list. In my tests i first get the current count of the attachments then i click on a button to activate the

btstrpd Error when testing AngularJS app with Protractor

梦想的初衷 提交于 2019-12-05 20:56:24
I’m currently trying to do some E2E testing of an AngularJS app using Protractor and I’m stuck with the btstrpd error. I'm new to AngularJS (I'm just the test automation guy in the project), so I’d really appreciate any pointers on how to make it run. Basically I just copied and pasted the sample configuration and specification from the Protractor tutorial and adapted it for my project: // conf.js exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['spec.js'], rootElement: 'html' } // spec.js describe('Protractor Demo App', function() { it('should have a title',

How to run protractor from webapp?

丶灬走出姿态 提交于 2019-12-05 19:01:33
I've some protractor tests (against angularApp) that I would like to run. To do that, i've created an user interface that prompts an user for the script file. Then I need, somehow, make protractor start and run the test. What are my options to achieve this ? You can pass the file to your backend (and save it), which then executes the test as you normally would protractor conf.js . If you don't have a backend that can run protractor via node, then you need to fork your own copy of Protractor, strip out any node APIs, and do something similar to what https://github.com/angular/protractor/blob