0

Recently I started with Chimp and my test suite is growing. I want to implement a feature that I need to run on a mobile viewport specifically (e.g. to test Hamburger menu). I tag such a scenario with the @mobile tag.

Chimp is by default running in the Chrome webdriver at a resolution of half my desktop screen (931x1013px in my case) but I want it to run in e.g. 640x960 phone resolution).

I know I can configure my Chimp session using a configuration file, but I cannot find the setting that controls the browser resolution for my Chrome instance. I found a phantom_w / phantom_h setting but appears to be unrelated to the Chrome webdriver.

How can I force my Chrome webdriver to run at a specific resolution? Can I configure Chimp to do so, perhaps via the desiredCapabilities - but how?

Note: I'm using Node 6.4, NPM 3.10.5 and Chimp 0.34 and this works fine for all features so far.

1 Answers1

0

There are two ways.

  1. Using setViewPortSize as @grasshopper has mentioned
  2. Using chrome's mobile emulation.

For 2, you need to set the desiredCapabilities You can do that in the chimp config like this: https://github.com/xolvio/chimp/blob/master/src/bin/default.js#L48

Then you need to set the mobile emulation in a similar fashion to how they do it here: https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation

Xolv.io
  • 2,483
  • 1
  • 15
  • 17
  • Many thanks to @Xolv.io and grasshopper also. I believe the setViewPortSize will be working just fine. Offtopic, but reason why I'm answering so late: I abandoned Chimp for now as we had too many difficulties with continuous integration in TeamCity (Windows) and needed the BDD tests to work so we went back to SpecFlow in which we have some ready solutions. However I'll revisit Chimp soon because I am enthousiastic about it but need more research. – Maarten Kuijpers Sep 20 '16 at 15:55