Skip to content

Instantly share code, notes, and snippets.

@asialgearoid
Created March 12, 2018 03:01
Show Gist options
  • Save asialgearoid/0cd158eeb8eab6f05867c40f48e71218 to your computer and use it in GitHub Desktop.
Save asialgearoid/0cd158eeb8eab6f05867c40f48e71218 to your computer and use it in GitHub Desktop.
Testing Cordova Apps with Appium (screenshots.js)
const fs = require('fs');
describe('Screenshots', () => {
it('shows text is visible', () => {
browser.timeouts('implicit', 5000);
// We need to switch to the native context for the screenshot to work
browser.context('NATIVE_APP');
// browser.screenshot returns the screenshot as a base64 string
const textVisibleScreenshot = browser.screenshot();
fs.writeFileSync('screenshot-1.png', textVisibleScreenshot.value, 'base64');
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment