end-to-end

Is it possible to add a plugin to chromedriver under a protractor test?

别来无恙 提交于 2019-11-28 08:49:22
I've been trying to handle the basic authentication during my protractor test. Some hard time on it, so i've found a chrome plugin wich sends automatically my credentials for websites that require basic authentication. As each time that chromedriver is executed, a new profile is loaded, how can i permanelty add a plugin to my tests? I know that there is https://sites.google.com/a/chromium.org/chromedriver/extensions , but i dont think this very clear. You need to configure extensions list inside chromeOptions : capabilities { 'browserName': 'chrome', 'chromeOptions': { 'extensions': ['base64

“More than one element found for locator” warning

风格不统一 提交于 2019-11-28 02:25:12
问题 In one of my tests, I'm locating an element using a CSS selector : element(by.css("ul.nav button")) There is more than one element matching the query, but, since I need only the first one, I'm okay with the selector. The problem is, protractor throws a warning: WARNING - more than one element found for locator By.cssSelector("ul.nav button") - the first result will be used Is it possible to suppress the warning? In other words, how can I let protractor know that I'm aware of the problem and

Controlling poll frequency of browser.wait() (Fluent Wait)

ぐ巨炮叔叔 提交于 2019-11-27 23:40:53
问题 The Story: In Java selenium language bindings there is a FluentWait class, that allows to tightly control how the expected condition would be checked: Each FluentWait instance defines the maximum amount of time to wait for a condition, as well as the frequency with which to check the condition. Furthermore, the user may configure the wait to ignore specific types of exceptions whilst waiting, such as NoSuchElementExceptions when searching for an element on the page. In other words, it's

Asserting an element is focused

百般思念 提交于 2019-11-27 17:59:13
问题 According to the How do I assert an element is focused? thread, you can check if an element is focused by switching to an activeElement() and assert this is the same element you've expected to have the focus: expect(page.element.getAttribute('id')).toEqual(browser.driver.switchTo().activeElement().getAttribute('id')); In my case, the currently focused element does not have an id attribute . What should I do instead of checking an id ? Bonus question: Also, as you can see from my tries to

End To End Testing on Headless Server

亡梦爱人 提交于 2019-11-27 13:18:06
问题 I am trying to set up an environment for end-to-end testing on a droplet running Ubuntu server 12.04.3 on digital ocean. What I am trying to achieve in the end is for my jenkins (installed on the one droplet) to be able to run my end-to-end tests. Now, the server is ofcourse headless and the end-to-end tests need to run through a browser (I am using protractor with the selenium standalone server with chromedriver). My question is: how do I spawn a browser on that machine ? I have installed

Is it possible to add a plugin to chromedriver under a protractor test?

怎甘沉沦 提交于 2019-11-27 05:49:02
问题 I've been trying to handle the basic authentication during my protractor test. Some hard time on it, so i've found a chrome plugin wich sends automatically my credentials for websites that require basic authentication. As each time that chromedriver is executed, a new profile is loaded, how can i permanelty add a plugin to my tests? I know that there is https://sites.google.com/a/chromium.org/chromedriver/extensions, but i dont think this very clear. 回答1: You need to configure extensions list

In protractor, browser.isElementPresent vs element.isPresent vs element.isElementPresent

拜拜、爱过 提交于 2019-11-26 18:53:23
In protractor, there are, basically, 3 ways to check if an element is present: var elm = element(by.id("myid")); browser.isElementPresent(elm); elm.isPresent(); elm.isElementPresent(); Are these options equivalent and interchangeable, and which one should be generally preferred? All function in a similar way with subtle differences. Here are few differences that i found - elm.isPresent() - Is an extension of ElementFinder and so waits for Angular to settle on page before executing any action. It works when elm is an element(locator) or ElementFinder and not ElementArrayFinder . If multiple

Testing AngularJS with Selenium

被刻印的时光 ゝ 提交于 2019-11-26 18:52:17
I have a SPA application on stack ASP MVC + AngularJS and I'd like to test the UI. For now I'm trying Selenium with PhantomJS and WebKit drivers. This is a sample testing page - view with single element. The list items <li> load dynamically from server and are bounded by Angular. <div id="items"> <li>text</li> <li>text2</li> </div> I'm trying to pass a test and there is an error in this line: _driver.FindElements(By.TagName('li')) At this point there are no loaded elements and _driver.PageSource doesn't contain elements. How can I wait for the items to load? Please do not suggest Thread.Sleep(

Using cross-platform keyboard shortcuts in end-to-end testing

有些话、适合烂在心里 提交于 2019-11-26 17:12:47
问题 The Problem: In our rather big test codebase, we are using different keyboard shortcuts. For instance, to copy selected text we are using CTRL/COMMAND + C , to paste CTRL/COMMAND + v , to open a new tab CTRL/COMMAND + T etc. To keep tests work on multiple platforms, we'd like to make the CTRL vs COMMAND choice automatic depending on what platform the target browser is running on . To determine a target platform, we are currently using the following helper function which uses navigator

What is browser.ignoreSynchronization in protractor?

ⅰ亾dé卋堺 提交于 2019-11-26 12:57:21
I have seen it so many times where people suggest to use: browser.ignoreSynchronization=true; // or false But I do not understand why do we need it? The simple answer is that it makes protractor not wait for Angular promises, such as those from $http or $timeout to resolve, which you might want to do if you're testing behaviour during $http or $timeout (e.g., a "loading" message), or testing non-Angular sites or pages, such as a separate login page. For example, to test a button that sets a loading message during a request you can set it to true when fetching an element + checking its contents