how to use Protractor on non angularjs website?

Another approach is to set browser.ignoreSynchronization = true before browser.get(…). Protractor wouldn’t wait for Angular loaded and you could use usual element(…) syntax. browser.ignoreSynchronization = true; browser.get(‘http://localhost:8000/login.html’); element(by.id(‘username’)).sendKeys(‘Jane’); element(by.id(‘password’)).sendKeys(‘1234’); element(by.id(‘clickme’)).click();

Select -> option abstraction

No such thing in Protractor, but we can write our own: select-wrapper.js ‘use strict’; var SelectWrapper = function(selector) { this.webElement = element(selector); }; SelectWrapper.prototype.getOptions = function() { return this.webElement.all(by.tagName(‘option’)); }; SelectWrapper.prototype.getSelectedOptions = function() { return this.webElement.all(by.css(‘option[selected=”selected”]’)); }; SelectWrapper.prototype.selectByValue = function(value) { return this.webElement.all(by.css(‘option[value=”‘ + value + ‘”]’)).click(); }; SelectWrapper.prototype.selectByPartialText = function(text) { return this.webElement.all(by.cssContainingText(‘option’, text)).click(); … Read more

Protractor e2e test case for downloading pdf file

I can currently set download path location Chrome capabilities: { ‘browserName’: ‘chrome’, ‘platform’: ‘ANY’, ‘version’: ‘ANY’, ‘chromeOptions’: { // Get rid of –ignore-certificate yellow warning args: [‘–no-sandbox’, ‘–test-type=browser’], // Set download path and avoid prompting for download even though // this is already the default on Chrome but for completeness prefs: { ‘download’: { ‘prompt_for_download’: … Read more

How to disable animations in protractor for angular js application

You can check out the angular’s protractor configuration: https://github.com/angular/angular.js/blob/master/protractor-shared-conf.js You should add it under onPrepare block: onPrepare: function() { /* global angular: false, browser: false, jasmine: false */ // Disable animations so e2e tests run more quickly var disableNgAnimate = function() { angular.module(‘disableNgAnimate’, []).run([‘$animate’, function($animate) { $animate.enabled(false); }]); }; browser.addMockModule(‘disableNgAnimate’, disableNgAnimate);

Using protractor with loops

The reason this is happening is because protractor uses promises. Read https://github.com/angular/protractor/blob/master/docs/control-flow.md Promises (i.e. element(by…), element.all(by…)) execute their then functions when the underlying value becomes ready. What this means is that all the promises are first scheduled and then the then functions are run as the results become ready. When you run something like this: … Read more

How to upload file in angularjs e2e protractor testing

This is how I do it: var path = require(‘path’); it(‘should upload a file’, function() { var fileToUpload = ‘../some/path/foo.txt’, absolutePath = path.resolve(__dirname, fileToUpload); element(by.css(‘input[type=”file”]’)).sendKeys(absolutePath); element(by.id(‘uploadButton’)).click(); }); Use the path module to resolve the full path of the file that you want to upload. Set the path to the input type=”file” element. Click on the … Read more

WebDriver click() vs JavaScript click()

Contrarily to what the currently accepted answer suggests, there’s nothing specific to PhantomJS when it comes to the difference between having WebDriver do a click and doing it in JavaScript. The Difference The essential difference between the two methods is common to all browsers and can be explained pretty simply: WebDriver: When WebDriver does the … Read more

Is it feasible for a start-up of two developers to do full automated regression testing without manual testing? [closed]

The answer to this question is highly opinionated, but I’ll give it a shot anyway. From what you have described, seems you are “holding it wrong” in many ways. Your sprints are too long. You should be pushing to production once a day and should not be doing 2 hour of “regression testing” before every … Read more