@@ -5,26 +5,82 @@ import { INsCapabilitiesArgs } from "./interfaces/ns-capabilities-args";
5
5
6
6
const config = ( ( ) => {
7
7
const options = yargs
8
- . option ( "runType" , { describe : "Path to excute command." , type : "string" , default : null } )
9
- . option ( "testFolder" , { describe : "e2e test folder name" , default : "e2e" , type : "string" } )
10
- . option ( "appiumCapsLocation" , { describe : "Capabilities" , type : "string" } )
11
- . option ( "sauceLab" , { describe : "SauceLab" , default : false , type : "boolean" } )
12
- . option ( "port" , { alias : "p" , describe : "Appium port" , type : "number" } )
13
- . option ( "attachToDebug" , { alias : "a" , describe : "Attach to appium desktop app." , default : false , type : "boolean" } )
14
- . option ( "capabilitiesName" , { describe : "Capabilities file name" , default : "appium.capabilities.json" , type : "string" } )
15
- . option ( "sessionId" , { alias : "s" , describe : "Session to attach" , default : false , type : "string" } )
16
- . option ( "startSession" , { describe : "Start session." , default : false , type : "boolean" } )
8
+ . option ( "runType" ,
9
+ {
10
+ describe : "Which option to use from appium capabilities.json" ,
11
+ type : "string"
12
+ } )
13
+ . option ( "testFolder" ,
14
+ {
15
+ describe : "e2e test folder name" ,
16
+ default : "e2e" ,
17
+ type : "string"
18
+ } )
19
+ . option ( "appiumCapsLocation" ,
20
+ {
21
+ describe : "Custom capabilities location" ,
22
+ type : "string"
23
+ } )
24
+ . option ( "sauceLab" ,
25
+ {
26
+ describe : "Use it mandatory for sauceLab run!" ,
27
+ default : false ,
28
+ type : "boolean"
29
+ } )
30
+ . option ( "port" ,
31
+ {
32
+ alias : "p" ,
33
+ describe : "Appium port" ,
34
+ type : "number"
35
+ } )
36
+ . option ( "attachToDebug" ,
37
+ {
38
+ alias : "a" ,
39
+ describe : "Attach to appium desktop application. Will use first met session!" ,
40
+ default : false ,
41
+ type : "boolean"
42
+ } )
43
+ . option ( "capabilitiesName" ,
44
+ {
45
+ describe : "Capabilities file name" ,
46
+ default : "appium.capabilities.json" ,
47
+ type : "string"
48
+ } )
49
+ . option ( "startSession" ,
50
+ {
51
+ describe : "Start session. This option will start a new session can be reused for tests!" ,
52
+ default : false ,
53
+ type : "boolean"
54
+ } )
55
+ . option ( "sessionId" , {
56
+ alias : "s" ,
57
+ describe : "Provide session id which you want to attach" ,
58
+ default : false ,
59
+ type : "string"
60
+ } )
17
61
. option ( "wdaLocalPort" , { alias : "wda" , describe : "WDA port" , type : "number" } )
18
62
. option ( "verbose" , { alias : "v" , describe : "Log actions" , type : "boolean" } )
19
- . option ( "path" , { describe : "path" , default : process . cwd ( ) , type : "string" } )
63
+ . option ( "path" , { describe : "Execution path" , default : process . cwd ( ) , type : "string" } )
20
64
. option ( "relaxedSecurity" , { describe : "appium relaxedSecurity" , default : false , type : "boolean" } )
21
65
. option ( "appPath" , { describe : "application path" , type : "string" } )
22
66
. option ( "storage" , { describe : "Storage for images folder." , type : "string" } )
23
67
. option ( "testReports" , { describe : "Test reporting folder" , type : "string" } )
24
- . option ( "reuseDevice" , { describe : "Reusing device if available." , type : "boolean" , default : false } )
25
- . option ( "devMode" , { alias : "dev-mode" , describe : "Will skipp app instalation and will reuse the one installed on device!" , type : "boolean" , default : false } )
26
- . option ( "ignoreDeviceController" , { alias : "i-ns-device-controller" , describe : "Use default appium options for running emulatos/ simulators." , type : "boolean" , default : false } )
27
- . option ( "cleanApp" , { alias : "c" , describe : "Uninstall app after test are finished" , type : "boolean" , default : false } )
68
+ . option ( "devMode" ,
69
+ {
70
+ alias : "dev-mode" ,
71
+ describe : "Skips app installation and uses the one that should already be installed on device! Good to use during development." ,
72
+ type : "boolean" ,
73
+ default : false
74
+ } )
75
+ . option ( "ignoreDeviceController" ,
76
+ {
77
+ alias : "idc" ,
78
+ describe : `Use default appium options for running emulators/ simulators. Provide this option will not use custom device controller.
79
+ Device controller is disabled by default when --sauceLab option is provided!` ,
80
+ type : "boolean" ,
81
+ default : false
82
+ } )
83
+ . option ( "cleanApp" , { alias : "c" , describe : "Clean app before and after run." , type : "boolean" , default : false } )
28
84
. option ( "imagesPath" , { describe : "comparison images path relative to resources/images" , type : "string" } )
29
85
. help ( )
30
86
. argv ;
@@ -55,8 +111,7 @@ const config = (() => {
55
111
options . attachToDebug = true ;
56
112
options . devMode = true ;
57
113
if ( ! options . port ) {
58
- logError ( "Provide appium server port started from desktop application!" )
59
- process . exit ( 1 ) ;
114
+ logError ( `Provide appium server port that has been used to start session or the default '${ port } ' one will be used` ) ;
60
115
}
61
116
}
62
117
@@ -70,7 +125,7 @@ const config = (() => {
70
125
projectBinary : projectBinary ,
71
126
pluginRoot : pluginRoot ,
72
127
pluginBinary : pluginBinary ,
73
- port : options . port || process . env . npm_config_port || process . env [ "APPIUM_PORT" ] || 4723 ,
128
+ port : options . port || process . env . npm_config_port || process . env [ "APPIUM_PORT" ] || 4723 ,
74
129
wdaLocalPort : options . wdaLocalPort || process . env . npm_config_wdaLocalPort || process . env [ "WDA_LOCAL_PORT" ] || 8410 ,
75
130
testFolder : options . testFolder || process . env . npm_config_testFolder || "e2e" ,
76
131
runType : options . runType || process . env . npm_config_runType ,
@@ -80,8 +135,7 @@ const config = (() => {
80
135
appPath : options . appPath || process . env . npm_config_appPath ,
81
136
storage : options . storage || process . env . npm_config_STORAGE || process . env . STORAGE ,
82
137
testReports : options . testReports || process . env . npm_config_testReports || process . env . TEST_REPORTS ,
83
- devMode : options . devMode || process . env . npm_config_devMode || process . env . REUSE_APP ,
84
- reuseDevice : options . devMode ? true : options . reuseDevice || process . env . npm_config_reuseDevice || process . env . REUSE_DEVICE ,
138
+ devMode : options . devMode || process . env . npm_config_devMode || process . env . REUSE_APP ,
85
139
cleanApp : ! options . devMode && options . cleanApp && ! options . sauceLab && ! options . ignoreDeviceController ,
86
140
ignoreDeviceController : options . ignoreDeviceController || process . env . npm_ignoreDeviceController ,
87
141
path : options . path || process . env . npm_path ,
@@ -110,7 +164,6 @@ export const {
110
164
appPath,
111
165
storage,
112
166
testReports,
113
- reuseDevice,
114
167
devMode,
115
168
ignoreDeviceController,
116
169
wdaLocalPort,
0 commit comments