end-to-end

Protractor - Scroll down and click

孤街醉人 提交于 2019-12-23 03:08:36
问题 I'm trying to simply scroll down in table and click on the element. This is function which I have: var scrollIntoView = function () { arguments[0].scrollIntoView(); } element.all(by.css('div.ui-grid-selection-row-header-buttons')).then(function(arr) { var row = arr[8]; browser.executeScript(scrollIntoView, row.getWebElement()).then(function () { row.click(); }); }); This script actually work and even scroll down, bproblem start when i use higher number (index) in arr[]; For example 8 work,

Multiple firefox profiles in protractor

倾然丶 夕夏残阳落幕 提交于 2019-12-23 03:07:26
问题 Following Configuring multiple capabilities with promises topic. Use case: I have two separate tests that require Firefox to be fired with javascript disabled and local storage disabled . Which means that I need two firefox profiles with javascript.enabled = false and dom.storage.enabled = false desired capabilities/preferences set. I'm using getMultiCapabilities() that was introduced in protractor 1.6. Till this moment, I needed only one custom firefox profile and it worked, here is the

Protractor addMockModule additional arguments not working?

自作多情 提交于 2019-12-22 18:32:50
问题 This seems so, so easy, but I can't figure out why this simple code doesn't work. I am adding a mock module to mock my API backend in my Angular E2E tests. I'm using Protractor 1.6.0. I need to pass additional arguments to the mocked module, which, according to the Protractor docs, is possible by just sending them as additional arguments. However, my function claims it has no arguments... var mock = function() { // This is undefined and arguments.length is 0....why??? var env = arguments[0];

Test all links for validity on a page using Protractor

大城市里の小女人 提交于 2019-12-22 15:49:39
问题 What I am trying to achieve in Protractor is getting all the links on a page and go to them one by one to check if there is a link that routes to a 404 page. The following piece of code comes from my email page object, please note that I am calling replace on the href because the links on the pages that I will test are the following format: https://app.perflectie.nl/something and I want to end-to-end test on https://staging.perflectie.nl and on my localhost. // Used to check for 'broken'

How to wait for element.all().each() to resolve before proceeding

徘徊边缘 提交于 2019-12-22 13:03:01
问题 I'm trying to iterate through a list of elements to find if any one of them has a particular value as it's getText() value. My problem is that my test is not executing in the order I've laid it out. I've read a bunch about queuing and Promise resolution, but I don't understand how it affects my current scenario. Here is what I'm doing: it('should find apps by name', function() { var exists = false; element.all(by.repeater(‘item in list’).each(function(elem) { elem.getText().then(function(text

Running multiple browser instances in the same test spec

﹥>﹥吖頭↗ 提交于 2019-12-22 11:34:12
问题 If I have a single spec that is using page object model, how do I run multiple browser instance for that same spec? For example I have spec: it('should run multi browser', function() { browser.get('http://example.com/searchPage'); var b2 = browser.forkNewDriverInstance(); b2.get('http://example.com/searchPage'); var b3 = browser.forkNewDriverInstance(); b3.get('http://example.com/searchPage'); SearchPage.searchButton.click(); b2.SearchPage.searchButton.click(); //fails here b3.SearchPage

Protractor - compare numbers

混江龙づ霸主 提交于 2019-12-22 06:50:01
问题 In my program I'm calculating two numbers, and I want to make sure that subtraction of them equals 1. this is the code: var firstCount=element.all(by.repeater('app in userApps')).count(); var secondCount=element.all(by.repeater('app in userApps')).count(); so far it's good- I'm getting the numbers. the problem comes next: var sub=secondCount-firstCount; expect(sub).toEqual(1); I'm getting this error: Expected NaN to equal 1. any idea? 回答1: Both firstCount and secondCount are promises that are

Protractor: Click on SVG element not work

孤者浪人 提交于 2019-12-21 23:18:13
问题 I am testing an angularjs App using protractor. I need to test the click on an SVG element. Protractor can find the element, it can run the click on the element, but after the click nothing happens. It should change page after the click. The code is el=element(by.xpath('(//*[local-name()="g" ]//*[local-name() = "rect"])[1]')) browser.actions().mouseMove(el.getWebElement()).click().perform(); 回答1: I agree with what @alecxe suggested in his comment. You should be calling click() on the element

onCleanUp() vs onComplete() vs afterLaunch()

僤鯓⒐⒋嵵緔 提交于 2019-12-21 20:29:18
问题 In Protractor, there is a "global set up" method called onPrepare() , but I'm not completely sure what is meant to be a "global tear down" - there are three relevant methods: onCleanUp , onComplete and afterLaunch that are all called after a test execution. Why does protractor have three methods called after a test run? What is the difference between onCleanUp , onComplete and afterLaunch ? I've also noticed that there is an "exit" event that we can attach a callback to (example here):

How to find and click a table element by text using Protractor?

江枫思渺然 提交于 2019-12-21 20:01:51
问题 <tr id="item" ng-repeat="item in itemList> <td id="code" ng-repeat="column in columns">Some Text</td> </tr> I've seen some other similar questions but I couldn't solve it yet. Thats what I've tried so far: element.all(by.repeater('column in columns')).findElement(by.id('code')).getText('Some Text').click(); EDIT: <tr ng-repeat="item in items> <td>{{item.name}}</td> <td>{{item.description}}</td> </tr> Which results in: <tr> <td>Some Name</td> <td>Some Text</td> </tr> <tr> <td>More Name</td>