@@ -105,14 +105,15 @@ describe("start Appium server android", async () => {
105105
106106 it ( "Start server" , async ( ) => {
107107 const nsCaps = new NsCapabilities ( {
108+ port : 8799 ,
108109 appPath : androidApp ,
109110 appiumCaps : {
110111 platformName : Platform . ANDROID ,
111112 fullReset : false
112113 } ,
113114 } ) ;
114115 const server : AppiumServer = new AppiumServer ( nsCaps ) ;
115- await server . start ( 8799 ) ;
116+ await server . start ( nsCaps . port ) ;
116117 assert . isTrue ( server . hasStarted ) ;
117118 await server . stop ( ) ;
118119 const startTime = Date . now ( ) ;
@@ -123,15 +124,16 @@ describe("start Appium server android", async () => {
123124 it ( "Start appium driver" , async ( ) => {
124125 const nsCaps = new NsCapabilities ( {
125126 appPath : androidApp ,
127+ port : 9900 ,
126128 appiumCaps : {
127129 platformName : Platform . ANDROID ,
128130 fullReset : true
129131 } ,
130132 } ) ;
131133 const server : AppiumServer = new AppiumServer ( nsCaps ) ;
132- await server . start ( 9900 ) ;
134+ await server . start ( nsCaps . port ) ;
133135 assert . isTrue ( server . hasStarted ) ;
134- const driver = await AppiumDriver . createAppiumDriver ( server . port , nsCaps ) ;
136+ const driver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
135137 const currentWindowName = AndroidController . getCurrentFocusedScreen ( nsCaps . device ) ;
136138 const startTime = Date . now ( ) ;
137139 while ( ! currentWindowName . includes ( "com.tns.NativeScriptActivity" ) && Date . now ( ) - startTime < 5000 ) { }
@@ -155,6 +157,7 @@ describe("start Appium server ios", async () => {
155157 it ( "Start server" , async ( ) => {
156158 const nsCaps = new NsCapabilities ( {
157159 appPath : iosApp ,
160+ port : 8799 ,
158161 appiumCaps : {
159162 platformName : Platform . IOS ,
160163 deviceName : / ^ i P h o n e 6 $ / ,
@@ -163,7 +166,7 @@ describe("start Appium server ios", async () => {
163166 } ,
164167 } ) ;
165168 const server : AppiumServer = new AppiumServer ( nsCaps ) ;
166- await server . start ( 8799 ) ;
169+ await server . start ( nsCaps . port ) ;
167170 assert . isTrue ( server . hasStarted ) ;
168171 await server . stop ( ) ;
169172 const startTime = Date . now ( ) ;
@@ -173,6 +176,7 @@ describe("start Appium server ios", async () => {
173176
174177 it ( "Start appium driver" , async ( ) => {
175178 const nsCaps = new NsCapabilities ( {
179+ port : 8822 ,
176180 appPath : iosApp ,
177181 appiumCaps : {
178182 platformName : Platform . IOS ,
@@ -183,9 +187,9 @@ describe("start Appium server ios", async () => {
183187 verbose : false
184188 } ) ;
185189 const server : AppiumServer = new AppiumServer ( nsCaps ) ;
186- await server . start ( 8822 ) ;
190+ await server . start ( nsCaps . port ) ;
187191 assert . isTrue ( server . hasStarted ) ;
188- const driver = await AppiumDriver . createAppiumDriver ( server . port , nsCaps ) ;
192+ const driver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
189193 await driver . quit ( ) ;
190194 await server . stop ( ) ;
191195 } ) ;
@@ -194,6 +198,7 @@ describe("start Appium server ios", async () => {
194198describe ( "Start device by apiLevel" , async ( ) => {
195199 it ( "test-start-emulator-apiLevel-6.0" , async ( ) => {
196200 const nsCaps = new NsCapabilities ( {
201+ port : 8799 ,
197202 runType : "android23" ,
198203 appPath : androidApp ,
199204 appiumCaps : {
@@ -204,8 +209,8 @@ describe("Start device by apiLevel", async () => {
204209 } ) ;
205210
206211 const server = new AppiumServer ( nsCaps ) ;
207- await server . start ( 8799 ) ;
208- const driver = await AppiumDriver . createAppiumDriver ( server . port , nsCaps ) ;
212+ await server . start ( nsCaps . port ) ;
213+ const driver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
209214 const currentWindowName = AndroidController . getCurrentFocusedScreen ( nsCaps . device ) ;
210215 const startTime = Date . now ( ) ;
211216 while ( ! currentWindowName . includes ( "com.tns.NativeScriptActivity" ) && Date . now ( ) - startTime < 5000 ) { }
@@ -217,6 +222,7 @@ describe("Start device by apiLevel", async () => {
217222 it ( "test-start-simulator-apiLevel-12." , async ( ) => {
218223 const nsCaps = new NsCapabilities ( {
219224 appPath : iosApp ,
225+ port : 8887 ,
220226 appiumCaps : {
221227 platformVersion : / 1 2 .| | 1 1 ./ ,
222228 platformName : Platform . IOS ,
@@ -225,8 +231,8 @@ describe("Start device by apiLevel", async () => {
225231 } ) ;
226232
227233 const server = new AppiumServer ( nsCaps ) ;
228- await server . start ( 8887 ) ;
229- const driver = await AppiumDriver . createAppiumDriver ( server . port , nsCaps ) ;
234+ await server . start ( nsCaps . port ) ;
235+ const driver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
230236
231237 const apps = IOSController . getInstalledApps ( nsCaps . device ) ;
232238
@@ -259,7 +265,7 @@ describe("dev-mode-options", async () => {
259265 appPath : iosApp ,
260266 } ) ;
261267
262- const appiumDriver = await AppiumDriver . createAppiumDriver ( appiumServer . port , nsCaps ) ;
268+ const appiumDriver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
263269 assert . isTrue ( appiumDriver . nsCapabilities . device . platform === Platform . IOS ) ;
264270 assert . isDefined ( appiumDriver . nsCapabilities . appiumCaps . app ) ;
265271 await appiumDriver . quit ( ) ;
@@ -270,7 +276,7 @@ describe("dev-mode-options", async () => {
270276 appPath : androidApp
271277 } ) ;
272278
273- const appiumDriver = await AppiumDriver . createAppiumDriver ( appiumServer . port , nsCaps ) ;
279+ const appiumDriver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
274280 assert . isTrue ( appiumDriver . nsCapabilities . device . platform === Platform . ANDROID ) ;
275281 assert . isDefined ( appiumDriver . nsCapabilities . appiumCaps . app ) ;
276282 await appiumDriver . quit ( ) ;
@@ -281,7 +287,7 @@ describe("dev-mode-options", async () => {
281287 appPath : androidApp
282288 } ) ;
283289
284- const appiumDriver = await AppiumDriver . createAppiumDriver ( appiumServer . port , nsCaps ) ;
290+ const appiumDriver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
285291 assert . isTrue ( appiumDriver . nsCapabilities . device . platform === Platform . ANDROID ) ;
286292 assert . isDefined ( appiumDriver . nsCapabilities . appiumCaps . app ) ;
287293 await appiumDriver . quit ( ) ;
@@ -292,7 +298,7 @@ describe("dev-mode-options", async () => {
292298 appPath : iosApp
293299 } ) ;
294300
295- const appiumDriver = await AppiumDriver . createAppiumDriver ( appiumServer . port , nsCaps ) ;
301+ const appiumDriver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
296302 assert . isTrue ( appiumDriver . nsCapabilities . device . platform === Platform . IOS ) ;
297303 assert . isDefined ( appiumDriver . nsCapabilities . appiumCaps . app ) ;
298304 await appiumDriver . quit ( ) ;
0 commit comments