How can I configure Chimp to open a browser with given width and height?

661 Views Asked by At

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

There are 1 best solutions below

1
Xolv.io On BEST ANSWER

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