Open jcneally opened 7 years ago
Awesome! Thanks for working on this.
wdio-screenshot currently supports iOS devices but it doesn't seem like a big jump to also start supporting Android as well. This adds image normalizing support for android devices as well.
Android devices are already supported ;) Android devices with chrome (which is default since 4.4) don't need any further changes in wdio-screenshot. That's why we need to make sure that this PR doesn't break them.
May need some help since the blank screenshots in the repo were a bit confusing
The blank or very yellow screenshots are just some simple screenshots to test the cropping. I used just a single background color to avoid any cropping mistakes due to antialiasing or other possible error sources. I'm not even sure if this could happen and just wanted to eliminate this kind of error...
Thanks for following up! Wasn't sure if I would get a response 😄
Android devices are already supported ;) Android devices with chrome (which is default since 4.4) don't need any further changes in wdio-screenshot. That's why we need to make sure that this PR doesn't break them.
Hmm, what kind of android support exists already? I do testing through Saucelabs Simulator/Emulator, and this didn't work out of the box. The header on android gets stitched onto each screenshot and looks quite a mess. Perhaps this isn't an issue for real devices? But happens on emulator and it's unusable.
Hmm, what kind of android support exists already?
Every android with chrome should work in theory. We tried some Nexus & Samsung devices.
But I think that simulators never have chrome, just the old android browser. Give the real devices from saucelabs a try ;)
Background
wdio-screenshot currently supports iOS devices but it doesn't seem like a big jump to also start supporting Android as well. This adds image normalizing support for android devices as well.
Note: I was only able to test this on Android Simulator for 4.4 and 5.1 through SauceLabs and it was working fine for me. It's possible that other versions may not be supported, but limited is better than nothing :man_shrugging:
Changes
ScreenDimension#getScale
to check for Android as well.ScreenshotStrategyManager
to checkisMobile
instead ofisIOS
fixedHeights.js
file to keep track of mobile devices' known fixed heights. If different versions of Android/iOS have different heights, this can be further granulated.normalizeScreenshot
to check for mobile and take into account the type of device you are using..gitignore
to ignore mac.DS_Store
files