How to use Puppeteer in an Angular application

How to use Angular e2e testing with Puppeteer 1) Install Puppeteer npm install –save-dev puppeteer @types/puppeteer 2) Configure Protractor to use Puppeteer Edit your protractor.conf.js and add the following inside capabilities: // … const puppeteer = require(‘puppeteer’); exports.config = { // … capabilities: { browserName: ‘chrome’, chromeOptions: { args: [‘–headless’], binary: puppeteer.executablePath(), }, }, // … Read more

Accessing Angular inside Protractor Test

There is a function called evaluate(). Find an element in the dom and then run the expression. For example. If you want to count the number of todos in the http://angularjs.org/ website (under Add Some Control), do this: Open the element explorer in protractor ./node_modules/protractor/bin/elementexplorer.js browser.get(‘http://angularjs.org/’) element(by.model(‘todoText’)).evaluate(‘todos.length’). then(function(count) { console.log(count) }); It should give you … Read more

Protractor “by.css()” vs “$()” Dollar Sign vs “$$()” ‘Bling Bling’

$ and $$ are just convenient shortcuts. $(“selector”) is an alternative for element(by.css(“selector”)). $$(“selector”) is an alternative for element.all(by.css(“selector”)). FYI, quote from the source code: ElementFinder.prototype.$ = function(selector) { return this.element(webdriver.By.css(selector)); }; ElementArrayFinder.prototype.$$ = function(selector) { return this.all(webdriver.By.css(selector)); }; And the actual commit that initially made it happen.

How to run a single specific test case when using protractor

Jasmine added fit and fdescribe in 2.1 for running single tests or describe blocks. http://pivotallabs.com/new-key-features-jasmine-2-1/ This feature almost made it in the 2.0 release. Now enough of this functionality is present to support fit and fdescribe for focused spec and suite running. from 2.1 git lib/jasmine-core/jasmine.js var jasmineInterface = { describe: function(description, specDefinitions) { return … Read more

Can I access parameters in my protractor configuration file?

I am not completely sure if protractor globals are set at the beforeLaunch() stage, but they are definitely available at onPrepare() step. Access the params object through the global browser object: console.log(browser.params.baseUrl); Update: Using Jasmine 2.6+, protractor 4.x, browser.params was empty, but the following worked in onPrepare() step: console.log(browser.baseUrl);

“Runtime.executionContextCreated has invalid ‘context” error when i run Protractor

2016-10-13: ChromeDriver v2.24 has been released which supports Chrome v52-54. (Thanks @Anton) 2016-08-16: One of the recent updates to the Chrome Dev channel introduced a bug preventing ChromeDriver from properly starting. Having just worked around the same problem, I would suggest backing up your data and reverting to the Beta or Stable release channel of … Read more

tech