end-to-end

Should I use browser or ptor = protractor.getInstance()?

两盒软妹~` 提交于 2019-11-30 11:22:21
I watched this video ( https://www.youtube.com/watch?v=idb6hOxlyb8 ) which was uploaded Aug 2013. It claims that we should use ptor.get(url) rather than browser().navigateTo(url) in future. But when I look at docs on the protractor home page (on git hub) and their newest examples are still using browser. I am wondering if any one knows the movement to use var ptor = protractor.getInstance() still happening? Thank you very much in advance! Using ptor is obsolete , you should switch to browser from now on. Regarding the modern way to navigate to a page, use: browser.get(url) If is not an angular

Getting currently selected text

时间秒杀一切 提交于 2019-11-30 11:16:07
I'm try to get the currently selected text in an input using window.getSelection() but I'm always getting an empty string: expect(browser.executeScript("return window.getSelection().toString();")).toEqual("test"); Results into: Expected '' to equal 'test'. The complete reproducible test using angularjs.org as a target site: describe("My test", function () { beforeEach(function () { browser.get("https://angularjs.org/"); }); it("should select text in an input", function () { var query = element(by.css("input.search-query")); query.sendKeys("test"); query.sendKeys(protractor.Key.chord(protractor

Get all element attributes using protractor

喜你入骨 提交于 2019-11-30 07:59:14
问题 According to the documentation, to get a single attribute by name you can use .getAttribute() on a WebElement : var myElement = element(by.id('myId')); expect(myElement.getAttribute('myAttr')).toEqual('myValue'); But how can I get all of the attributes that an element has? There is no information about this use case/functionality in the Protractor API. 回答1: You can expand javascript's Element type and add getAttributes() function: Element.prototype.getAttributes = function() { return

How to mock an AJAX request?

北城以北 提交于 2019-11-30 07:14:58
问题 What is the simplest way to modify scenarios.js to mock an AJAX request during an end-to-end test? <!doctype html> <html lang="en" ng-app="myApp"> <head> <meta charset="utf-8"> <title>My Test AngularJS App</title> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular-resource.min.js"></script> <script language="javascript" type="text/javascript"> angular.module('myApp', ['ngResource

Code coverage for Protractor tests in AngularJS

跟風遠走 提交于 2019-11-30 07:07:07
I am running some e2e tests in my angularJS app with protractor (as recommended in the angularJS documentation). I've googled around and cannot find any information on how to measure coverage for my protractor tests. I think I'm missing something here... is there any way to get a code coverage report for protractor e2e tests? Or is it simply a feature for unit tests? This is achievable using Istanbul . Here is the process, with some example configurations that I've extracted from our project (not tested): Instrument your code using the command istanbul instrument . Make sure that istanbul's

Protractor troubleshooting

删除回忆录丶 提交于 2019-11-30 02:58:57
问题 In protractor 1.5.0, there was a new --troubleshoot flag introduced, which is not properly documented at the moment, but in the changelog it states: Improve error messages and add debug info when the configuration file cannot be parsed a webdriver session cannot be started more than one element is found using element Which use cases does --troubleshoot command-line argument cover? The reason I ask is that this is a bit confusing: Should not it be enabled by default? Because if there are

Testing link style changes

杀马特。学长 韩版系。学妹 提交于 2019-11-29 23:43:21
问题 In one of our tests, we are testing the link ( a element) style changes after a mouse over . By default, the link has a black font without decoration, but on mouse over the font changes to blue and the link text becomes underlined. Here is the relevant test: it("should change font style on mouse over", function () { expect(scope.page.forgotPassword.getCssValue("color")).toEqual("rgba(11, 51, 60, 1)"); expect(scope.page.forgotPassword.getCssValue("text-decoration")).toEqual("none"); browser

Difference between functional test and end-to-end test

天涯浪子 提交于 2019-11-29 18:45:34
问题 What is the difference between functional test and end-to-end test? Techopedia says that end-to-end test is a methodology used to test whether the flow of an application is performing as designed from start to finish. The purpose of carrying out end-to-end tests is to identify system dependencies and to ensure that the right information is passed between various system components and systems. Techopedia also says the following about functional test: Functional testing is a software testing

Should I use browser or ptor = protractor.getInstance()?

本小妞迷上赌 提交于 2019-11-29 17:07:06
问题 I watched this video (https://www.youtube.com/watch?v=idb6hOxlyb8) which was uploaded Aug 2013. It claims that we should use ptor.get(url) rather than browser().navigateTo(url) in future. But when I look at docs on the protractor home page (on git hub) and their newest examples are still using browser. I am wondering if any one knows the movement to use var ptor = protractor.getInstance() still happening? Thank you very much in advance! 回答1: Using ptor is obsolete, you should switch to

Getting currently selected text

試著忘記壹切 提交于 2019-11-29 16:45:12
问题 I'm try to get the currently selected text in an input using window.getSelection() but I'm always getting an empty string: expect(browser.executeScript("return window.getSelection().toString();")).toEqual("test"); Results into: Expected '' to equal 'test'. The complete reproducible test using angularjs.org as a target site: describe("My test", function () { beforeEach(function () { browser.get("https://angularjs.org/"); }); it("should select text in an input", function () { var query =