Enable mobile emulation - #292
Conversation
d2de7e2 to
410be86
Compare
cc67c32 to
d2405cd
Compare
d2405cd to
7312657
Compare
We need to expose the mobile setting in the Ferrum API as well. Until that's merged, use a fork of Ferrum that exposes it.
This tests for mobile emulation by: * Checking that text controlled by a CSS media query is / isn't visible. * Checking that touch input is enabled / disabled.
These were (a) trying to use a non-existent session, and (b) trying to set both `mobile: true` and a resolution, which is now disallowed.
cbcfb69 to
b4e8fef
Compare
|
Notes from reviewing the Ferrum side of this (rubycdp/ferrum#527): What "mobile emulation" actually isIt's purely a viewport-level concern, made of two independent CDP calls:
Neither of those needs a specific device size or a mobile User-Agent to work — those are separate, optional pieces (which is exactly what What changed on the Ferrum side (and why)
Rather than patching that bug in What this means for this PR
width, height = @options.window_size
resize(width: width, height: height, mobile: @options.mobile)This will break against the updated Ferrum API ( width, height = @options.window_size
resize(width: width, height: height)
set_viewport(width: width, height: height, mobile: @options.mobile) if @options.mobileEverything else in this PR ( |
🚨 Needs rubycdp/ferrum#527 before merging. 🚨
Currently, when creating a Cuprite driver, it's not possible to specify that it should have mobile emulation enabled.
This PR adds that functionality.
Remember to revert 5117a90 once rubycdp/ferrum#527 is merged.