Hey I currently using selenium webdriver, mocha, Browserstack and a node.js package called "looks-same" for an automated visual regression. I am just trying to do a simple comparison with a reference image I have stored and a snap shot I get from selenium.
The code seems to work fine when I run selenium locally but when I use Browserstack, it works sometimes but most of the time it throws an error.
The Error:
events.js:183
throw er; // Unhandled 'error' event
^
Error: Unexpected end of input
at module.exports.ChunkStream._end (/home/david/Desktop/Camera/node_modules/pngjs/lib/chunkstream.js:100:7)
at module.exports.ChunkStream._process (/home/david/Desktop/Camera/node_modules/pngjs/lib/chunkstream.js:203:12)
at module.exports.<anonymous> (/home/david/Desktop/Camera/node_modules/pngjs/lib/chunkstream.js:32:10)
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at Immediate._tickCallback [as _onImmediate] (internal/process/next_tick.js:181:9)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
These are my browser stack capabilities:
const browserStackCapabilities = {
'browserName' : 'android',
'device' : 'Samsung Galaxy S8',
'realMobile' : 'true',
'os_version' : '7.0',
'browserstack.debug' : 'true'
}
This is the code:
it('Should compare screenshot of homepage', function() {
this.timeout(50000)
return new Promise( async (resolve, reject) => {
await browser.get(serverUri)
await browser.saveScreenshot('homePage.png')
await looksSame('homePageReference.png', 'homePage.png', function(error, {equal}) {
console.log(equal)
console.log(error)
expect(equal).to.equal(true)
});
resolve()
browser.quit()
})
})
I expect it to continuously compare the images and give a result either true or false using Browerstack.
Did I do something wrong with error handling?