end-to-end

Couldn't run protractor scripts on Android emulator

≯℡__Kan透↙ 提交于 2019-12-06 13:07:51
问题 I want to execute protractor script on android emulator using Appium, but the problem emulator isn't launched when i tap: " protractor conf.js " on terminal. The test is passed in chrome browser of windows instead of browser in the emulator. Shall i add other capabilities ? or i should change the base url ? // An example configuration file. exports.config = { seleniumAddress: 'http://localhost:4733/wd/hub', specs: ['todo-spec.js'], directConnect: true, // Capabilities to be passed to the

Running multiple browser instances in the same test spec

◇◆丶佛笑我妖孽 提交于 2019-12-06 10:06:26
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.searchButton.click(); }); How do I reuse vars declared in the SearchPage page object for the other browser

How to click on option in select box in Protractor test?

扶醉桌前 提交于 2019-12-06 08:33:34
问题 I am using Protractor for end to end testing in Angular application. I am trying to click on option in select box, but i have folowing error Element is not currently visible and may not be manipulated. I have this part of html: <select class="form-control" ng-required="true" ng-model="selectedAction.begStatus" ng-options="obj as obj.name for obj in allBegStatuses"> </select> And I have this line of code in Protractor test: element(by.xpath('//select/option[text()="Draft"]')).click(); I want

Test all links for validity on a page using Protractor

牧云@^-^@ 提交于 2019-12-06 05:29:10
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' links - links that lead to a 404 page Email.prototype.verifyLinkQuality = function() { browser.driver

Protractor addMockModule additional arguments not working?

烂漫一生 提交于 2019-12-06 04:38:14
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]; var mocks = angular.module('mocks.login', ['MyApp', 'ngMockE2E']); mocks.run(function($httpBackend) {

How to select element in Protractor by html attribute when value contains

泪湿孤枕 提交于 2019-12-06 04:34:08
问题 Struggling with how to select an element that doesn't have a standard unique id or class. How would I select this input element with Protractor? Note: I cannot use the class ComboBoxInput_Default class, as this drop down box is used on several other page elements. There also isn't any easily identifiable parent element for at least 10+ DOM levels. <div style="display:inline; white-space: nowrap;" id="ctl00_ctl31_g_b56afa08_7869_450c_8871_f6759a89d9b1_ctl00_WPQ3txtFields_ddPositioList_10

How to simulate ctrl-click or shift-click with webdriver.io?

混江龙づ霸主 提交于 2019-12-05 10:29:20
With webdriver.io I would like to simulate clicks with a modifier like shift or ctrl . The keys() method seems to do something like that but it's not clear to me how to release a modifier key again and it throws an error when I use 16 (key code for shift ) as a parameter for the method - link . Background: In my webpage that I test I have a list of elements that are comparable to files and folders in a file browser and it is possible to select multiple of those with shift and ctrl . This works well and now I would like to test it with webdriver.io. To do this, webdriver.io e.g. has to click on

Protractor - compare numbers

孤街醉人 提交于 2019-12-05 09:51:24
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? Both firstCount and secondCount are promises that are needed to be resolved : element.all(by.repeater('app in userApps')).count().then(function (first) { element

protractor: onPrepare for different test suites

纵然是瞬间 提交于 2019-12-05 07:41:16
I have onPrepare in my conf.js file where I log in to the application. My understanding is every time I run 1 or more test suites, it first executes whatever is in onPrepare. This is great, as I use onPrepare to log into the application before running the tests. Issue is, I don't want to login when I run my login-spec.js suite. I could first logout before running through login-spec.js, but there must be a more elegant way to do this. As far as I understand, you need a place for suite-specific preparations. This is what jasmine can help you with. For jasmine 2.1 and above, there are built-in

Protractor return an object but expected - value of element.getText()

不想你离开。 提交于 2019-12-05 05:11:15
Unable to understand why it return an object not a value of text, some test code: describe('columns swap', function () { describe('location column ', function () { it('should swap right', function () { browser.sleep(10000); var fColumn = element(by.xpath('(//*[@class="k-link"])[2]')).getText(); console.log(fColumn); Console output: > columns swap > location column { ptor_: { controlFlow: [Function], > schedule: [Function], > getSession: [Function], > getCapabilities: [Function], > quit: [Function], > actions: [Function], > executeScript: [Function], > executeAsyncScript: [Function], > call: