Skip to content

Instantly share code, notes, and snippets.

@gusmiguens
Last active November 10, 2020 22:28
Show Gist options
  • Save gusmiguens/5a177d8b62a536a53e3b57b74a6561fe to your computer and use it in GitHub Desktop.
Save gusmiguens/5a177d8b62a536a53e3b57b74a6561fe to your computer and use it in GitHub Desktop.
cy-start
//El link del script completo está debajo en el artículo
//The link to the complete script file is down below the article
program.parse(process.argv);
const device = config[program.device] ? program.device : 'default';
const osType = device.indexOf('iphone') > -1 ? 'iOS' : device === 'default' ? 'default' : 'android';
const osVersion = OSconfig[osType][program.osVersion] ? program.osVersion : 'default';
const userAgent = OSconfig[osType][osVersion];
const cypressOptions = {
env: {
device,
osType,
osVersion
},
config: {
...config[device],
userAgent,
integrationFolder: '__tests__/ui/__specs__/functional'
},
browser: 'chrome',
headless: true
};
function runCypress() {
const run = program.open ? cypress.open(cypressOptions)
: program.record ? cypress.run({
record: true,
key: process.env.CYPRESS_KEY,
...cypressOptions,
})
: cypress.run(cypressOptions);
return run;
}
runCypress()
.then(results => {
if (results.totalFailed > 0 || results.failures > 0) {
process.exit(1);
}
})
.catch(err => {
console.error(err.stack || err);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment