@appium/driver-test-support 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,46 +1,40 @@
1
1
  import _ from 'lodash';
2
- import B from 'bluebird';
3
- // eslint-disable-next-line import/named
2
+ import {sleep} from 'asyncbox';
4
3
  import {createSandbox} from 'sinon';
5
-
6
- // wrap these tests in a function so we can export the tests and re-use them
7
- // for actual driver implementations
4
+ import type {
5
+ Constraints,
6
+ Driver,
7
+ DriverClass,
8
+ NSDriverCaps,
9
+ W3CDriverCaps,
10
+ } from '@appium/types';
8
11
 
9
12
  /**
10
13
  * Creates unit test suites for a driver.
11
- * @template {Constraints} C
12
- * @param {DriverClass<C>} DriverClass
13
- * @param {import('@appium/types').NSDriverCaps<C>} [defaultCaps]
14
14
  */
15
-
16
- export function driverUnitTestSuite(
17
- DriverClass,
18
- defaultCaps = /** @type {import('@appium/types').NSDriverCaps<C>} */ ({})
19
- ) {
20
- // to display the driver under test in report
15
+ export function driverUnitTestSuite<C extends Constraints>(
16
+ DriverClass: DriverClass<Driver<C>>,
17
+ defaultCaps: NSDriverCaps<C> = {} as NSDriverCaps<C>
18
+ ): void {
21
19
  const className = DriverClass.name ?? '(unknown driver)';
22
20
 
23
21
  describe(`BaseDriver unit suite (as ${className})`, function () {
24
- /** @type {InstanceType<typeof DriverClass>} */
25
- let d;
26
- /** @type {import('@appium/types').W3CDriverCaps<C>} */
27
- let w3cCaps;
28
- /** @type {import('sinon').SinonSandbox} */
29
- let sandbox;
30
- let expect;
31
- let should;
22
+ let d: InstanceType<typeof DriverClass>;
23
+ let w3cCaps: W3CDriverCaps<C>;
24
+ let sandbox: ReturnType<typeof createSandbox>;
25
+ let expect: Chai.ExpectStatic;
32
26
 
33
27
  before(async function () {
34
28
  const chai = await import('chai');
35
29
  const chaiAsPromised = await import('chai-as-promised');
36
- chai.use(chaiAsPromised.default);
37
- expect = chai.expect;
38
- should = chai.should();
30
+ (chai as any).use((chaiAsPromised as any).default);
31
+ expect = (chai as any).expect;
32
+ (chai as any).should(); // for client code that may use should style
39
33
  });
40
34
 
41
35
  beforeEach(function () {
42
36
  sandbox = createSandbox();
43
- d = new DriverClass();
37
+ d = new DriverClass() as InstanceType<typeof DriverClass>;
44
38
  w3cCaps = {
45
39
  alwaysMatch: {
46
40
  ...defaultCaps,
@@ -64,13 +58,13 @@ export function driverUnitTestSuite(
64
58
  });
65
59
 
66
60
  it('should return an empty status object', async function () {
67
- let status = await d.getStatus();
68
- status.should.eql({});
61
+ const status = await d.getStatus();
62
+ expect(status).to.eql({});
69
63
  });
70
64
 
71
65
  it('should return a sessionId from createSession', async function () {
72
- let [sessId] = await d.createSession(w3cCaps);
73
- should.exist(sessId);
66
+ const [sessId] = await d.createSession(w3cCaps);
67
+ expect(sessId).to.exist;
74
68
  expect(sessId).to.be.a('string');
75
69
  expect(sessId.length).to.be.above(5);
76
70
  });
@@ -81,27 +75,26 @@ export function driverUnitTestSuite(
81
75
  });
82
76
 
83
77
  it('should be able to delete a session', async function () {
84
- let sessionId1 = await d.createSession(_.cloneDeep(w3cCaps));
78
+ const sessionId1 = await d.createSession(_.cloneDeep(w3cCaps));
85
79
  await d.deleteSession();
86
- should.equal(d.sessionId, null);
87
- let sessionId2 = await d.createSession(_.cloneDeep(w3cCaps));
80
+ expect(d.sessionId).to.equal(null);
81
+ const sessionId2 = await d.createSession(_.cloneDeep(w3cCaps));
88
82
  expect(sessionId1).to.not.eql(sessionId2);
89
83
  });
90
84
 
91
85
  it('should get the current session', async function () {
92
- let [, caps] = await d.createSession(w3cCaps);
86
+ const [, caps] = await d.createSession(w3cCaps);
93
87
  expect(caps).to.equal(await d.getSession());
94
88
  });
95
89
 
96
90
  it('should fulfill an unexpected driver quit promise', async function () {
97
- // make a command that will wait a bit so we can crash while it's running
98
91
  sandbox.stub(d, 'getStatus').callsFake(async () => {
99
- await B.delay(1000);
92
+ await sleep(1000);
100
93
  return 'good status';
101
94
  });
102
- let cmdPromise = d.executeCommand('getStatus');
103
- await B.delay(10);
104
- const p = new B((resolve, reject) => {
95
+ const cmdPromise = d.executeCommand('getStatus');
96
+ await sleep(10);
97
+ const p = new Promise<void>((resolve, reject) => {
105
98
  setTimeout(
106
99
  () =>
107
100
  reject(
@@ -119,13 +112,12 @@ export function driverUnitTestSuite(
119
112
  });
120
113
 
121
114
  it('should not allow commands in middle of unexpected shutdown', async function () {
122
- // make a command that will wait a bit so we can crash while it's running
123
- sandbox.stub(d, 'deleteSession').callsFake(async function () {
124
- await B.delay(100);
115
+ sandbox.stub(d, 'deleteSession').callsFake(async function (this: InstanceType<typeof DriverClass>) {
116
+ await sleep(100);
125
117
  DriverClass.prototype.deleteSession.call(this);
126
118
  });
127
119
  await d.createSession(w3cCaps);
128
- const p = new B((resolve, reject) => {
120
+ const p = new Promise<void>((resolve, reject) => {
129
121
  setTimeout(
130
122
  () =>
131
123
  reject(
@@ -143,14 +135,13 @@ export function driverUnitTestSuite(
143
135
  });
144
136
 
145
137
  it('should allow new commands after done shutting down', async function () {
146
- // make a command that will wait a bit so we can crash while it's running
147
- sandbox.stub(d, 'deleteSession').callsFake(async function () {
148
- await B.delay(100);
138
+ sandbox.stub(d, 'deleteSession').callsFake(async function (this: InstanceType<typeof DriverClass>) {
139
+ await sleep(100);
149
140
  DriverClass.prototype.deleteSession.call(this);
150
141
  });
151
142
 
152
143
  await d.createSession(_.cloneDeep(w3cCaps));
153
- const p = new B((resolve, reject) => {
144
+ const p = new Promise<void>((resolve, reject) => {
154
145
  setTimeout(
155
146
  () =>
156
147
  reject(
@@ -166,14 +157,13 @@ export function driverUnitTestSuite(
166
157
  await p;
167
158
 
168
159
  await expect(d.executeCommand('getSession')).to.be.rejectedWith(/shut down/);
169
- await B.delay(500);
160
+ await sleep(500);
170
161
 
171
162
  await d.executeCommand('createSession', null, null, _.cloneDeep(w3cCaps));
172
163
  await d.deleteSession();
173
164
  });
174
165
 
175
166
  it('should distinguish between W3C and JSONWP session', async function () {
176
- // Test W3C (leave first 2 args null because those are the JSONWP args)
177
167
  await d.executeCommand('createSession', null, null, {
178
168
  alwaysMatch: {
179
169
  ...defaultCaps,
@@ -189,7 +179,7 @@ export function driverUnitTestSuite(
189
179
  describe('protocol detection', function () {
190
180
  it('should use W3C if only W3C caps are provided', async function () {
191
181
  await d.createSession({
192
- alwaysMatch: _.clone(defaultCaps),
182
+ alwaysMatch: _.clone(defaultCaps) as object,
193
183
  firstMatch: [{}],
194
184
  });
195
185
  expect(d.protocol).to.equal('W3C');
@@ -197,23 +187,22 @@ export function driverUnitTestSuite(
197
187
  });
198
188
 
199
189
  it('should have a method to get driver for a session', async function () {
200
- let [sessId] = await d.createSession(w3cCaps);
190
+ const [sessId] = await d.createSession(w3cCaps);
201
191
  expect(d.driverForSession(sessId)).to.eql(d);
202
192
  });
203
193
 
204
194
  describe('command queue', function () {
205
- /** @type {InstanceType<DriverClass<Constraints>>} */
206
- let d;
207
- let waitMs = 10;
195
+ let d: InstanceType<typeof DriverClass>;
196
+ const waitMs = 10;
208
197
 
209
198
  beforeEach(function () {
210
- d = new DriverClass();
199
+ d = new DriverClass() as InstanceType<typeof DriverClass>;
211
200
  sandbox.stub(d, 'getStatus').callsFake(async () => {
212
- await B.delay(waitMs);
201
+ await sleep(waitMs);
213
202
  return Date.now();
214
203
  });
215
204
  sandbox.stub(d, 'deleteSession').callsFake(async () => {
216
- await B.delay(waitMs);
205
+ await sleep(waitMs);
217
206
  throw new Error('multipass');
218
207
  });
219
208
  });
@@ -223,12 +212,12 @@ export function driverUnitTestSuite(
223
212
  });
224
213
 
225
214
  it('should queue commands and.executeCommand/respond in the order received', async function () {
226
- let numCmds = 10;
227
- let cmds = [];
215
+ const numCmds = 10;
216
+ const cmds: Promise<number>[] = [];
228
217
  for (let i = 0; i < numCmds; i++) {
229
218
  cmds.push(d.executeCommand('getStatus'));
230
219
  }
231
- let results = await B.all(cmds);
220
+ const results = await Promise.all(cmds) as number[];
232
221
  for (let i = 1; i < numCmds; i++) {
233
222
  if (results[i] <= results[i - 1]) {
234
223
  throw new Error('Got result out of order');
@@ -237,8 +226,8 @@ export function driverUnitTestSuite(
237
226
  });
238
227
 
239
228
  it('should handle errors correctly when queuing', async function () {
240
- let numCmds = 10;
241
- let cmds = [];
229
+ const numCmds = 10;
230
+ const cmds: Promise<number | void>[] = [];
242
231
  for (let i = 0; i < numCmds; i++) {
243
232
  if (i === 5) {
244
233
  cmds.push(d.executeCommand('deleteSession'));
@@ -246,37 +235,41 @@ export function driverUnitTestSuite(
246
235
  cmds.push(d.executeCommand('getStatus'));
247
236
  }
248
237
  }
249
- let results = /** @type {PromiseFulfilledResult<any>[]} */ (
250
-
251
- await Promise.allSettled(cmds)
252
- );
238
+ const results = await Promise.allSettled(cmds);
253
239
  for (let i = 1; i < 5; i++) {
254
- if (results[i].value <= results[i - 1].value) {
255
- throw new Error('Got result out of order');
240
+ const r = results[i];
241
+ const rPrev = results[i - 1];
242
+ if (r.status === 'fulfilled' && rPrev.status === 'fulfilled') {
243
+ if (r.value <= rPrev.value) {
244
+ throw new Error('Got result out of order');
245
+ }
256
246
  }
257
247
  }
258
- /** @type {PromiseRejectedResult} */ (
259
- /** @type {unknown} */ (results[5])
260
- ).reason.message.should.contain('multipass');
248
+ const rejected = results[5] as PromiseRejectedResult;
249
+ expect(rejected.reason.message).to.contain('multipass');
261
250
  for (let i = 7; i < numCmds; i++) {
262
- if (results[i].value <= results[i - 1].value) {
263
- throw new Error('Got result out of order');
251
+ const r = results[i];
252
+ const rPrev = results[i - 1];
253
+ if (r.status === 'fulfilled' && rPrev.status === 'fulfilled') {
254
+ if (r.value <= rPrev.value) {
255
+ throw new Error('Got result out of order');
256
+ }
264
257
  }
265
258
  }
266
259
  });
267
260
 
268
261
  it('should not care if queue empties for a bit', async function () {
269
- let numCmds = 10;
270
- let cmds = [];
262
+ const numCmds = 10;
263
+ let cmds: Promise<number>[] = [];
271
264
  for (let i = 0; i < numCmds; i++) {
272
265
  cmds.push(d.executeCommand('getStatus'));
273
266
  }
274
- let results = await B.all(cmds);
267
+ let results = await Promise.all(cmds) as number[];
275
268
  cmds = [];
276
269
  for (let i = 0; i < numCmds; i++) {
277
270
  cmds.push(d.executeCommand('getStatus'));
278
271
  }
279
- results = await B.all(cmds);
272
+ results = await Promise.all(cmds) as number[];
280
273
  for (let i = 1; i < numCmds; i++) {
281
274
  if (results[i] <= results[i - 1]) {
282
275
  throw new Error('Got result out of order');
@@ -349,7 +342,7 @@ export function driverUnitTestSuite(
349
342
  });
350
343
 
351
344
  describe('proxying', function () {
352
- let sessId;
345
+ let sessId: string;
353
346
  beforeEach(async function () {
354
347
  [sessId] = await d.createSession(w3cCaps);
355
348
  });
@@ -390,7 +383,7 @@ export function driverUnitTestSuite(
390
383
  });
391
384
  it('should throw an error when sessionId is wrong', function () {
392
385
  expect(() => {
393
- d.canProxy();
386
+ d.canProxy(undefined as any);
394
387
  }).to.throw;
395
388
  });
396
389
  });
@@ -398,44 +391,36 @@ export function driverUnitTestSuite(
398
391
  describe('#proxyRouteIsAvoided', function () {
399
392
  it('should validate form of avoidance list', function () {
400
393
  const avoidStub = sandbox.stub(d, 'getProxyAvoidList');
401
- // @ts-expect-error
402
- avoidStub.returns([['POST', /\/foo/], ['GET']]);
394
+ avoidStub.returns([['POST', /\/foo/], ['GET']] as any);
403
395
  expect(() => {
404
- // @ts-expect-error
405
- d.proxyRouteIsAvoided();
396
+ (d as any).proxyRouteIsAvoided();
406
397
  }).to.throw;
407
398
  avoidStub.returns([
408
399
  ['POST', /\/foo/],
409
- // @ts-expect-error
410
400
  ['GET', /^foo/, 'bar'],
411
- ]);
401
+ ] as any);
412
402
  expect(() => {
413
- // @ts-expect-error
414
- d.proxyRouteIsAvoided();
403
+ (d as any).proxyRouteIsAvoided();
415
404
  }).to.throw;
416
405
  });
417
406
  it('should reject bad http methods', function () {
418
407
  const avoidStub = sandbox.stub(d, 'getProxyAvoidList');
419
408
  avoidStub.returns([
420
409
  ['POST', /^foo/],
421
- // @ts-expect-error
422
- ['BAZETE', /^bar/],
410
+ ['BAZETE' as any, /^bar/],
423
411
  ]);
424
412
  expect(() => {
425
- // @ts-expect-error
426
- d.proxyRouteIsAvoided();
413
+ (d as any).proxyRouteIsAvoided();
427
414
  }).to.throw;
428
415
  });
429
416
  it('should reject non-regex routes', function () {
430
417
  const avoidStub = sandbox.stub(d, 'getProxyAvoidList');
431
418
  avoidStub.returns([
432
419
  ['POST', /^foo/],
433
- // @ts-expect-error
434
- ['GET', '/bar'],
420
+ ['GET', '/bar' as any],
435
421
  ]);
436
422
  expect(() => {
437
- // @ts-expect-error
438
- d.proxyRouteIsAvoided();
423
+ (d as any).proxyRouteIsAvoided();
439
424
  }).to.throw;
440
425
  });
441
426
  it('should return true for routes in the avoid list', function () {
@@ -458,7 +443,7 @@ export function driverUnitTestSuite(
458
443
  });
459
444
 
460
445
  describe('event timing framework', function () {
461
- let beforeStartTime;
446
+ let beforeStartTime: number;
462
447
  beforeEach(async function () {
463
448
  beforeStartTime = Date.now();
464
449
  d.shouldValidateCaps = false;
@@ -469,16 +454,16 @@ export function driverUnitTestSuite(
469
454
  });
470
455
  describe('#eventHistory', function () {
471
456
  it('should have an eventHistory property', function () {
472
- should.exist(d.eventHistory);
473
- should.exist(d.eventHistory.commands);
457
+ expect(d.eventHistory).to.exist;
458
+ expect(d.eventHistory.commands).to.exist;
474
459
  });
475
460
 
476
461
  it('should have a session start timing after session start', function () {
477
- let {newSessionRequested, newSessionStarted} = d.eventHistory;
478
- newSessionRequested.should.have.length(1);
479
- newSessionStarted.should.have.length(1);
480
- newSessionRequested[0].should.be.a('number');
481
- newSessionStarted[0].should.be.a('number');
462
+ const {newSessionRequested, newSessionStarted} = d.eventHistory;
463
+ expect(newSessionRequested).to.have.length(1);
464
+ expect(newSessionStarted).to.have.length(1);
465
+ expect(newSessionRequested[0]).to.be.a('number');
466
+ expect(newSessionStarted[0]).to.be.a('number');
482
467
  expect(newSessionRequested[0] >= beforeStartTime).to.be.true;
483
468
  expect(newSessionStarted[0] >= newSessionRequested[0]).to.be.true;
484
469
  });
@@ -502,12 +487,10 @@ export function driverUnitTestSuite(
502
487
  d.logEvent('commands');
503
488
  }).to.throw();
504
489
  expect(() => {
505
- // @ts-expect-error - bad type
506
- d.logEvent(1);
490
+ d.logEvent(1 as any);
507
491
  }).to.throw();
508
492
  expect(() => {
509
- // @ts-expect-error - bad type
510
- d.logEvent({});
493
+ d.logEvent({} as any);
511
494
  }).to.throw();
512
495
  });
513
496
  });
@@ -521,12 +504,12 @@ export function driverUnitTestSuite(
521
504
  describe('getSession decoration', function () {
522
505
  it('should decorate getSession response if opt-in cap is provided', async function () {
523
506
  let res = await d.getSession();
524
- should.not.exist(res.events);
507
+ expect(res.events).to.not.exist;
525
508
 
526
509
  _.set(d, 'caps.eventTimings', true);
527
510
  res = await d.getSession();
528
- should.exist(res.events);
529
- should.exist(res.events?.newSessionRequested);
511
+ expect(res.events).to.exist;
512
+ expect(res.events?.newSessionRequested).to.exist;
530
513
  expect(res.events?.newSessionRequested[0]).to.be.a('number');
531
514
  });
532
515
  });
@@ -534,16 +517,17 @@ export function driverUnitTestSuite(
534
517
  });
535
518
 
536
519
  describe('.isFeatureEnabled', function () {
537
- let d;
538
- let expect;
520
+ let d: InstanceType<typeof DriverClass>;
521
+ let expect: Chai.ExpectStatic;
539
522
 
540
523
  before(async function () {
541
524
  const chai = await import('chai');
542
- expect = chai.expect;
525
+ expect = (chai as any).expect;
526
+ (chai as any).should(); // for client code that may use should style
543
527
  });
544
528
 
545
529
  beforeEach(function () {
546
- d = new DriverClass();
530
+ d = new DriverClass() as InstanceType<typeof DriverClass>;
547
531
  });
548
532
 
549
533
  it('should throw if feature name is invalid', function () {
@@ -594,23 +578,3 @@ export function driverUnitTestSuite(
594
578
  });
595
579
  });
596
580
  }
597
-
598
- /**
599
- * @typedef {import('@appium/types').BaseNSCapabilities} BaseNSCapabilities
600
- * @typedef {import('@appium/types').Constraints} Constraints
601
- */
602
-
603
- /**
604
- * @template {Constraints} C
605
- * @typedef {import('@appium/types').DriverClass<Driver<C>>} DriverClass
606
- */
607
-
608
- /**
609
- * @template {Constraints} C
610
- * @typedef {import('@appium/types').Driver<C>} Driver
611
- */
612
-
613
- /**
614
- * @template {Constraints} C
615
- * @typedef {import('@appium/types').W3CCapabilities<C>} W3CCapabilities
616
- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appium/driver-test-support",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "Test utilities for Appium drivers",
5
5
  "keywords": [
6
6
  "automation",
@@ -23,34 +23,33 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "author": "https://github.com/appium",
26
- "main": "index.js",
26
+ "main": "./build/lib/index.js",
27
27
  "directories": {
28
- "lib": "lib"
28
+ "lib": "./lib"
29
29
  },
30
30
  "files": [
31
- "index.js",
31
+ "build/lib",
32
32
  "lib",
33
- "build",
34
- "tsconfig.json",
35
- "!build/tsconfig.tsbuildinfo"
33
+ "tsconfig.json"
36
34
  ],
37
35
  "scripts": {
38
36
  "test": "npm run test:unit",
39
- "test:smoke": "node ./index.js",
40
- "test:unit": "mocha \"test/unit/**/*.spec.js\""
37
+ "test:smoke": "node ./build/lib/index.js",
38
+ "test:unit": "mocha \"test/unit/**/*.spec.ts\""
41
39
  },
42
40
  "types": "./build/lib/index.d.ts",
43
41
  "dependencies": {
44
- "@appium/types": "^1.1.2",
45
- "axios": "1.13.2",
46
- "bluebird": "3.7.2",
47
- "chai": "6.2.1",
42
+ "asyncbox": "6.1.0",
43
+ "axios": "1.13.6",
44
+ "chai": "6.2.2",
48
45
  "chai-as-promised": "8.0.2",
49
- "get-port": "5.1.1",
50
- "lodash": "4.17.21",
51
- "sinon": "21.0.0",
52
- "source-map-support": "0.5.21",
53
- "type-fest": "5.3.0"
46
+ "get-port": "7.1.0",
47
+ "lodash": "4.17.23",
48
+ "sinon": "21.0.2",
49
+ "type-fest": "5.4.4"
50
+ },
51
+ "devDependencies": {
52
+ "@appium/types": "^1.2.1"
54
53
  },
55
54
  "peerDependencies": {
56
55
  "appium": "^3.0.0-beta.0",
@@ -63,5 +62,5 @@
63
62
  "publishConfig": {
64
63
  "access": "public"
65
64
  },
66
- "gitHead": "9004554879687ddad51d3afdf8c711b027efbd99"
65
+ "gitHead": "980a121804ae006db879fb6860f627ac36174c15"
67
66
  }
package/tsconfig.json CHANGED
@@ -3,12 +3,11 @@
3
3
  "compilerOptions": {
4
4
  "rootDir": ".",
5
5
  "outDir": "build",
6
- "checkJs": true,
7
6
  "paths": {
8
7
  "@appium/types": ["../types"],
9
8
  "appium/driver": ["../base-driver"]
10
9
  },
11
- "types": ["mocha", "chai", "chai-as-promised"]
10
+ "types": ["mocha", "chai", "chai-as-promised", "node"]
12
11
  },
13
12
  "include": ["lib", "test"],
14
13
  "references": [{"path": "../types"}, {"path": "../base-driver"}]
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../../test/unit/index.spec.js"],"names":[],"mappings":""}
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const lib_1 = require("../../lib");
7
- const lodash_1 = __importDefault(require("lodash"));
8
- describe('TEST_HOST', function () {
9
- let expect;
10
- before(async function () {
11
- const chai = await import('chai');
12
- chai.should();
13
- expect = chai.expect;
14
- });
15
- it('should be localhost', function () {
16
- expect(lib_1.TEST_HOST).to.equal('127.0.0.1');
17
- });
18
- });
19
- describe('getTestPort()', function () {
20
- let expect;
21
- before(async function () {
22
- const chai = await import('chai');
23
- chai.should();
24
- expect = chai.expect;
25
- });
26
- it('should get a free test port', async function () {
27
- const port = await (0, lib_1.getTestPort)();
28
- expect(port).to.be.a('number');
29
- });
30
- });
31
- describe('createAppiumURL()', function () {
32
- let expect;
33
- before(async function () {
34
- const chai = await import('chai');
35
- chai.should();
36
- expect = chai.expect;
37
- });
38
- it('should create a "new session" URL', function () {
39
- const actual = (0, lib_1.createAppiumURL)(lib_1.TEST_HOST, 31337, '', 'session');
40
- const expected = `http://${lib_1.TEST_HOST}:31337/session`;
41
- expect(actual).to.equal(expected);
42
- });
43
- it('should create a URL to get an existing session', function () {
44
- const sessionId = '12345';
45
- const createGetSessionURL = (0, lib_1.createAppiumURL)(lib_1.TEST_HOST, 31337, lodash_1.default, 'session');
46
- const actual = createGetSessionURL(sessionId);
47
- const expected = `http://${lib_1.TEST_HOST}:31337/session/${sessionId}/session`;
48
- expect(actual).to.equal(expected);
49
- });
50
- it('should create a URL for a command using an existing session', function () {
51
- const sessionId = '12345';
52
- const createURLWithPath = (0, lib_1.createAppiumURL)('127.0.0.1', 31337, sessionId);
53
- const actual = createURLWithPath('moocow');
54
- const expected = `http://${lib_1.TEST_HOST}:31337/session/${sessionId}/moocow`;
55
- expect(actual).to.equal(expected);
56
- });
57
- });
58
- //# sourceMappingURL=index.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../test/unit/index.spec.js"],"names":[],"mappings":";;;;;AAAA,mCAAkE;AAClE,oDAAuB;AAEvB,QAAQ,CAAC,WAAW,EAAE;IACpB,IAAI,MAAM,CAAC;IAEX,MAAM,CAAC,KAAK;QACV,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qBAAqB,EAAE;QACxB,MAAM,CAAC,eAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC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