0

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.

Freewind
  • 193,756
  • 157
  • 432
  • 708

1 Answers1

2

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');
Andres D
  • 8,910
  • 2
  • 26
  • 31
  • it doesn't work in my project. I use the 'phantomjs' to run the tests, but it doesn't get the retina images when I run this code (in first line of the test) – Freewind Aug 18 '14 at 06:05
  • I found it phantomjs's issue. Phantomjs just not support it. – Freewind Aug 24 '14 at 14:16