angularjs-e2e

Log console errors using protractor

*爱你&永不变心* 提交于 2021-02-18 13:57:37
问题 I am trying to log console errors in protractor like this log output is in format { level: { value: 900, name: 'WARNING' }, message: 'message', timestamp: 1442090739962, type: '' }, { level: { value: 800, name: 'INFO' }, message: 'message', timestamp: 1442090740723, type: '' }, { level: { value: 1000, name: 'ERROR' }, message: 'error message', timestamp: 1442090740723, type: '' }, I want to catch only errors so i have written test like this it('it should be detect console errors', function()

Protractor get element by model in repeater array

假如想象 提交于 2020-01-16 05:20:32
问题 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 an unable to

How to run protractor from webapp?

£可爱£侵袭症+ 提交于 2020-01-13 17:04:41
问题 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 ? 回答1: 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

Activating chrome language flags when activating from protractor (selenium)

我们两清 提交于 2020-01-11 05:26:27
问题 I'm writing end to end tests with Protractor for an angular website. We have to support certain languages so I would like to init chrome using the --lang flag and start it with some other language. I searched the web and couldn't find any example to how it can be done. My only lead was some article I saw and understood that I need to add to Protractor config file the "capabilities" section and there I can define the "args" property. Then tried to tinker with it but no luck. Any help will be

How can I make Protractor NOT wait for $timeout?

做~自己de王妃 提交于 2020-01-11 05:01:09
问题 I'm testing my angular application with Protractor. Once the user is logged in to my app, I set a $timeout to do some job in one hour (so if the user was logged-in in 13:00, the $timeout will run at 14:00). I keep getting these failures: "Timed out waiting for Protractor to synchronize with the page after 20 seconds. Please see https://github.com/angular/protractor/blob/master/docs/faq.md. The following tasks were pending: - $timeout: function onTimeoutDone(){....." I've read this timeouts

DRYing up protractor clicks tests using a For-Loops

房东的猫 提交于 2020-01-02 16:03:10
问题 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

how to have protractor take over browser in the middle of an application

夙愿已清 提交于 2020-01-02 09:56:14
问题 I have written an angular project that utilizes require js, so most javascript will not be loaded prior to landing on a particular set of pages. (including angular.js) when writing flows, I had to use browser.driver in place of ptor, and this worked well until angular components came rolling in. Now I am trying to find a way to squeeze the initialization of ptor into the browser.driver and roll in the angular after a particular flow. So I have something like this browser.driver.getCurrentUrl(

how to have protractor take over browser in the middle of an application

扶醉桌前 提交于 2020-01-02 09:56:12
问题 I have written an angular project that utilizes require js, so most javascript will not be loaded prior to landing on a particular set of pages. (including angular.js) when writing flows, I had to use browser.driver in place of ptor, and this worked well until angular components came rolling in. Now I am trying to find a way to squeeze the initialization of ptor into the browser.driver and roll in the angular after a particular flow. So I have something like this browser.driver.getCurrentUrl(

Protractor - how to reuse the same spec file for different tests

巧了我就是萌 提交于 2020-01-01 18:17:12
问题 In my Protractor conf.js file, I'd like to re-use the same spec files multiple times; however, it's seems to not be possible. Some background: We are reading test cases from a JSON file, launching reports, then testing grid results and various DOM elements. All reports have the same format. The primary differences lie in the report titles, data columns, actual data results, etc. So in my conf.js file, ideally I'd like to re-use the same spec files multiple times - but my understanding is that

Mocking angularjs http requests

拜拜、爱过 提交于 2020-01-01 14:09:20
问题 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