Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can protractor be made to run slowly?

Is there a way to run a Angular E2E test written using protractor slowly so that I can watch what is happening?

like image 433
cortfr Avatar asked Jul 25 '14 16:07

cortfr


People also ask

Is Protractor going to end?

TLDR. The Angular team plans to end development of Protractor at the end of 2022 (in conjunction with Angular v15). Why? Protractor was created in 2013 when WebDriver APIs were not yet a standard and end-to-end (e2e) tests were hard to write due to lack of support for async / await .

How do you speed up a Protractor test?

To do this is quite simple in protractor. Adding the shardTestFiles and maxInstences to your capabilities config should allow you to (in this case) run at most two test in parrallel. Increase the maxInstences to increase the number of tests run. Note : be careful not to set the number too high.

Is Protractor getting deprecated?

Since Protractor is being deprecated, existing Protractor users need to migrate their tests to other frameworks.

What is the alternative for Protractor?

Selenium, PhantomJS, WebdriverIO, Jasmine, and Compass are the most popular alternatives and competitors to Protractor.


1 Answers

Below is my solution to do that. So basically I created a decorator for current control flow execute function, which now additionaly queues a delay of 100ms before each queued action.

This needs to be run before any tests are invoked (outside describe block)

var origFn = browser.driver.controlFlow().execute;  browser.driver.controlFlow().execute = function() {   var args = arguments;    // queue 100ms wait   origFn.call(browser.driver.controlFlow(), function() {     return protractor.promise.delayed(100);   });    return origFn.apply(browser.driver.controlFlow(), args); }; 
like image 185
Filip Sobczak Avatar answered Oct 13 '22 05:10

Filip Sobczak