mantoni / mochify.js

☕️ TDD with Browserify, Mocha, Headless Chrome and WebDriver
MIT License
346 stars 57 forks source link

Cannot set viewport #166

Closed VinhVu0412 closed 6 years ago

VinhVu0412 commented 6 years ago

I run mochify with a command likes this mochify --viewport-height 2000 --viewport-width 2000 and it comes with an error message (node:65342) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Protocol error (Emulation.setDeviceMetricsOverride): Invalid parameters width: integer value expected; height: integer value expected

It was ok when I used mochify 3.3.0. The error came when I upgraded to 5.2.0

I am using

m90 commented 6 years ago

It looks like these values: https://github.com/mantoni/mochify.js/blob/ed471aceb81d66a21aa53819bcab656c84f0ad0c/lib/chromium.js#L84-L85 are actually strings when they should be ints. The tests only check for equal (i.e. 999 == '999'), so I would assume the args parser does not really do what we want it to.

I can look into fixing this if @mantoni does not mind.

mantoni commented 6 years ago

@m90 Sure, go ahead! I assume that phantomjs used to work fine with strings and headless chrome doesn't.

m90 commented 6 years ago

@VinhVu0412 This is fixed as of 5.3.1 which is now published to npm.