-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·103 lines (101 loc) · 2.87 KB
/
cli.js
File metadata and controls
executable file
·103 lines (101 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env node
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const config = require('./commands/config')
const showConfig = require('./commands/showConfig')
const useTest = require('./commands/useTest')
const run = require('./commands/run')
const resetState = require('./commands/resetState')
const copyConfig = require('./commands/copyConfig')
const openChrome = require('./commands/openChrome')
const packageJson = require('./package.json')
yargs(hideBin(process.argv))
.usage('Usage: obbtest COMMAND')
.command(
'config',
'Change the obb certification test configuration',
yargs => {},
async argv => {
await config({})
},
)
.command(
'show-config',
'Show the current obb certification test configuration',
yargs => {},
async argv => {
await showConfig()
},
)
.command(
'use',
'Set current test plan',
yargs => {},
async argv => {
await useTest({})
},
)
.command(
'run',
'Start the obb certification test',
yargs => {
return yargs
.option('testEngineUrl', { alias: 'teu' })
.option('testPlan', { alias: 'tp', type: 'string', array: true })
.option('allTestPlans', { alias: 'all', type: 'boolean', default: false })
.option('steps', { alias: 's', type: 'boolean', default: false })
.option('debug', { alias: 'd', type: 'boolean', default: false })
.option('verbose', { alias: 'v', type: 'boolean', default: false })
.option('bail', { alias: 'b', type: 'boolean', default: false })
.option('open', { alias: 'o', type: 'boolean', default: false })
.option('pauseOnFail', { alias: 'pof', type: 'boolean', default: false })
.option('newPlan', { alias: 'np', type: 'boolean', default: false })
},
async argv => {
await run({
testEngineUrl: argv.testEngineUrl,
testPlan: argv.testPlan,
allTestPlans: argv.allTestPlans,
steps: argv.steps,
debug: argv.debug,
verbose: argv.verbose,
bail: argv.bail,
open: argv.open,
pauseOnFail: argv.pauseOnFail,
newPlan: argv.newPlan,
})
},
)
.command(
'reset-state',
'Reset current state',
yargs => {},
async argv => {
await resetState({})
},
)
.command(
'copy-config [path]',
'Copy current configuration to another location',
yargs =>
yargs.positional('path', {
describe: 'destination path to obbtest.config.json configuration file',
}),
async argv => {
await copyConfig(argv.path)
},
)
.command(
'open:chrome',
'Open Chrome with remote debugging to perform tests',
yargs => {},
async argv => {
await openChrome()
},
)
.version(packageJson.version)
.demandCommand(1, '') // just print help
.recommendCommands()
.help()
.alias('h', 'help')
.parse()