end-to-end

Protractor gives “Unable to start a WebDriver session” error

守給你的承諾、 提交于 2019-11-29 10:57:58
I already have started a server with webdriver-manager start , but I get this error when I try to run protractor: Using the selenium server at http://127.0.0.1:4444/wd/hub [launcher] Running 1 instances of WebDriver ERROR - Unable to start a WebDriver session. C:\...\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113 var template = new Error(this.message); ^ UnknownError: unknown error: cannot find Chrome binary My config file looks like this: exports.config = { specs: [ 'test/*.js' ], capabilities: { 'browserName': 'chrome' }, seleniumAddress: 'http://127.0.0.1

Protractor: Scrolling a table and testing for infinite scroll

吃可爱长大的小学妹 提交于 2019-11-29 08:08:27
How can I get protractor to scroll down on a table? My table does infinite scrolling - it loads 20 records, and when the second-to-last-row is displayed, it fetches the next 20 records. Not all records are in view...some are below yet to be scrolled into, and some are above when the user has scrolled past it. I was thinking the test is it('should fetch next set of records on scroll') { element.all(by.id('users')).map(function (elm) { return elm; }).then(function (users) { expect(users.length).toBe(20); }); // Scroll the table to the bottom to trigger fetching more records element.all(by.id(

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

孤街浪徒 提交于 2019-11-29 06:07:58
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 possible to change the polling interval in which the expected condition check is applied, which is by

Get all element attributes using protractor

好久不见. 提交于 2019-11-29 05:53:32
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 . You can expand javascript's Element type and add getAttributes() function: Element.prototype.getAttributes = function() { return (function (node) { var attrs = {}; for (var i=0;i<node.length;i++) { attrs[node.item(i).name] = node.item(i).value;

“More than one element found for locator” warning

跟風遠走 提交于 2019-11-29 05:26:50
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 don't want the warning to be shown anymore? Using protractor development version (installed directly

What best practices do you use for testing database queries?

大兔子大兔子 提交于 2019-11-29 03:01:14
问题 I'm currently in the process of testing our solution that has the whole "gamut" of layers: UI, Middle, and the omnipresent Database. Before my arrival on my current team, query testing was done by the testers manually crafting queries that would theoretically return a result set that the stored procedure should return based on various relevancy rules, sorting, what have you. This had the side effect of bugs being filed against the tester's query more often than against the actual query in

How to mock an AJAX request?

孤人 提交于 2019-11-29 02:24:34
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']); function PlayerController($scope,$resource){ $scope.player = $resource('player.json').get(); } <

How to stop protractor from running further testcases on failure?

青春壹個敷衍的年華 提交于 2019-11-28 23:04:35
Is there a way of quitting test suite and stop executing further test cases, if a test case fails in protractor? In case of jasmine testing framework, you are not the first asking about it. There are relevant open discussions/issues on exiting after a first failure, --fail-fast option: Bail on first failure --fail-fast option? Please add --fail-fast support Long story short, this is an open issue and some day jasmine would have the functionality built-in. Currently, use a third-party jasmine-bail-fast module. Aside from that, there is a handy realtimeFailure jasmine setting. If you set it to

End To End Testing on Headless Server

让人想犯罪 __ 提交于 2019-11-28 20:54:25
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 xorg and if I do startx on the server, log out and ssh -X to it, I can manually run the end-to-end tests

Using Protractor with PhantomJS

亡梦爱人 提交于 2019-11-28 12:57:01
I need to E2E test my AngularJS Application an Protractor seems like the right way to do it. Setup was fairly straightforward and it works like a charm in Chrome. I need however use headless browser and been researching on how to use Protractor with PhantomJS and I found this: Note: We recommend against using PhantomJS for tests with Protractor. There are many reported issues with PhantomJS crashing and behaving differently from real browsers. Above is from https://github.com/angular/protractor/blob/master/docs/browser-setup.md So my questions are: Is this still the case and Proractor still