protractor

Selecting second anchor element within lists using protractor

时光毁灭记忆、已成空白 提交于 2019-12-22 08:29:50
问题 I have a list of anchor tags and have to test clicking the 2nd tag in the list. <ul id="shortcuts"> <li><a ui-sref="app.journeyExplorer" href="#/journey-explorer/"><span class="ng-binding">1</span></a></li> <li><a ui-sref="app.userGroupManager" href="#/user-group-manager"><span class="ng-binding">2</span></a></li> </ul> After much investigation and testing reached at the conclusion that the correct statement should be: element(By.id('shortcuts')).element(By.tagName('a')).get(1).click(); But

Writing a log file for Protractor/Jasmine tests without using command line

这一生的挚爱 提交于 2019-12-22 08:14:24
问题 I'm aware that if you were to do something like protractor config.js > file.log all the console output would be written to file.log. Is there a way to do this/access that output from within the tests though so that I can use a dynamic path that's created with my reporting tool? And also in a way that I don't lose the console output. Edits: To elaborate a little further, I'm not only interested in console.log output. I'm interested in everything that comes from what seems to be protractors

Click on a button in a Modal Window - Protractor

戏子无情 提交于 2019-12-22 07:57:23
问题 I'm writing protractor tests for an existing app. I have a button called 'Decline' in a modal window, and I'm trying to click it using: element(by.buttonText('Decline')).click(); But I receive the below error: UnknownError: unknown error: Element is not clickable at point (,). Other element would receive the click: May be because I have another button called 'Decline' outside the modal window? How do I click on the modal window's Decline button ? Found that this is the js code that displays

What is the difference between browser.sleep() and browser.wait() methods?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 07:44:32
问题 Facing timing issue with protractor. sometimes my protractor test cases fails due to network or performance issues. I have solved existing issues with browser.sleep(). Later I came to know about browser.wait(). What is the difference between them and which one is better for solving network or performance issues. 回答1: When it comes to dealing with timing issue, it is tempting and easy to put a "quick" browser.sleep() and move on. The problem is, it would some day fail. There is no golden

Protractor test is not starting on Firefox

六月ゝ 毕业季﹏ 提交于 2019-12-22 07:01:28
问题 I have got a set of test that run fine on chrome but when I change the capabilities browserName from chrome to firefox don't even get a error info //Before capabilities: { 'browserName': 'chrome', 'chromeOptions': { args: ['--test-type', 'show-fps-counter=true'] } }, //After capabilities: { 'browserName': 'firefox' }, 回答1: I found the problem with firefox, basically my protractor config was not using any webdriver server setting but was using the default server, this way was quite handy since

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

Handling Unknown Errors in protractor

痴心易碎 提交于 2019-12-22 06:39:30
问题 I have a protractor setup with multiple browsers configured through multiCapabilities , running tests on browserstack. One of my key protractor specs/tests contain the following afterEach() block: afterEach(function() { browser.manage().logs().get("browser").then(function (browserLog) { expect(browserLog.length).toEqual(0); }); }); that checks that the browser console is empty (no errors on the console). The problem is : when I run this spec against Internet Explorer, I'm getting an

Internet Explorer Selenium protractor e2e tests

≯℡__Kan透↙ 提交于 2019-12-22 05:54:22
问题 I would like to add to our CI build process some e2e tests. I have already added them against chrome + firefox (as the simplest ones). But I really want to do it for several IE versions. How is it possible to inject it in build process on linux/mac? I found such article: http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/ But looks like it is not 100% what I need. Could some one provide a simple configuration sample? 回答1: You would need a selenium server, either your own

Protractor e2e test table header and <tr>,<td> tags

谁说胖子不能爱 提交于 2019-12-22 05:53:40
问题 I am using below table. In that I want to test each tag(th, td tags), Text in that tags and count of that text. HTML snippet <table class="table table-striped"> <tbody> <tr> <th><b><a ng-href="" ng-click="predicate='id';reverse=!reverse">Patient Id</a></b></th> <th><b><a ng-href="" ng-click="predicate='accountNumber';reverse=!reverse" class="">Account Number</a></b></th> <th><b><a ng-href="" ng-click="predicate='title';reverse=!reverse">Title</a></b></th> <th><b><a ng-href="" ng-click=

Implement async/await in sort function of arrays javascript

喜夏-厌秋 提交于 2019-12-22 05:41:11
问题 I am trying to implement a sort method on protractor ElementArrayFinder . As known, all protractor methods return promises. So my sort method has a condition which depends on promises resolution. I am using a node plugin for async/await in order to make it compatible with node.js versions lower than 6. (Here the plugin: https://www.npmjs.com/package/asyncawait) Here my code, where this is the ArrayElementFinder : var asyncCompare = async(function(a, b) { let x = await (a.getText()); let y =