@appium/test-support 1.5.0 → 2.0.1
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.
- package/build/lib/env-utils.js.map +1 -0
- package/build/lib/index.d.ts +0 -6
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +1 -58
- package/build/lib/index.js.map +1 -0
- package/build/lib/log-utils.js.map +1 -0
- package/build/lib/logger.js +2 -2
- package/build/lib/logger.js.map +1 -0
- package/build/lib/mock-utils.js +3 -3
- package/build/lib/mock-utils.js.map +1 -0
- package/build/lib/sandbox-utils.js +3 -3
- package/build/lib/sandbox-utils.js.map +1 -0
- package/build/lib/time-utils.js.map +1 -0
- package/build/lib/unhandled-rejection.js +3 -3
- package/build/lib/unhandled-rejection.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/index.js +0 -12
- package/lib/logger.js +1 -1
- package/package.json +5 -12
- package/build/lib/driver-e2e-suite.d.ts +0 -77
- package/build/lib/driver-e2e-suite.d.ts.map +0 -1
- package/build/lib/driver-e2e-suite.js +0 -389
- package/build/lib/driver-unit-suite.d.ts +0 -12
- package/build/lib/driver-unit-suite.d.ts.map +0 -1
- package/build/lib/driver-unit-suite.js +0 -564
- package/build/lib/helpers.d.ts +0 -19
- package/build/lib/helpers.d.ts.map +0 -1
- package/build/lib/helpers.js +0 -49
- package/build/lib/plugin-e2e-harness.d.ts +0 -67
- package/build/lib/plugin-e2e-harness.d.ts.map +0 -1
- package/build/lib/plugin-e2e-harness.js +0 -144
- package/lib/driver-e2e-suite.js +0 -465
- package/lib/driver-unit-suite.js +0 -642
- package/lib/helpers.js +0 -68
- package/lib/plugin-e2e-harness.js +0 -163
package/lib/driver-e2e-suite.js
DELETED
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import {server, routeConfiguringFunction, DeviceSettings} from 'appium/driver';
|
|
3
|
-
import axios from 'axios';
|
|
4
|
-
import B from 'bluebird';
|
|
5
|
-
import {TEST_HOST, getTestPort, createAppiumURL} from './helpers';
|
|
6
|
-
import chai from 'chai';
|
|
7
|
-
import sinon from 'sinon';
|
|
8
|
-
|
|
9
|
-
const should = chai.should();
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Creates some helper functions for E2E tests to manage sessions.
|
|
13
|
-
* @template [CommandData=unknown]
|
|
14
|
-
* @template [ResponseData=any]
|
|
15
|
-
* @param {number} port - Port on which the server is running. Typically this will be retrieved via `get-port` beforehand
|
|
16
|
-
* @param {string} [address] - Address/host on which the server is running. Defaults to {@linkcode TEST_HOST}
|
|
17
|
-
* @returns {SessionHelpers<CommandData, ResponseData>}
|
|
18
|
-
*/
|
|
19
|
-
export function createSessionHelpers(port, address = TEST_HOST) {
|
|
20
|
-
const createAppiumTestURL =
|
|
21
|
-
/** @type {import('lodash').CurriedFunction2<string,string,string>} */ (
|
|
22
|
-
createAppiumURL(address, port)
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const createSessionURL = createAppiumTestURL(_, '');
|
|
26
|
-
const newSessionURL = createAppiumTestURL('', 'session');
|
|
27
|
-
return /** @type {SessionHelpers<CommandData, ResponseData>} */ ({
|
|
28
|
-
newSessionURL,
|
|
29
|
-
createAppiumTestURL,
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {string} sessionId
|
|
33
|
-
* @param {string} cmdName
|
|
34
|
-
* @param {any} [data]
|
|
35
|
-
* @param {AxiosRequestConfig} [config]
|
|
36
|
-
* @returns {Promise<any>}
|
|
37
|
-
*/
|
|
38
|
-
postCommand: async (sessionId, cmdName, data = {}, config = {}) => {
|
|
39
|
-
const url = createAppiumTestURL(sessionId, cmdName);
|
|
40
|
-
const response = await axios.post(url, data, config);
|
|
41
|
-
return response.data?.value;
|
|
42
|
-
},
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param {string} sessionIdOrCmdName
|
|
46
|
-
* @param {string|AxiosRequestConfig} cmdNameOrConfig
|
|
47
|
-
* @param {AxiosRequestConfig} [config]
|
|
48
|
-
* @returns {Promise<any>}
|
|
49
|
-
*/
|
|
50
|
-
getCommand: async (sessionIdOrCmdName, cmdNameOrConfig, config = {}) => {
|
|
51
|
-
if (!_.isString(cmdNameOrConfig)) {
|
|
52
|
-
config = cmdNameOrConfig;
|
|
53
|
-
cmdNameOrConfig = sessionIdOrCmdName;
|
|
54
|
-
sessionIdOrCmdName = '';
|
|
55
|
-
}
|
|
56
|
-
const response = await axios({
|
|
57
|
-
url: createAppiumTestURL(sessionIdOrCmdName, cmdNameOrConfig),
|
|
58
|
-
validateStatus: null,
|
|
59
|
-
...config,
|
|
60
|
-
});
|
|
61
|
-
return response.data?.value;
|
|
62
|
-
},
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @param {NewSessionData} data
|
|
66
|
-
* @param {AxiosRequestConfig} [config]
|
|
67
|
-
*/
|
|
68
|
-
startSession: async (data, config = {}) => {
|
|
69
|
-
data = _.defaultsDeep(data, {
|
|
70
|
-
capabilities: {
|
|
71
|
-
alwaysMatch: {},
|
|
72
|
-
firstMatch: [{}],
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
const response = await axios.post(newSessionURL, data, config);
|
|
76
|
-
return response.data?.value;
|
|
77
|
-
},
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @param {string} sessionId
|
|
81
|
-
*/
|
|
82
|
-
endSession: async (sessionId) =>
|
|
83
|
-
await axios.delete(createSessionURL(sessionId), {
|
|
84
|
-
validateStatus: null,
|
|
85
|
-
}),
|
|
86
|
-
/**
|
|
87
|
-
* @param {string} sessionId
|
|
88
|
-
* @returns {Promise<any>}
|
|
89
|
-
*/
|
|
90
|
-
getSession: async (sessionId) => {
|
|
91
|
-
const response = await axios({
|
|
92
|
-
url: createSessionURL(sessionId),
|
|
93
|
-
validateStatus: null,
|
|
94
|
-
});
|
|
95
|
-
return response.data?.value;
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Creates E2E test suites for a driver.
|
|
102
|
-
* @template {Driver} P
|
|
103
|
-
* @param {DriverClass<P>} DriverClass
|
|
104
|
-
* @param {AppiumW3CCapabilities} [defaultCaps]
|
|
105
|
-
*/
|
|
106
|
-
export function driverE2ETestSuite(DriverClass, defaultCaps = {}) {
|
|
107
|
-
let address = defaultCaps['appium:address'] ?? TEST_HOST;
|
|
108
|
-
let port = defaultCaps['appium:port'];
|
|
109
|
-
const className = DriverClass.name || '(unknown driver)';
|
|
110
|
-
|
|
111
|
-
describe(`BaseDriver E2E (as ${className})`, function () {
|
|
112
|
-
let baseServer;
|
|
113
|
-
/** @type {P} */
|
|
114
|
-
let d;
|
|
115
|
-
/**
|
|
116
|
-
* This URL creates a new session
|
|
117
|
-
* @type {string}
|
|
118
|
-
**/
|
|
119
|
-
let newSessionURL;
|
|
120
|
-
|
|
121
|
-
/** @type {SessionHelpers['startSession']} */
|
|
122
|
-
let startSession;
|
|
123
|
-
/** @type {SessionHelpers['getSession']} */
|
|
124
|
-
let getSession;
|
|
125
|
-
/** @type {SessionHelpers['endSession']} */
|
|
126
|
-
let endSession;
|
|
127
|
-
/** @type {SessionHelpers['getCommand']} */
|
|
128
|
-
let getCommand;
|
|
129
|
-
/** @type {SessionHelpers['postCommand']} */
|
|
130
|
-
let postCommand;
|
|
131
|
-
before(async function () {
|
|
132
|
-
port = port ?? (await getTestPort());
|
|
133
|
-
defaultCaps = {...defaultCaps, 'appium:port': port};
|
|
134
|
-
d = new DriverClass({port, address});
|
|
135
|
-
baseServer = await server({
|
|
136
|
-
routeConfiguringFunction: routeConfiguringFunction(d),
|
|
137
|
-
port,
|
|
138
|
-
hostname: address,
|
|
139
|
-
// @ts-expect-error
|
|
140
|
-
cliArgs: {},
|
|
141
|
-
});
|
|
142
|
-
({startSession, getSession, endSession, newSessionURL, getCommand, postCommand} =
|
|
143
|
-
createSessionHelpers(port, address));
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
after(async function () {
|
|
147
|
-
await baseServer.close();
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
describe('session handling', function () {
|
|
151
|
-
it('should handle idempotency while creating sessions', async function () {
|
|
152
|
-
const sessionIds = [];
|
|
153
|
-
let times = 0;
|
|
154
|
-
do {
|
|
155
|
-
const {sessionId} = await startSession(
|
|
156
|
-
{
|
|
157
|
-
capabilities: {alwaysMatch: defaultCaps},
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
headers: {
|
|
161
|
-
'X-Idempotency-Key': '123456',
|
|
162
|
-
},
|
|
163
|
-
// XXX: I'm not sure what these are, as they are not documented axios options,
|
|
164
|
-
// nor are they mentioned in our source
|
|
165
|
-
// @ts-expect-error
|
|
166
|
-
simple: false,
|
|
167
|
-
resolveWithFullResponse: true,
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
sessionIds.push(sessionId);
|
|
172
|
-
times++;
|
|
173
|
-
} while (times < 2);
|
|
174
|
-
_.uniq(sessionIds).length.should.equal(1);
|
|
175
|
-
|
|
176
|
-
const {status, data} = await endSession(sessionIds[0]);
|
|
177
|
-
status.should.equal(200);
|
|
178
|
-
should.equal(data.value, null);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('should handle idempotency while creating parallel sessions', async function () {
|
|
182
|
-
const reqs = [];
|
|
183
|
-
let times = 0;
|
|
184
|
-
do {
|
|
185
|
-
reqs.push(
|
|
186
|
-
startSession(
|
|
187
|
-
{
|
|
188
|
-
capabilities: {
|
|
189
|
-
alwaysMatch: defaultCaps,
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
headers: {
|
|
194
|
-
'X-Idempotency-Key': '12345',
|
|
195
|
-
},
|
|
196
|
-
}
|
|
197
|
-
)
|
|
198
|
-
);
|
|
199
|
-
times++;
|
|
200
|
-
} while (times < 2);
|
|
201
|
-
const sessionIds = _.map(await B.all(reqs), 'sessionId');
|
|
202
|
-
_.uniq(sessionIds).length.should.equal(1);
|
|
203
|
-
|
|
204
|
-
const {status, data} = await endSession(sessionIds[0]);
|
|
205
|
-
status.should.equal(200);
|
|
206
|
-
should.equal(data.value, null);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it('should create session and retrieve a session id, then delete it', async function () {
|
|
210
|
-
let {status, data} = await axios.post(newSessionURL, {
|
|
211
|
-
capabilities: {
|
|
212
|
-
alwaysMatch: defaultCaps,
|
|
213
|
-
},
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
status.should.equal(200);
|
|
217
|
-
should.exist(data.value.sessionId);
|
|
218
|
-
data.value.capabilities.platformName.should.equal(defaultCaps.platformName);
|
|
219
|
-
data.value.capabilities.deviceName.should.equal(defaultCaps['appium:deviceName']);
|
|
220
|
-
|
|
221
|
-
({status, data} = await endSession(/** @type {string} */ (d.sessionId)));
|
|
222
|
-
|
|
223
|
-
status.should.equal(200);
|
|
224
|
-
should.equal(data.value, null);
|
|
225
|
-
should.equal(d.sessionId, null);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
it.skip('should throw NYI for commands not implemented', async function () {});
|
|
230
|
-
|
|
231
|
-
describe('command timeouts', function () {
|
|
232
|
-
let originalFindElement, originalFindElements;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* @param {number} [timeout]
|
|
236
|
-
*/
|
|
237
|
-
async function startTimeoutSession(timeout) {
|
|
238
|
-
const caps = _.cloneDeep(defaultCaps);
|
|
239
|
-
caps['appium:newCommandTimeout'] = timeout;
|
|
240
|
-
return await startSession({capabilities: {alwaysMatch: caps}});
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
before(function () {
|
|
244
|
-
originalFindElement = d.findElement;
|
|
245
|
-
d.findElement = function () {
|
|
246
|
-
return 'foo';
|
|
247
|
-
}.bind(d);
|
|
248
|
-
|
|
249
|
-
originalFindElements = d.findElements;
|
|
250
|
-
d.findElements = async function () {
|
|
251
|
-
await B.delay(200);
|
|
252
|
-
return ['foo'];
|
|
253
|
-
}.bind(d);
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
after(function () {
|
|
257
|
-
d.findElement = originalFindElement;
|
|
258
|
-
d.findElements = originalFindElements;
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
it('should set a default commandTimeout', async function () {
|
|
262
|
-
let newSession = await startTimeoutSession();
|
|
263
|
-
d.newCommandTimeoutMs.should.be.above(0);
|
|
264
|
-
await endSession(newSession.sessionId);
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it('should timeout on commands using commandTimeout cap', async function () {
|
|
268
|
-
let newSession = await startTimeoutSession(0.25);
|
|
269
|
-
const sessionId = /** @type {string} */ (d.sessionId);
|
|
270
|
-
await postCommand(sessionId, 'element', {
|
|
271
|
-
using: 'name',
|
|
272
|
-
value: 'foo',
|
|
273
|
-
});
|
|
274
|
-
await B.delay(400);
|
|
275
|
-
const value = await getSession(sessionId);
|
|
276
|
-
should.equal(value.error, 'invalid session id');
|
|
277
|
-
should.equal(d.sessionId, null);
|
|
278
|
-
const resp = (await endSession(newSession.sessionId)).data.value;
|
|
279
|
-
should.equal(resp?.error, 'invalid session id');
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
it('should not timeout with commandTimeout of false', async function () {
|
|
283
|
-
let newSession = await startTimeoutSession(0.1);
|
|
284
|
-
let start = Date.now();
|
|
285
|
-
const value = await postCommand(/** @type {string} */ (d.sessionId), 'elements', {
|
|
286
|
-
using: 'name',
|
|
287
|
-
value: 'foo',
|
|
288
|
-
});
|
|
289
|
-
(Date.now() - start).should.be.above(150);
|
|
290
|
-
value.should.eql(['foo']);
|
|
291
|
-
await endSession(newSession.sessionId);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it('should not timeout with commandTimeout of 0', async function () {
|
|
295
|
-
d.newCommandTimeoutMs = 2;
|
|
296
|
-
let newSession = await startTimeoutSession(0);
|
|
297
|
-
|
|
298
|
-
await postCommand(/** @type {string} */ (d.sessionId), 'element', {
|
|
299
|
-
using: 'name',
|
|
300
|
-
value: 'foo',
|
|
301
|
-
});
|
|
302
|
-
await B.delay(400);
|
|
303
|
-
const value = await getSession(/** @type {string} */ (d.sessionId));
|
|
304
|
-
value.platformName?.should.equal(defaultCaps.platformName);
|
|
305
|
-
const resp = (await endSession(newSession.sessionId)).data.value;
|
|
306
|
-
should.equal(resp, null);
|
|
307
|
-
|
|
308
|
-
d.newCommandTimeoutMs = 60 * 1000;
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
it('should not timeout if its just the command taking awhile', async function () {
|
|
312
|
-
let newSession = await startTimeoutSession(0.25);
|
|
313
|
-
// XXX: race condition: we must build this URL before ...something happens...
|
|
314
|
-
// which causes `d.sessionId` to be missing
|
|
315
|
-
const {sessionId} = d;
|
|
316
|
-
|
|
317
|
-
await postCommand(/** @type {string} */ (d.sessionId), 'element', {
|
|
318
|
-
using: 'name',
|
|
319
|
-
value: 'foo',
|
|
320
|
-
});
|
|
321
|
-
await B.delay(400);
|
|
322
|
-
const value = await getSession(/** @type {string} */ (sessionId));
|
|
323
|
-
value.error.should.equal('invalid session id');
|
|
324
|
-
should.equal(d.sessionId, null);
|
|
325
|
-
const resp = (await endSession(newSession.sessionId)).data.value;
|
|
326
|
-
/** @type {string} */ (/** @type { {error: string} } */ (resp).error).should.equal(
|
|
327
|
-
'invalid session id'
|
|
328
|
-
);
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
it('should not have a timer running before or after a session', async function () {
|
|
332
|
-
// @ts-expect-error
|
|
333
|
-
should.not.exist(d.noCommandTimer);
|
|
334
|
-
let newSession = await startTimeoutSession(0.25);
|
|
335
|
-
newSession.sessionId.should.equal(d.sessionId);
|
|
336
|
-
// @ts-expect-error
|
|
337
|
-
should.exist(d.noCommandTimer);
|
|
338
|
-
await endSession(newSession.sessionId);
|
|
339
|
-
// @ts-expect-error
|
|
340
|
-
should.not.exist(d.noCommandTimer);
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
describe('settings api', function () {
|
|
345
|
-
before(function () {
|
|
346
|
-
d.settings = new DeviceSettings({ignoreUnimportantViews: false});
|
|
347
|
-
});
|
|
348
|
-
it('should be able to get settings object', function () {
|
|
349
|
-
d.settings.getSettings().ignoreUnimportantViews.should.be.false;
|
|
350
|
-
});
|
|
351
|
-
it('should not reject when `updateSettings` method is not provided', async function () {
|
|
352
|
-
await d.settings.update({ignoreUnimportantViews: true}).should.not.be.rejected;
|
|
353
|
-
});
|
|
354
|
-
it('should reject for invalid update object', async function () {
|
|
355
|
-
await d.settings
|
|
356
|
-
// @ts-expect-error
|
|
357
|
-
.update('invalid json')
|
|
358
|
-
.should.be.rejectedWith('JSON');
|
|
359
|
-
});
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
describe('unexpected exits', function () {
|
|
363
|
-
/** @type {import('sinon').SinonSandbox} */
|
|
364
|
-
let sandbox;
|
|
365
|
-
beforeEach(function () {
|
|
366
|
-
sandbox = sinon.createSandbox();
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
afterEach(function () {
|
|
370
|
-
sandbox.restore();
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
it('should reject a current command when the driver crashes', async function () {
|
|
374
|
-
sandbox.stub(d, 'getStatus').callsFake(async function () {
|
|
375
|
-
await B.delay(5000);
|
|
376
|
-
});
|
|
377
|
-
const reqPromise = getCommand('status', {validateStatus: null});
|
|
378
|
-
// make sure that the request gets to the server before our shutdown
|
|
379
|
-
await B.delay(100);
|
|
380
|
-
const shutdownEventPromise = new B((resolve, reject) => {
|
|
381
|
-
setTimeout(
|
|
382
|
-
() =>
|
|
383
|
-
reject(
|
|
384
|
-
new Error(
|
|
385
|
-
'onUnexpectedShutdown event is expected to be fired within 5 seconds timeout'
|
|
386
|
-
)
|
|
387
|
-
),
|
|
388
|
-
5000
|
|
389
|
-
);
|
|
390
|
-
d.onUnexpectedShutdown(resolve);
|
|
391
|
-
});
|
|
392
|
-
d.startUnexpectedShutdown(new Error('Crashytimes'));
|
|
393
|
-
const value = await reqPromise;
|
|
394
|
-
value.message.should.contain('Crashytimes');
|
|
395
|
-
await shutdownEventPromise;
|
|
396
|
-
});
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
describe('event timings', function () {
|
|
400
|
-
it('should not add timings if not using opt-in cap', async function () {
|
|
401
|
-
const session = await startSession({capabilities: {alwaysMatch: defaultCaps}});
|
|
402
|
-
const res = await getSession(session.sessionId);
|
|
403
|
-
should.not.exist(res.events);
|
|
404
|
-
await endSession(session.sessionId);
|
|
405
|
-
});
|
|
406
|
-
it('should add start session timings', async function () {
|
|
407
|
-
const caps = {...defaultCaps, 'appium:eventTimings': true};
|
|
408
|
-
const session = await startSession({capabilities: {alwaysMatch: caps}});
|
|
409
|
-
const res = await getSession(session.sessionId);
|
|
410
|
-
should.exist(res.events);
|
|
411
|
-
should.exist(res.events?.newSessionRequested);
|
|
412
|
-
should.exist(res.events?.newSessionStarted);
|
|
413
|
-
res.events?.newSessionRequested[0].should.be.a('number');
|
|
414
|
-
res.events?.newSessionStarted[0].should.be.a('number');
|
|
415
|
-
await endSession(session.sessionId);
|
|
416
|
-
});
|
|
417
|
-
});
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* A {@linkcode DriverClass}, except using the base {@linkcode Driver} type instead of `ExternalDriver`.
|
|
423
|
-
* This allows the suite to work for `BaseDriver`.
|
|
424
|
-
* @template {Driver} P
|
|
425
|
-
* @typedef {import('@appium/types').DriverClass<P>} DriverClass
|
|
426
|
-
*/
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* @typedef {import('@appium/types').Capabilities} Capabilities
|
|
430
|
-
* @typedef {import('@appium/types').Driver} Driver
|
|
431
|
-
* @typedef {import('@appium/types').DriverStatic} DriverStatic
|
|
432
|
-
* @typedef {import('@appium/types').AppiumW3CCapabilities} AppiumW3CCapabilities
|
|
433
|
-
* @typedef {import('axios').AxiosRequestConfig} AxiosRequestConfig
|
|
434
|
-
* @typedef {import('@appium/types').SingularSessionData} SingularSessionData
|
|
435
|
-
*/
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* @template T,D
|
|
439
|
-
* @typedef {import('axios').AxiosResponse<T, D>} AxiosResponse
|
|
440
|
-
*/
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* @typedef NewSessionData
|
|
444
|
-
* @property {import('type-fest').RequireAtLeastOne<import('@appium/types').W3CCapabilities, 'firstMatch'|'alwaysMatch'>} capabilities
|
|
445
|
-
*/
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* @typedef NewSessionResponse
|
|
449
|
-
* @property {string} sessionId,
|
|
450
|
-
* @property {import('@appium/types').Capabilities} capabilities
|
|
451
|
-
*/
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Some E2E helpers for making requests and managing sessions
|
|
455
|
-
* See {@linkcode createSessionHelpers}
|
|
456
|
-
* @template [CommandData=unknown]
|
|
457
|
-
* @template [ResponseData=any]
|
|
458
|
-
* @typedef SessionHelpers
|
|
459
|
-
* @property {string} newSessionURL - URL to create a new session. Can be used with raw `axios` requests to fully inspect raw response. Mostly, this will not be used.
|
|
460
|
-
* @property {(data: NewSessionData, config?: AxiosRequestConfig) => Promise<NewSessionResponse>} startSession - Begin a session
|
|
461
|
-
* @property {(sessionId: string) => Promise<AxiosResponse<{value: {error?: string}?}, {validateStatus: null}>>} endSession - End a session. _Note: resolves with raw response object_
|
|
462
|
-
* @property {(sessionId: string) => Promise<SingularSessionData>} getSession - Get info about a session
|
|
463
|
-
* @property {(sessionId: string, cmdName: string, data?: CommandData, config?: AxiosRequestConfig) => Promise<ResponseData>} postCommand - Send an arbitrary command via `POST`.
|
|
464
|
-
* @property {(sessionIdOrCmdName: string, cmdNameOrConfig: string|AxiosRequestConfig, config?: AxiosRequestConfig) => Promise<ResponseData>} getCommand - Send an arbitrary command via `GET`. Optional `sessionId`.
|
|
465
|
-
*/
|