@@ -105,14 +105,15 @@ describe("start Appium server android", async () => {
105
105
106
106
it ( "Start server" , async ( ) => {
107
107
const nsCaps = new NsCapabilities ( {
108
+ port : 8799 ,
108
109
appPath : androidApp ,
109
110
appiumCaps : {
110
111
platformName : Platform . ANDROID ,
111
112
fullReset : false
112
113
} ,
113
114
} ) ;
114
115
const server : AppiumServer = new AppiumServer ( nsCaps ) ;
115
- await server . start ( 8799 ) ;
116
+ await server . start ( nsCaps . port ) ;
116
117
assert . isTrue ( server . hasStarted ) ;
117
118
await server . stop ( ) ;
118
119
const startTime = Date . now ( ) ;
@@ -123,15 +124,16 @@ describe("start Appium server android", async () => {
123
124
it ( "Start appium driver" , async ( ) => {
124
125
const nsCaps = new NsCapabilities ( {
125
126
appPath : androidApp ,
127
+ port : 9900 ,
126
128
appiumCaps : {
127
129
platformName : Platform . ANDROID ,
128
130
fullReset : true
129
131
} ,
130
132
} ) ;
131
133
const server : AppiumServer = new AppiumServer ( nsCaps ) ;
132
- await server . start ( 9900 ) ;
134
+ await server . start ( nsCaps . port ) ;
133
135
assert . isTrue ( server . hasStarted ) ;
134
- const driver = await AppiumDriver . createAppiumDriver ( server . port , nsCaps ) ;
136
+ const driver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
135
137
const currentWindowName = AndroidController . getCurrentFocusedScreen ( nsCaps . device ) ;
136
138
const startTime = Date . now ( ) ;
137
139
while ( ! currentWindowName . includes ( "com.tns.NativeScriptActivity" ) && Date . now ( ) - startTime < 5000 ) { }
@@ -155,6 +157,7 @@ describe("start Appium server ios", async () => {
155
157
it ( "Start server" , async ( ) => {
156
158
const nsCaps = new NsCapabilities ( {
157
159
appPath : iosApp ,
160
+ port : 8799 ,
158
161
appiumCaps : {
159
162
platformName : Platform . IOS ,
160
163
deviceName : / ^ i P h o n e 6 $ / ,
@@ -163,7 +166,7 @@ describe("start Appium server ios", async () => {
163
166
} ,
164
167
} ) ;
165
168
const server : AppiumServer = new AppiumServer ( nsCaps ) ;
166
- await server . start ( 8799 ) ;
169
+ await server . start ( nsCaps . port ) ;
167
170
assert . isTrue ( server . hasStarted ) ;
168
171
await server . stop ( ) ;
169
172
const startTime = Date . now ( ) ;
@@ -173,6 +176,7 @@ describe("start Appium server ios", async () => {
173
176
174
177
it ( "Start appium driver" , async ( ) => {
175
178
const nsCaps = new NsCapabilities ( {
179
+ port : 8822 ,
176
180
appPath : iosApp ,
177
181
appiumCaps : {
178
182
platformName : Platform . IOS ,
@@ -183,9 +187,9 @@ describe("start Appium server ios", async () => {
183
187
verbose : false
184
188
} ) ;
185
189
const server : AppiumServer = new AppiumServer ( nsCaps ) ;
186
- await server . start ( 8822 ) ;
190
+ await server . start ( nsCaps . port ) ;
187
191
assert . isTrue ( server . hasStarted ) ;
188
- const driver = await AppiumDriver . createAppiumDriver ( server . port , nsCaps ) ;
192
+ const driver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
189
193
await driver . quit ( ) ;
190
194
await server . stop ( ) ;
191
195
} ) ;
@@ -194,6 +198,7 @@ describe("start Appium server ios", async () => {
194
198
describe ( "Start device by apiLevel" , async ( ) => {
195
199
it ( "test-start-emulator-apiLevel-6.0" , async ( ) => {
196
200
const nsCaps = new NsCapabilities ( {
201
+ port : 8799 ,
197
202
runType : "android23" ,
198
203
appPath : androidApp ,
199
204
appiumCaps : {
@@ -204,8 +209,8 @@ describe("Start device by apiLevel", async () => {
204
209
} ) ;
205
210
206
211
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 ) ;
209
214
const currentWindowName = AndroidController . getCurrentFocusedScreen ( nsCaps . device ) ;
210
215
const startTime = Date . now ( ) ;
211
216
while ( ! currentWindowName . includes ( "com.tns.NativeScriptActivity" ) && Date . now ( ) - startTime < 5000 ) { }
@@ -217,6 +222,7 @@ describe("Start device by apiLevel", async () => {
217
222
it ( "test-start-simulator-apiLevel-12." , async ( ) => {
218
223
const nsCaps = new NsCapabilities ( {
219
224
appPath : iosApp ,
225
+ port : 8887 ,
220
226
appiumCaps : {
221
227
platformVersion : / 1 2 .| | 1 1 ./ ,
222
228
platformName : Platform . IOS ,
@@ -225,8 +231,8 @@ describe("Start device by apiLevel", async () => {
225
231
} ) ;
226
232
227
233
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 ) ;
230
236
231
237
const apps = IOSController . getInstalledApps ( nsCaps . device ) ;
232
238
@@ -259,7 +265,7 @@ describe("dev-mode-options", async () => {
259
265
appPath : iosApp ,
260
266
} ) ;
261
267
262
- const appiumDriver = await AppiumDriver . createAppiumDriver ( appiumServer . port , nsCaps ) ;
268
+ const appiumDriver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
263
269
assert . isTrue ( appiumDriver . nsCapabilities . device . platform === Platform . IOS ) ;
264
270
assert . isDefined ( appiumDriver . nsCapabilities . appiumCaps . app ) ;
265
271
await appiumDriver . quit ( ) ;
@@ -270,7 +276,7 @@ describe("dev-mode-options", async () => {
270
276
appPath : androidApp
271
277
} ) ;
272
278
273
- const appiumDriver = await AppiumDriver . createAppiumDriver ( appiumServer . port , nsCaps ) ;
279
+ const appiumDriver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
274
280
assert . isTrue ( appiumDriver . nsCapabilities . device . platform === Platform . ANDROID ) ;
275
281
assert . isDefined ( appiumDriver . nsCapabilities . appiumCaps . app ) ;
276
282
await appiumDriver . quit ( ) ;
@@ -281,7 +287,7 @@ describe("dev-mode-options", async () => {
281
287
appPath : androidApp
282
288
} ) ;
283
289
284
- const appiumDriver = await AppiumDriver . createAppiumDriver ( appiumServer . port , nsCaps ) ;
290
+ const appiumDriver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
285
291
assert . isTrue ( appiumDriver . nsCapabilities . device . platform === Platform . ANDROID ) ;
286
292
assert . isDefined ( appiumDriver . nsCapabilities . appiumCaps . app ) ;
287
293
await appiumDriver . quit ( ) ;
@@ -292,7 +298,7 @@ describe("dev-mode-options", async () => {
292
298
appPath : iosApp
293
299
} ) ;
294
300
295
- const appiumDriver = await AppiumDriver . createAppiumDriver ( appiumServer . port , nsCaps ) ;
301
+ const appiumDriver = await AppiumDriver . createAppiumDriver ( nsCaps ) ;
296
302
assert . isTrue ( appiumDriver . nsCapabilities . device . platform === Platform . IOS ) ;
297
303
assert . isDefined ( appiumDriver . nsCapabilities . appiumCaps . app ) ;
298
304
await appiumDriver . quit ( ) ;
0 commit comments