This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cypress = require('cypress'); | |
const program = require('commander'); | |
const config = require('./__tests__/ui/support/devices'); | |
const OSconfig = require('./__tests__/ui/support/os'); | |
program | |
.version('0.1.0') | |
.option('-d, --device <device>', 'run tests on device: <device>') | |
.option('-osV, --osVersion <osVersion>', 'adds device OS version') | |
.option('-r, --record', 'records the run in the Cypress dashboard') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
iphoneX: { | |
viewportWidth: 375, | |
viewportHeight: 812 | |
}, | |
s10: { | |
viewportWidth: 360, | |
viewportHeight: 760 | |
}, | |
default: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program | |
.version('0.1.0') | |
.option('-d, --device <device>', 'run tests on device: <device>') | |
.option('-osV, --osVersion <osVersion>', 'adds device OS version') | |
.option('-r, --record', 'records the run in the Cypress dashboard') | |
.option('-o, --open', 'opens cypress'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
iOS: { | |
'11.1': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_1 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B93', | |
'11.4.1': 'Mozilla / 5.0(iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/ 605.1.15(KHTML, like Gecko) Mobile/ 15G77', | |
'12.1.4': 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16D57', | |
'12.2': 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1', | |
'12.3': 'Mozilla / 5.0(iPhone; CPU iPhone OS 12_3 like Mac OS X) AppleWebKit/ 605.1.15(KHTML, like Gecko) Mobile/ 15E148', | |
'13.0': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) relesys_web_client/1.3.10.0 (RelesysApp/1.3.43; net.relesysapp.nettoenterprise)', | |
'13.3.1': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Ver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 = { |