Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
browser.screenshotsCount = 0;
browser.addCommand('capture', function (name) {
name = name.replace(/[ \\~#%&*{}/:<>?|"-]/g, '_');
var location = browser.screenshotsCount++ + '_' + name + '.png';
fs.mkdirsSync(process.env['chimp.screenshotsPath']);
var ssPath = path.join(process.env['chimp.screenshotsPath'], location);
log.debug('[chimp][helper] saving screenshot to', ssPath);
this.saveScreenshot(ssPath, false);
log.debug('[chimp][helper] saved screenshot to', ssPath);
});
if (process.env['chimp.browser'] === 'phantomjs') {
browser.setViewportSizeSync({
width: process.env['chimp.phantom_w'] ? parseInt(process.env['chimp.phantom_w']) : 1280,
height: process.env['chimp.phantom_h'] ? parseInt(process.env['chimp.phantom_h']) : 1024
});
}
};
browser.screenshotsCount = 0;
browser.addCommand('capture', function (name) {
name = name.replace(/[ \\~#%&*{}/:<>?|"-]/g, '_');
var location = (browser.screenshotsCount++) + '_' + name + '.png';
fs.mkdirsSync(process.env['chimp.screenshotsPath']);
var ssPath = path.join(process.env['chimp.screenshotsPath'], location);
log.debug('[chimp][helper] saving screenshot to', ssPath);
this.saveScreenshot(ssPath, false);
log.debug('[chimp][helper] saved screenshot to', ssPath);
});
if (process.env['chimp.browser'] === 'phantomjs') {
browser.setViewportSizeSync({
width: process.env['chimp.phantom_w'] ? parseInt(process.env['chimp.phantom_w']):1280,
height: process.env['chimp.phantom_h'] ? parseInt(process.env['chimp.phantom_h']):1024
});
}
};