@@ -5,26 +5,82 @@ import { INsCapabilitiesArgs } from "./interfaces/ns-capabilities-args";
55
66const config = ( ( ) => {
77 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+ } )
1761 . option ( "wdaLocalPort" , { alias : "wda" , describe : "WDA port" , type : "number" } )
1862 . 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" } )
2064 . option ( "relaxedSecurity" , { describe : "appium relaxedSecurity" , default : false , type : "boolean" } )
2165 . option ( "appPath" , { describe : "application path" , type : "string" } )
2266 . option ( "storage" , { describe : "Storage for images folder." , type : "string" } )
2367 . 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 } )
2884 . option ( "imagesPath" , { describe : "comparison images path relative to resources/images" , type : "string" } )
2985 . help ( )
3086 . argv ;
@@ -55,8 +111,7 @@ const config = (() => {
55111 options . attachToDebug = true ;
56112 options . devMode = true ;
57113 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` ) ;
60115 }
61116 }
62117
@@ -70,7 +125,7 @@ const config = (() => {
70125 projectBinary : projectBinary ,
71126 pluginRoot : pluginRoot ,
72127 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 ,
74129 wdaLocalPort : options . wdaLocalPort || process . env . npm_config_wdaLocalPort || process . env [ "WDA_LOCAL_PORT" ] || 8410 ,
75130 testFolder : options . testFolder || process . env . npm_config_testFolder || "e2e" ,
76131 runType : options . runType || process . env . npm_config_runType ,
@@ -80,8 +135,7 @@ const config = (() => {
80135 appPath : options . appPath || process . env . npm_config_appPath ,
81136 storage : options . storage || process . env . npm_config_STORAGE || process . env . STORAGE ,
82137 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 ,
85139 cleanApp : ! options . devMode && options . cleanApp && ! options . sauceLab && ! options . ignoreDeviceController ,
86140 ignoreDeviceController : options . ignoreDeviceController || process . env . npm_ignoreDeviceController ,
87141 path : options . path || process . env . npm_path ,
@@ -110,7 +164,6 @@ export const {
110164 appPath,
111165 storage,
112166 testReports,
113- reuseDevice,
114167 devMode,
115168 ignoreDeviceController,
116169 wdaLocalPort,
0 commit comments