Freewind
Freewind

Reputation: 198238

How to use protractor to specify `devicePixelRatio` for e2e testing?

We're using protractor for angularjs application e2e tests. We have a feature which will check the devicePixelRatio of window, then generate different image url in order to provide high-quality image for retina screens.

But how to test it with protractor? I can't find any option can specify it with protractor APIs.

Upvotes: 0

Views: 471

Answers (1)

Andres D
Andres D

Reputation: 8900

Try to fake it by setting the value of window.devicePixelRatio using executeScript or executeAsyncScript.

https://github.com/angular/protractor/blob/master/docs/api.md#api-webdriver-webdriver-prototype-executescript

browser.executeScript('window.devicePixelRatio = 2');

Upvotes: 2

Related Questions