appium-remote-debugger 15.2.7 → 15.2.8

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/lib/types.d.ts +1 -1
  3. package/build/lib/types.d.ts.map +1 -1
  4. package/build/test/functional/http-server.d.ts +3 -0
  5. package/build/test/functional/http-server.d.ts.map +1 -0
  6. package/build/test/functional/http-server.js +33 -0
  7. package/build/test/functional/http-server.js.map +1 -0
  8. package/build/test/functional/safari-e2e-specs.d.ts +2 -0
  9. package/build/test/functional/safari-e2e-specs.d.ts.map +1 -0
  10. package/build/test/functional/safari-e2e-specs.js +253 -0
  11. package/build/test/functional/safari-e2e-specs.js.map +1 -0
  12. package/build/test/helpers/helpers.d.ts +2 -0
  13. package/build/test/helpers/helpers.d.ts.map +1 -0
  14. package/build/test/helpers/helpers.js +5 -0
  15. package/build/test/helpers/helpers.js.map +1 -0
  16. package/build/test/unit/mixins/connect-specs.d.ts +2 -0
  17. package/build/test/unit/mixins/connect-specs.d.ts.map +1 -0
  18. package/build/test/unit/mixins/connect-specs.js +114 -0
  19. package/build/test/unit/mixins/connect-specs.js.map +1 -0
  20. package/build/test/unit/mixins/execute-specs.d.ts +2 -0
  21. package/build/test/unit/mixins/execute-specs.d.ts.map +1 -0
  22. package/build/test/unit/mixins/execute-specs.js +94 -0
  23. package/build/test/unit/mixins/execute-specs.js.map +1 -0
  24. package/build/test/unit/mixins/message-handlers-specs.d.ts +2 -0
  25. package/build/test/unit/mixins/message-handlers-specs.d.ts.map +1 -0
  26. package/build/test/unit/mixins/message-handlers-specs.js +55 -0
  27. package/build/test/unit/mixins/message-handlers-specs.js.map +1 -0
  28. package/build/test/unit/mixins/navigate-specs.d.ts +2 -0
  29. package/build/test/unit/mixins/navigate-specs.d.ts.map +1 -0
  30. package/build/test/unit/mixins/navigate-specs.js +66 -0
  31. package/build/test/unit/mixins/navigate-specs.js.map +1 -0
  32. package/build/test/unit/remote-messages-specs.d.ts +2 -0
  33. package/build/test/unit/remote-messages-specs.d.ts.map +1 -0
  34. package/build/test/unit/remote-messages-specs.js +32 -0
  35. package/build/test/unit/remote-messages-specs.js.map +1 -0
  36. package/build/test/unit/rpc/rpc-client-specs.d.ts +2 -0
  37. package/build/test/unit/rpc/rpc-client-specs.d.ts.map +1 -0
  38. package/build/test/unit/rpc/rpc-client-specs.js +43 -0
  39. package/build/test/unit/rpc/rpc-client-specs.js.map +1 -0
  40. package/build/test/unit/utils-specs.d.ts +2 -0
  41. package/build/test/unit/utils-specs.d.ts.map +1 -0
  42. package/build/test/unit/utils-specs.js +72 -0
  43. package/build/test/unit/utils-specs.js.map +1 -0
  44. package/build/tsconfig.tsbuildinfo +1 -1
  45. package/lib/types.ts +1 -1
  46. package/package.json +4 -4
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const message_handlers_1 = require("../../../lib/mixins/message-handlers");
4
+ const helpers_1 = require("../../helpers/helpers");
5
+ const remote_debugger_1 = require("../../../lib/remote-debugger");
6
+ const chai_1 = require("chai");
7
+ describe('connect', function () {
8
+ this.timeout(helpers_1.MOCHA_TIMEOUT);
9
+ let rd;
10
+ this.beforeEach(function () {
11
+ rd = new remote_debugger_1.RemoteDebugger();
12
+ });
13
+ describe('getDebuggerAppKey', function () {
14
+ it('should return the app key for the bundle', function () {
15
+ rd._appDict = {
16
+ ['42']: {
17
+ id: '42',
18
+ bundleId: 'io.appium.bundle',
19
+ isProxy: false,
20
+ name: 'Bundle',
21
+ isActive: true,
22
+ isAutomationEnabled: true
23
+ }
24
+ };
25
+ (0, chai_1.expect)(message_handlers_1.getDebuggerAppKey.bind(rd)('io.appium.bundle')).to.equal('42');
26
+ });
27
+ it('should return the app key for the bundle when proxied', function () {
28
+ rd._appDict = {
29
+ ['42']: {
30
+ id: '42',
31
+ bundleId: 'io.appium.bundle',
32
+ isProxy: false,
33
+ name: 'Bundle',
34
+ isActive: true,
35
+ isAutomationEnabled: true
36
+ },
37
+ ['43']: {
38
+ id: '43',
39
+ bundleId: 'io.appium.proxied.bundle',
40
+ isProxy: true,
41
+ hostId: '42',
42
+ name: 'ProxiedBundle',
43
+ isActive: true,
44
+ isAutomationEnabled: true
45
+ }
46
+ };
47
+ (0, chai_1.expect)(message_handlers_1.getDebuggerAppKey.bind(rd)('io.appium.bundle')).to.equal('43');
48
+ });
49
+ it('should return undefined when there is no appropriate app', function () {
50
+ rd._appDict = {};
51
+ (0, chai_1.expect)(message_handlers_1.getDebuggerAppKey.bind(rd)('io.appium.bundle')).to.not.exist;
52
+ });
53
+ });
54
+ });
55
+ //# sourceMappingURL=message-handlers-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-handlers-specs.js","sourceRoot":"","sources":["../../../../test/unit/mixins/message-handlers-specs.ts"],"names":[],"mappings":";;AAAA,2EAE8C;AAC9C,mDAAsD;AACtD,kEAA8D;AAE9D,+BAA8B;AAE9B,QAAQ,CAAC,SAAS,EAAE;IAClB,IAAI,CAAC,OAAO,CAAC,uBAAa,CAAC,CAAC;IAC5B,IAAI,EAAkB,CAAC;IAEvB,IAAI,CAAC,UAAU,CAAC;QACd,EAAE,GAAG,IAAI,gCAAc,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,mBAAmB,EAAE;QAC5B,EAAE,CAAC,0CAA0C,EAAE;YAC5C,EAAU,CAAC,QAAQ,GAAG;gBACrB,CAAC,IAAI,CAAC,EAAE;oBACN,EAAE,EAAE,IAAI;oBACR,QAAQ,EAAE,kBAAkB;oBAC5B,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,mBAAmB,EAAE,IAAI;iBACf;aACb,CAAC;YACF,IAAA,aAAM,EAAC,oCAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,uDAAuD,EAAE;YACzD,EAAU,CAAC,QAAQ,GAAG;gBACrB,CAAC,IAAI,CAAC,EAAE;oBACN,EAAE,EAAE,IAAI;oBACR,QAAQ,EAAE,kBAAkB;oBAC5B,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,mBAAmB,EAAE,IAAI;iBACf;gBACZ,CAAC,IAAI,CAAC,EAAE;oBACN,EAAE,EAAE,IAAI;oBACR,QAAQ,EAAE,0BAA0B;oBACpC,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE,IAAI;oBACZ,IAAI,EAAE,eAAe;oBACrB,QAAQ,EAAE,IAAI;oBACd,mBAAmB,EAAE,IAAI;iBACf;aACb,CAAC;YACF,IAAA,aAAM,EAAC,oCAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,0DAA0D,EAAE;YAC5D,EAAU,CAAC,QAAQ,GAAG,EAAE,CAAC;YAC1B,IAAA,aAAM,EAAC,oCAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;QACtE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=navigate-specs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigate-specs.d.ts","sourceRoot":"","sources":["../../../../test/unit/mixins/navigate-specs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const remote_debugger_1 = require("../../../lib/remote-debugger");
4
+ const chai_1 = require("chai");
5
+ describe('navigate', function () {
6
+ describe('isPageLoadingCompleted', function () {
7
+ const BUNDLE_ID = 'com.apple.mobilesafari';
8
+ describe('default pageLoadStrategy', function () {
9
+ it('with complete readyState', function () {
10
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID });
11
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('complete')).to.eql(true);
12
+ });
13
+ it('with interactive readyState', function () {
14
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID });
15
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('interactive')).to.eql(false);
16
+ });
17
+ it('with loading readyState', function () {
18
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID });
19
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('loading')).to.eql(false);
20
+ });
21
+ });
22
+ describe('eager pageLoadStrategy', function () {
23
+ it('with complete readyState', function () {
24
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID, pageLoadStrategy: 'eager' });
25
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('complete')).to.eql(true);
26
+ });
27
+ it('with interactive readyState', function () {
28
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID, pageLoadStrategy: 'Eager' });
29
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('interactive')).to.eql(true);
30
+ });
31
+ it('with loading readyState', function () {
32
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID, pageLoadStrategy: 'eager' });
33
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('loading')).to.eql(false);
34
+ });
35
+ });
36
+ describe('normal pageLoadStrategy', function () {
37
+ it('with complete readyState', function () {
38
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID, pageLoadStrategy: 'NorMal' });
39
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('complete')).to.eql(true);
40
+ });
41
+ it('with interactive readyState', function () {
42
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID, pageLoadStrategy: 'normaL' });
43
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('interactive')).to.eql(false);
44
+ });
45
+ it('with loading readyState', function () {
46
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID, pageLoadStrategy: 'normal' });
47
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('loading')).to.eql(false);
48
+ });
49
+ });
50
+ describe('none pageLoadStrategy', function () {
51
+ it('with complete readyState', function () {
52
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID, pageLoadStrategy: 'none' });
53
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('complete')).to.eql(true);
54
+ });
55
+ it('with interactive readyState', function () {
56
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID, pageLoadStrategy: 'noNe' });
57
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('interactive')).to.eql(true);
58
+ });
59
+ it('with loading readyState', function () {
60
+ const remoteDebugger = new remote_debugger_1.RemoteDebugger({ bundleId: BUNDLE_ID, pageLoadStrategy: 'NONE' });
61
+ (0, chai_1.expect)(remoteDebugger.isPageLoadingCompleted('loading')).to.eql(true);
62
+ });
63
+ });
64
+ });
65
+ });
66
+ //# sourceMappingURL=navigate-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigate-specs.js","sourceRoot":"","sources":["../../../../test/unit/mixins/navigate-specs.ts"],"names":[],"mappings":";;AAAA,kEAA8D;AAC9D,+BAA8B;AAE9B,QAAQ,CAAC,UAAU,EAAE;IAEnB,QAAQ,CAAC,wBAAwB,EAAE;QACjC,MAAM,SAAS,GAAG,wBAAwB,CA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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=remote-messages-specs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-messages-specs.d.ts","sourceRoot":"","sources":["../../../test/unit/remote-messages-specs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const remote_messages_1 = require("../../lib/rpc/remote-messages");
4
+ const helpers_1 = require("../helpers/helpers");
5
+ const chai_1 = require("chai");
6
+ describe('RemoteMessages', function () {
7
+ this.timeout(helpers_1.MOCHA_TIMEOUT);
8
+ const remoteMessages = new remote_messages_1.RemoteMessages();
9
+ describe('getRemoteCommand', function () {
10
+ const commands = [
11
+ 'setConnectionKey', 'connectToApp', 'setSenderKey', 'indicateWebView',
12
+ 'Runtime.evaluate', 'Runtime.callFunctionOn', 'Page.navigate', 'Page.enable', 'Timeline.start',
13
+ 'Timeline.stop',
14
+ ];
15
+ for (const command of commands) {
16
+ it(`should be able to retrieve ${command} command`, function () {
17
+ const remoteCommand = remoteMessages.getRemoteCommand(command, {
18
+ id: 'test-id',
19
+ connId: 'test-conn-id',
20
+ appIdKey: 'test-app-id',
21
+ pageIdKey: 'test-page-id',
22
+ senderId: 'test-sender-id',
23
+ bundleId: 'test.bundle.id',
24
+ });
25
+ (0, chai_1.expect)(remoteCommand).to.be.an.instanceof(Object);
26
+ (0, chai_1.expect)(remoteCommand.__argument).to.exist;
27
+ (0, chai_1.expect)(remoteCommand.__selector).to.exist;
28
+ });
29
+ }
30
+ });
31
+ });
32
+ //# sourceMappingURL=remote-messages-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-messages-specs.js","sourceRoot":"","sources":["../../../test/unit/remote-messages-specs.ts"],"names":[],"mappings":";;AAAA,mEAA+D;AAC/D,gDAAmD;AACnD,+BAA8B;AAE9B,QAAQ,CAAC,gBAAgB,EAAE;IACzB,IAAI,CAAC,OAAO,CAAC,uBAAa,CAAC,CAAC;IAE5B,MAAM,cAAc,GAAG,IAAI,gCAAc,EAAE,CAAC;IAE5C,QAAQ,CAAC,kBAAkB,EAAE;QAC3B,MAAM,QAAQ,GAAG;YACf,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB;YACrE,kBAAkB,EAAE,wBAAwB,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB;YAC9F,eAAe;SAChB,CAAC;QACF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,EAAE,CAAC,8BAA8B,OAAO,UAAU,EAAE;gBAClD,MAAM,aAAa,GAAG,cAAc,CAAC,gBAAgB,CAAC,OAAO,EAAE;oBAC7D,EAAE,EAAE,SAAS;oBACb,MAAM,EAAE,cAAc;oBACtB,QAAQ,EAAE,aAAa;oBACvB,SAAS,EAAE,cAAc;oBACzB,QAAQ,EAAE,gBAAgB;oBAC1B,QAAQ,EAAE,gBAAgB;iBAC3B,CAAC,CAAC;gBACH,IAAA,aAAM,EAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAClD,IAAA,aAAM,EAAC,aAAa,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;gBAC1C,IAAA,aAAM,EAAC,aAAa,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YAC5C,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rpc-client-specs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-client-specs.d.ts","sourceRoot":"","sources":["../../../../test/unit/rpc/rpc-client-specs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
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 sinon_1 = __importDefault(require("sinon"));
7
+ const helpers_1 = require("../../helpers/helpers");
8
+ const rpc_client_1 = require("../../../lib/rpc/rpc-client");
9
+ const chai_1 = require("chai");
10
+ const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
11
+ (0, chai_1.use)(chai_as_promised_1.default);
12
+ describe('rpc-client', function () {
13
+ this.timeout(helpers_1.MOCHA_TIMEOUT);
14
+ describe('.send', function () {
15
+ it('should send RPC message to device', async function () {
16
+ });
17
+ it('should send RPC message to device and retry if target id not found', async function () {
18
+ const { send } = rpc_client_1.RpcClient.prototype;
19
+ let sendToDeviceCallCount = 0;
20
+ const mockRpcClient = {
21
+ sendToDevice() {
22
+ sendToDeviceCallCount++;
23
+ if (sendToDeviceCallCount === 1) {
24
+ throw new Error('Missing target for given targetId');
25
+ }
26
+ else if (sendToDeviceCallCount === 2) {
27
+ return 'success';
28
+ }
29
+ },
30
+ waitForTarget() { }
31
+ };
32
+ const sendToDeviceSpy = sinon_1.default.spy(mockRpcClient, 'sendToDevice');
33
+ const waitForTargetSpy = sinon_1.default.spy(mockRpcClient, 'waitForTarget');
34
+ const opts = { appIdKey: 'appId', pageIdKey: 'pageKey' };
35
+ const res = await send.call(mockRpcClient, 'command', opts, true);
36
+ (0, chai_1.expect)(res).to.eql('success');
37
+ (0, chai_1.expect)(sendToDeviceSpy.firstCall.args).to.eql(['command', opts, true]);
38
+ (0, chai_1.expect)(sendToDeviceSpy.secondCall.args).to.eql(['command', opts, true]);
39
+ (0, chai_1.expect)(waitForTargetSpy.firstCall.args).to.eql(['appId', 'pageKey']);
40
+ });
41
+ });
42
+ });
43
+ //# sourceMappingURL=rpc-client-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-client-specs.js","sourceRoot":"","sources":["../../../../test/unit/rpc/rpc-client-specs.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,mDAAsD;AACtD,4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CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACvE,IAAA,aAAM,EAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACxE,IAAA,aAAM,EAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils-specs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-specs.d.ts","sourceRoot":"","sources":["../../../test/unit/utils-specs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
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 utils_1 = require("../../lib/utils");
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const helpers_1 = require("../helpers/helpers");
9
+ const chai_1 = require("chai");
10
+ describe('utils', function () {
11
+ this.timeout(helpers_1.MOCHA_TIMEOUT);
12
+ describe('appInfoFromDict', function () {
13
+ it('should return the id and entry for a dict', function () {
14
+ const dict = {
15
+ WIRApplicationIdentifierKey: '42',
16
+ WIRApplicationNameKey: 'App Name',
17
+ WIRApplicationBundleIdentifierKey: 'app.name',
18
+ WIRIsApplicationProxyKey: 'false',
19
+ WIRHostApplicationIdentifierKey: '43'
20
+ };
21
+ const [id, entry] = (0, utils_1.appInfoFromDict)(dict);
22
+ (0, chai_1.expect)(id).to.equal(dict.WIRApplicationIdentifierKey);
23
+ (0, chai_1.expect)(entry.id).to.equal(dict.WIRApplicationIdentifierKey);
24
+ (0, chai_1.expect)(entry.name).to.equal(dict.WIRApplicationNameKey);
25
+ (0, chai_1.expect)(entry.bundleId).to.equal(dict.WIRApplicationBundleIdentifierKey);
26
+ (0, chai_1.expect)(entry.isProxy).to.equal(dict.WIRIsApplicationProxyKey === 'true');
27
+ (0, chai_1.expect)(entry.hostId).to.equal(dict.WIRHostApplicationIdentifierKey);
28
+ });
29
+ });
30
+ describe('pageArrayFromDict', function () {
31
+ const basePageDict = {
32
+ 1: {
33
+ WIRTitleKey: 'Appium/welcome',
34
+ WIRTypeKey: 'WIRTypeWeb',
35
+ WIRURLKey: 'http://127.0.0.1:4723/welcome',
36
+ WIRPageIdentifierKey: 1,
37
+ WIRConnectionIdentifierKey: 'e777f792-c41e-4e5d-8722-68393af663b2'
38
+ }
39
+ };
40
+ it('should return a valid page array', function () {
41
+ const pageArray = (0, utils_1.pageArrayFromDict)(basePageDict);
42
+ (0, chai_1.expect)(pageArray).to.have.length(1);
43
+ });
44
+ it('should return a valid page array with 13.4-style type key', function () {
45
+ const pageDict = lodash_1.default.defaults({
46
+ 2: {
47
+ WIRTypeKey: 'WIRTypeWebPage'
48
+ }
49
+ }, basePageDict);
50
+ const pageArray = (0, utils_1.pageArrayFromDict)(pageDict);
51
+ (0, chai_1.expect)(pageArray).to.have.length(2);
52
+ });
53
+ it('should not count WIRTypeWeb entries', function () {
54
+ const pageDict = lodash_1.default.defaults({
55
+ 2: {
56
+ WIRTypeKey: 'WIRTypeJavaScript'
57
+ }
58
+ }, basePageDict);
59
+ const pageArray = (0, utils_1.pageArrayFromDict)(pageDict);
60
+ (0, chai_1.expect)(pageArray).to.have.length(1);
61
+ });
62
+ });
63
+ describe('checkParams', function () {
64
+ it('should not throw error when not missing parameters', function () {
65
+ (0, utils_1.checkParams)({ one: 'first', two: 'second', three: 'third' });
66
+ });
67
+ it('should throw error when parameter is missing', function () {
68
+ (0, chai_1.expect)(() => (0, utils_1.checkParams)({ one: 'first', two: null, three: 'third' })).to.throw('Missing parameter: two');
69
+ });
70
+ });
71
+ });
72
+ //# sourceMappingURL=utils-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-specs.js","sourceRoot":"","sources":["../../../test/unit/utils-specs.ts"],"names":[],"mappings":";;;;;AAAA,2CAEyB;AACzB,oDAAuB;AACvB,gDAAmD;AACnD,+BAA8B;AAE9B,QAAQ,CAAC,OAAO,EAAE;IAChB,IAAI,CAAC,OAAO,CAAC,uBAAa,CAAC,CAAC;IAE5B,QAAQ,CAAC,iBAAiB,EAAE;QAC1B,EAAE,CAAC,2CAA2C,EAAE;YAC9C,MAAM,IAAI,GAAG;gBACX,2BAA2B,EAAE,IAAI;gBACjC,qBAAqB,EAAE,UAAU;gBACjC,iCAAiC,EAAE,UAAU;gBAC7C,wBAAwB,EAAE,OAAO;gBACjC,+BAA+B,EAAE,IAAI;aACtC,CAAC;YACF,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,CAAC;YAC1C,IAAA,aAAM,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YACtD,IAAA,aAAM,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YAC5D,IAAA,aAAM,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YACxD,IAAA,aAAM,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;YACxE,IAAA,aAAM,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,KAAK,MAAM,CAAC,CAAC;YACzE,IAAA,aAAM,EAAC,KAAK,CAAC,MAAM,CA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