@appium/fake-driver 6.0.2 → 6.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.
Files changed (112) hide show
  1. package/LICENSE +201 -0
  2. package/build/lib/commands/alert.d.ts +10 -13
  3. package/build/lib/commands/alert.d.ts.map +1 -1
  4. package/build/lib/commands/alert.js +39 -46
  5. package/build/lib/commands/alert.js.map +1 -1
  6. package/build/lib/commands/contexts.d.ts +9 -13
  7. package/build/lib/commands/contexts.d.ts.map +1 -1
  8. package/build/lib/commands/contexts.js +55 -62
  9. package/build/lib/commands/contexts.js.map +1 -1
  10. package/build/lib/commands/element.d.ts +23 -26
  11. package/build/lib/commands/element.d.ts.map +1 -1
  12. package/build/lib/commands/element.js +100 -89
  13. package/build/lib/commands/element.js.map +1 -1
  14. package/build/lib/commands/find.d.ts +14 -17
  15. package/build/lib/commands/find.d.ts.map +1 -1
  16. package/build/lib/commands/find.js +66 -63
  17. package/build/lib/commands/find.js.map +1 -1
  18. package/build/lib/commands/general.d.ts +25 -28
  19. package/build/lib/commands/general.d.ts.map +1 -1
  20. package/build/lib/commands/general.js +90 -75
  21. package/build/lib/commands/general.js.map +1 -1
  22. package/build/lib/desired-caps.d.ts +14 -0
  23. package/build/lib/desired-caps.d.ts.map +1 -0
  24. package/build/lib/desired-caps.js +16 -0
  25. package/build/lib/desired-caps.js.map +1 -0
  26. package/build/lib/doctor/common.d.ts +11 -0
  27. package/build/lib/doctor/common.d.ts.map +1 -0
  28. package/build/lib/doctor/common.js +25 -0
  29. package/build/lib/doctor/common.js.map +1 -0
  30. package/build/lib/doctor/fake1.d.ts +3 -0
  31. package/build/lib/doctor/fake1.d.ts.map +1 -0
  32. package/build/lib/doctor/fake1.js +6 -0
  33. package/build/lib/doctor/fake1.js.map +1 -0
  34. package/build/lib/doctor/fake2.d.ts +3 -0
  35. package/build/lib/doctor/fake2.d.ts.map +1 -0
  36. package/build/lib/doctor/fake2.js +6 -0
  37. package/build/lib/doctor/fake2.js.map +1 -0
  38. package/build/lib/driver.d.ts +128 -156
  39. package/build/lib/driver.d.ts.map +1 -1
  40. package/build/lib/driver.js +146 -154
  41. package/build/lib/driver.js.map +1 -1
  42. package/build/lib/fake-app.d.ts +37 -45
  43. package/build/lib/fake-app.d.ts.map +1 -1
  44. package/build/lib/fake-app.js +57 -34
  45. package/build/lib/fake-app.js.map +1 -1
  46. package/build/lib/fake-driver-schema.d.ts +16 -11
  47. package/build/lib/fake-driver-schema.d.ts.map +1 -1
  48. package/build/lib/fake-driver-schema.js +2 -17
  49. package/build/lib/fake-driver-schema.js.map +1 -1
  50. package/build/lib/fake-element.d.ts +27 -26
  51. package/build/lib/fake-element.d.ts.map +1 -1
  52. package/build/lib/fake-element.js +19 -19
  53. package/build/lib/fake-element.js.map +1 -1
  54. package/build/lib/index.d.ts +2 -3
  55. package/build/lib/index.d.ts.map +1 -1
  56. package/build/lib/index.js +2 -6
  57. package/build/lib/index.js.map +1 -1
  58. package/build/lib/logger.d.ts +1 -2
  59. package/build/lib/logger.d.ts.map +1 -1
  60. package/build/lib/logger.js +2 -2
  61. package/build/lib/logger.js.map +1 -1
  62. package/build/lib/scripts/fake-error.d.ts.map +1 -1
  63. package/build/lib/scripts/fake-error.js.map +1 -1
  64. package/build/lib/scripts/fake-stdin.d.ts.map +1 -1
  65. package/build/lib/scripts/fake-stdin.js.map +1 -1
  66. package/build/lib/scripts/fake-success.d.ts.map +1 -1
  67. package/build/lib/scripts/fake-success.js +3 -6
  68. package/build/lib/scripts/fake-success.js.map +1 -1
  69. package/build/lib/server.d.ts +2 -1
  70. package/build/lib/server.d.ts.map +1 -1
  71. package/build/lib/server.js +3 -5
  72. package/build/lib/server.js.map +1 -1
  73. package/build/lib/types.d.ts +1 -1
  74. package/build/lib/types.d.ts.map +1 -1
  75. package/lib/commands/alert.ts +31 -61
  76. package/lib/commands/contexts.ts +50 -73
  77. package/lib/commands/element.ts +122 -135
  78. package/lib/commands/find.ts +100 -115
  79. package/lib/commands/general.ts +122 -127
  80. package/lib/desired-caps.ts +16 -0
  81. package/lib/doctor/common.ts +26 -0
  82. package/lib/doctor/fake1.ts +3 -0
  83. package/lib/doctor/fake2.ts +3 -0
  84. package/lib/driver.ts +321 -0
  85. package/lib/fake-app.ts +234 -0
  86. package/lib/fake-driver-schema.ts +43 -0
  87. package/lib/fake-element.ts +128 -0
  88. package/lib/{index.js → index.ts} +5 -9
  89. package/lib/logger.ts +3 -0
  90. package/lib/scripts/{fake-success.js → fake-success.ts} +1 -1
  91. package/lib/{server.js → server.ts} +3 -4
  92. package/lib/types.ts +1 -1
  93. package/package.json +9 -12
  94. package/tsconfig.json +2 -1
  95. package/build/lib/commands/index.d.ts +0 -14
  96. package/build/lib/commands/index.d.ts.map +0 -1
  97. package/build/lib/commands/index.js +0 -16
  98. package/build/lib/commands/index.js.map +0 -1
  99. package/build/lib/commands/mixin.d.ts +0 -11
  100. package/build/lib/commands/mixin.d.ts.map +0 -1
  101. package/build/lib/commands/mixin.js +0 -16
  102. package/build/lib/commands/mixin.js.map +0 -1
  103. package/lib/commands/index.ts +0 -14
  104. package/lib/commands/mixin.ts +0 -13
  105. package/lib/driver.js +0 -356
  106. package/lib/fake-app.js +0 -190
  107. package/lib/fake-driver-schema.js +0 -35
  108. package/lib/fake-element.js +0 -117
  109. package/lib/logger.js +0 -5
  110. package/test/fixtures/app.xml +0 -38
  111. /package/lib/scripts/{fake-error.js → fake-error.ts} +0 -0
  112. /package/lib/scripts/{fake-stdin.js → fake-stdin.ts} +0 -0
@@ -1,80 +1,95 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.title = title;
4
+ exports.keys = keys;
5
+ exports.setGeoLocation = setGeoLocation;
6
+ exports.getGeoLocation = getGeoLocation;
7
+ exports.getPageSource = getPageSource;
8
+ exports.getOrientation = getOrientation;
9
+ exports.setOrientation = setOrientation;
10
+ exports.getScreenshot = getScreenshot;
11
+ exports.getWindowSize = getWindowSize;
12
+ exports.getWindowRect = getWindowRect;
13
+ exports.performActions = performActions;
14
+ exports.releaseActions = releaseActions;
15
+ exports.getLog = getLog;
16
+ exports.mobileShake = mobileShake;
17
+ exports.doubleClick = doubleClick;
18
+ exports.execute = execute;
19
+ exports.fakeAddition = fakeAddition;
20
+ exports.getUrl = getUrl;
21
+ exports.bidiNavigate = bidiNavigate;
3
22
  const driver_1 = require("appium/driver");
4
- const mixin_1 = require("./mixin");
5
23
  const ORIENTATIONS = new Set(['LANDSCAPE', 'PORTRAIT']);
6
- const GeneralMixin = {
7
- async title() {
8
- this.assertWebviewContext();
9
- return this.appModel.title;
10
- },
11
- async keys(value) {
12
- if (!this.focusedElId) {
13
- throw new driver_1.errors.InvalidElementStateError();
14
- }
15
- await this.setValue(value, this.focusedElId);
16
- },
17
- async setGeoLocation(location) {
18
- // TODO test this adequately once WD bug is fixed
19
- this.appModel.lat = location.latitude;
20
- this.appModel.long = location.longitude;
21
- return location;
22
- },
23
- async getGeoLocation() {
24
- return this.appModel.currentGeoLocation;
25
- },
26
- async getPageSource() {
27
- return this.appModel.rawXml;
28
- },
29
- async getOrientation() {
30
- return this.appModel.orientation;
31
- },
32
- async setOrientation(o) {
33
- if (!ORIENTATIONS.has(o)) {
34
- throw new driver_1.errors.UnknownError('Orientation must be LANDSCAPE or PORTRAIT');
35
- }
36
- this.appModel.orientation = o;
37
- },
38
- async getScreenshot() {
39
- return this.appModel.getScreenshot();
40
- },
41
- async getWindowSize() {
42
- return { width: this.appModel.width, height: this.appModel.height };
43
- },
44
- async getWindowRect() {
45
- return { width: this.appModel.width, height: this.appModel.height, x: 0, y: 0 };
46
- },
47
- async performActions(actions) {
48
- this.appModel.actionLog.push(actions);
49
- },
50
- async releaseActions() { },
51
- async getLog(type) {
52
- switch (type) {
53
- case 'actions':
54
- return this.appModel.actionLog;
55
- default:
56
- throw new Error(`Don't understand log type '${type}'`);
57
- }
58
- },
59
- async mobileShake() {
60
- this.shook = true;
61
- },
62
- async doubleClick() { },
63
- async execute(script, args) {
64
- return await this.executeMethod(script, args);
65
- },
66
- /**
67
- * Add two or maybe even three numbers
68
- */
69
- async fakeAddition(num1, num2, num3 = 0) {
70
- return num1 + num2 + (num3 ?? 0);
71
- },
72
- async getUrl() {
73
- return this.url;
74
- },
75
- async bidiNavigate(context, url) {
76
- this.url = url;
77
- },
78
- };
79
- (0, mixin_1.mixin)(GeneralMixin);
24
+ /** Requires webview context (title comes from active document). */
25
+ async function title() {
26
+ this.assertWebviewContext();
27
+ return this.appModel.title;
28
+ }
29
+ async function keys(value) {
30
+ if (!this.focusedElId) {
31
+ throw new driver_1.errors.InvalidElementStateError();
32
+ }
33
+ await this.setValue(value, this.focusedElId);
34
+ }
35
+ async function setGeoLocation(location) {
36
+ this.appModel.lat = location.latitude;
37
+ this.appModel.long = location.longitude;
38
+ return location;
39
+ }
40
+ async function getGeoLocation() {
41
+ return this.appModel.currentGeoLocation;
42
+ }
43
+ async function getPageSource() {
44
+ return this.appModel.rawXml;
45
+ }
46
+ async function getOrientation() {
47
+ return this.appModel.orientation;
48
+ }
49
+ async function setOrientation(o) {
50
+ if (!ORIENTATIONS.has(o)) {
51
+ throw new driver_1.errors.UnknownError('Orientation must be LANDSCAPE or PORTRAIT');
52
+ }
53
+ this.appModel.orientation = o;
54
+ }
55
+ async function getScreenshot() {
56
+ return this.appModel.getScreenshot();
57
+ }
58
+ async function getWindowSize() {
59
+ return { width: this.appModel.width, height: this.appModel.height };
60
+ }
61
+ async function getWindowRect() {
62
+ return { width: this.appModel.width, height: this.appModel.height, x: 0, y: 0 };
63
+ }
64
+ async function performActions(actions) {
65
+ this.appModel.actionLog.push(actions);
66
+ }
67
+ async function releaseActions() { }
68
+ /** Supported log types: 'actions'. TODO: add more log types if needed for tests. */
69
+ async function getLog(type) {
70
+ switch (type) {
71
+ case 'actions':
72
+ return this.appModel.actionLog;
73
+ default:
74
+ throw new Error(`Don't understand log type '${type}'`);
75
+ }
76
+ }
77
+ async function mobileShake() {
78
+ this.shook = true;
79
+ }
80
+ async function doubleClick() { }
81
+ async function execute(script, args) {
82
+ return await this.executeMethod(script, args);
83
+ }
84
+ async function fakeAddition(num1, num2, num3 = 0) {
85
+ return num1 + num2 + (num3 ?? 0);
86
+ }
87
+ /** Get current URL. Returns empty string until bidiNavigate (or equivalent) sets one. @see https://w3c.github.io/webdriver/#get-current-url */
88
+ async function getUrl() {
89
+ return this.url ?? '';
90
+ }
91
+ /** Set current URL (used by Bidi browsingContext.navigate). */
92
+ async function bidiNavigate(context, url) {
93
+ this.url = url;
94
+ }
80
95
  //# sourceMappingURL=general.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/commands/general.ts"],"names":[],"mappings":";;AACA,0CAAqC;AAErC,mCAA8B;AAG9B,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AA6BxD,MAAM,YAAY,GAA2B;IAC3C,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,IAAI,CAAmB,KAAwB;QACnD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,eAAM,CAAC,wBAAwB,EAAE,CAAC;QAC9C,CAAC;QACD,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,cAAc,CAAmB,QAAkB;QACvD,iDAAiD;QACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC;QACxC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,I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AAC;AACjB,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const desiredCapConstraints: {
2
+ readonly app: {
3
+ readonly presence: true;
4
+ readonly isString: true;
5
+ };
6
+ readonly uniqueApp: {
7
+ readonly isBoolean: true;
8
+ };
9
+ readonly runClock: {
10
+ readonly isBoolean: true;
11
+ };
12
+ };
13
+ export type FakeDriverConstraints = typeof desiredCapConstraints;
14
+ //# sourceMappingURL=desired-caps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"desired-caps.d.ts","sourceRoot":"","sources":["../../lib/desired-caps.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;;;;;;;;;;;CAWF,CAAC;AAEjC,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.desiredCapConstraints = void 0;
4
+ exports.desiredCapConstraints = {
5
+ app: {
6
+ presence: true,
7
+ isString: true,
8
+ },
9
+ uniqueApp: {
10
+ isBoolean: true,
11
+ },
12
+ runClock: {
13
+ isBoolean: true,
14
+ },
15
+ };
16
+ //# sourceMappingURL=desired-caps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"desired-caps.js","sourceRoot":"","sources":["../../lib/desired-caps.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAG;IACnC,GAAG,EAAE;QACH,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,SAAS,EAAE,IAAI;KAChB;IACD,QAAQ,EAAE;QACR,SAAS,EAAE,IAAI;KAChB;CAC6B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { IDoctorCheck, AppiumLogger, DoctorCheckResult } from '@appium/types';
2
+ export declare class EnvVarAndPathCheck implements IDoctorCheck {
3
+ private readonly varName;
4
+ log: AppiumLogger;
5
+ constructor(varName: string);
6
+ diagnose(): Promise<DoctorCheckResult>;
7
+ fix(): Promise<string>;
8
+ hasAutofix(): boolean;
9
+ isOptional(): boolean;
10
+ }
11
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../lib/doctor/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAEjF,qBAAa,kBAAmB,YAAW,YAAY;IAGzC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,GAAG,EAAG,YAAY,CAAC;gBAEU,OAAO,EAAE,MAAM;IAEtC,QAAQ,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAMtC,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;IAI5B,UAAU,IAAI,OAAO;IAIrB,UAAU,IAAI,OAAO;CAGtB"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvVarAndPathCheck = void 0;
4
+ const support_1 = require("appium/support");
5
+ class EnvVarAndPathCheck {
6
+ varName;
7
+ log;
8
+ constructor(varName) {
9
+ this.varName = varName;
10
+ }
11
+ async diagnose() {
12
+ return support_1.doctor.ok(`${this.varName} environment variable is always set because it's fake`);
13
+ }
14
+ async fix() {
15
+ return `Make sure the environment variable ${this.varName} is properly configured for the Appium server process`;
16
+ }
17
+ hasAutofix() {
18
+ return false;
19
+ }
20
+ isOptional() {
21
+ return false;
22
+ }
23
+ }
24
+ exports.EnvVarAndPathCheck = EnvVarAndPathCheck;
25
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../lib/doctor/common.ts"],"names":[],"mappings":";;;AAAA,4CAAsC;AAGtC,MAAa,kBAAkB;IAGA;IAF7B,GAAG,CAAgB;IAEnB,YAA6B,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAEhD,KAAK,CAAC,QAAQ;QACZ,OAAO,gBAAM,CAAC,EAAE,CACd,GAAG,IAAI,CAAC,OAAO,uDAAuD,CACvE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG;QACP,OAAO,sCAAsC,IAAI,CAAC,OAAO,uDAAuD,CAAC;IACnH,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAtBD,gDAsBC"}
@@ -0,0 +1,3 @@
1
+ import { EnvVarAndPathCheck } from './common';
2
+ export declare const fakeCheck1: EnvVarAndPathCheck;
3
+ //# sourceMappingURL=fake1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake1.d.ts","sourceRoot":"","sources":["../../../lib/doctor/fake1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,UAAU,oBAAkC,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fakeCheck1 = void 0;
4
+ const common_1 = require("./common");
5
+ exports.fakeCheck1 = new common_1.EnvVarAndPathCheck('FAKE1');
6
+ //# sourceMappingURL=fake1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake1.js","sourceRoot":"","sources":["../../../lib/doctor/fake1.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAE/B,QAAA,UAAU,GAAG,IAAI,2BAAkB,CAAC,OAAO,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { EnvVarAndPathCheck } from './common';
2
+ export declare const fakeCheck2: EnvVarAndPathCheck;
3
+ //# sourceMappingURL=fake2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake2.d.ts","sourceRoot":"","sources":["../../../lib/doctor/fake2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,UAAU,oBAAkC,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fakeCheck2 = void 0;
4
+ const common_1 = require("./common");
5
+ exports.fakeCheck2 = new common_1.EnvVarAndPathCheck('FAKE2');
6
+ //# sourceMappingURL=fake2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake2.js","sourceRoot":"","sources":["../../../lib/doctor/fake2.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAE/B,QAAA,UAAU,GAAG,IAAI,2BAAkB,CAAC,OAAO,CAAC,CAAC"}
@@ -1,40 +1,132 @@
1
- declare const FakeDriver_base: typeof BaseDriver;
2
- declare const FakeDriver_base_1: typeof BaseDriver;
3
- declare const FakeDriver_base_2: typeof BaseDriver;
4
- declare const FakeDriver_base_3: typeof BaseDriver;
5
- declare const FakeDriver_base_4: typeof BaseDriver;
6
- /**
7
- * Constraints for {@linkcode FakeDriver}'s capabilities
8
- * @typedef {typeof FAKE_DRIVER_CONSTRAINTS} FakeDriverConstraints
9
- */
10
- /**
11
- * @template [Thing=any]
12
- * @extends {BaseDriver<FakeDriverConstraints>}
13
- * @implements {ExternalDriver<FakeDriverConstraints>}
14
- */
15
- export class FakeDriver<Thing = any> extends BaseDriver<{
16
- readonly app: {
17
- readonly presence: true;
18
- readonly isString: true;
19
- };
20
- readonly uniqueApp: {
21
- readonly isBoolean: true;
22
- };
23
- readonly runClock: {
24
- readonly isBoolean: true;
25
- };
26
- }, import("@appium/types").StringRecord, import("@appium/types").StringRecord, import("@appium/types").DefaultCreateSessionResult<{
27
- readonly app: {
28
- readonly presence: true;
29
- readonly isString: true;
1
+ import type { Express, Request, Response } from 'express';
2
+ import type { Server as HttpServer } from 'node:http';
3
+ import { BaseDriver } from 'appium/driver';
4
+ import type { DriverData, InitialOpts } from '@appium/types';
5
+ import type { FakeDriverConstraints } from './desired-caps';
6
+ import type { FakeDriverCaps, W3CFakeDriverCaps } from './types';
7
+ import { FakeApp } from './fake-app';
8
+ import type { FakeElement } from './fake-element';
9
+ import * as alertCommands from './commands/alert';
10
+ import * as contextsCommands from './commands/contexts';
11
+ import * as elementCommands from './commands/element';
12
+ import * as findCommands from './commands/find';
13
+ import * as generalCommands from './commands/general';
14
+ export type { FakeDriverConstraints };
15
+ export type { Orientation } from '@appium/types';
16
+ /** Driver supporting a generic "fake thing" value (getFakeThing / setFakeThing). */
17
+ export declare class FakeDriver<Thing = unknown> extends BaseDriver<FakeDriverConstraints> {
18
+ readonly desiredCapConstraints: {
19
+ readonly app: {
20
+ readonly presence: true;
21
+ readonly isString: true;
22
+ };
23
+ readonly uniqueApp: {
24
+ readonly isBoolean: true;
25
+ };
26
+ readonly runClock: {
27
+ readonly isBoolean: true;
28
+ };
30
29
  };
31
- readonly uniqueApp: {
32
- readonly isBoolean: true;
30
+ curContext: string;
31
+ readonly appModel: FakeApp;
32
+ _proxyActive: boolean;
33
+ shook: boolean;
34
+ focusedElId: string | null;
35
+ fakeThing: Thing | null;
36
+ /** Next numeric id for new elements; keys in elMap are stringified. */
37
+ maxElId: number;
38
+ /** Map of element id (string) to FakeElement for this session. */
39
+ elMap: Record<string, FakeElement>;
40
+ /** If set, Bidi connections are proxied to this URL instead of handling locally. */
41
+ private _bidiProxyUrl;
42
+ private _clockRunning;
43
+ /** Current document URL; set by bidiNavigate, returned by getUrl. */
44
+ url: string;
45
+ assertNoAlert: typeof alertCommands.assertNoAlert;
46
+ assertAlert: typeof alertCommands.assertAlert;
47
+ getAlertText: typeof alertCommands.getAlertText;
48
+ setAlertText: typeof alertCommands.setAlertText;
49
+ postAcceptAlert: typeof alertCommands.postAcceptAlert;
50
+ postDismissAlert: typeof alertCommands.postDismissAlert;
51
+ getRawContexts: typeof contextsCommands.getRawContexts;
52
+ assertWebviewContext: typeof contextsCommands.assertWebviewContext;
53
+ getCurrentContext: typeof contextsCommands.getCurrentContext;
54
+ getContexts: typeof contextsCommands.getContexts;
55
+ setContext: typeof contextsCommands.setContext;
56
+ setFrame: typeof contextsCommands.setFrame;
57
+ getElements: typeof elementCommands.getElements;
58
+ getElement: typeof elementCommands.getElement;
59
+ getName: typeof elementCommands.getName;
60
+ elementDisplayed: typeof elementCommands.elementDisplayed;
61
+ elementEnabled: typeof elementCommands.elementEnabled;
62
+ elementSelected: typeof elementCommands.elementSelected;
63
+ setValue: typeof elementCommands.setValue;
64
+ getText: typeof elementCommands.getText;
65
+ clear: typeof elementCommands.clear;
66
+ click: typeof elementCommands.click;
67
+ getAttribute: typeof elementCommands.getAttribute;
68
+ getElementRect: typeof elementCommands.getElementRect;
69
+ getSize: typeof elementCommands.getSize;
70
+ equalsElement: typeof elementCommands.equalsElement;
71
+ getCssProperty: typeof elementCommands.getCssProperty;
72
+ getLocation: typeof elementCommands.getLocation;
73
+ getLocationInView: typeof elementCommands.getLocationInView;
74
+ getExistingElementForNode: typeof findCommands.getExistingElementForNode;
75
+ wrapNewEl: typeof findCommands.wrapNewEl;
76
+ findElOrEls: {
77
+ <Ctx = unknown>(this: FakeDriver, strategy: string, selector: string, mult: true, context?: Ctx): Promise<import("@appium/types").Element[]>;
78
+ <Ctx = unknown>(this: FakeDriver, strategy: string, selector: string, mult: false, context?: Ctx): Promise<import("@appium/types").Element>;
33
79
  };
34
- readonly runClock: {
35
- readonly isBoolean: true;
80
+ findElement: typeof findCommands.findElement;
81
+ findElements: typeof findCommands.findElements;
82
+ findElementFromElement: typeof findCommands.findElementFromElement;
83
+ findElementsFromElement: typeof findCommands.findElementsFromElement;
84
+ title: typeof generalCommands.title;
85
+ keys: typeof generalCommands.keys;
86
+ setGeoLocation: typeof generalCommands.setGeoLocation;
87
+ getGeoLocation: typeof generalCommands.getGeoLocation;
88
+ getPageSource: typeof generalCommands.getPageSource;
89
+ getOrientation: typeof generalCommands.getOrientation;
90
+ setOrientation: typeof generalCommands.setOrientation;
91
+ getScreenshot: typeof generalCommands.getScreenshot;
92
+ getWindowSize: typeof generalCommands.getWindowSize;
93
+ getWindowRect: typeof generalCommands.getWindowRect;
94
+ performActions: typeof generalCommands.performActions;
95
+ releaseActions: typeof generalCommands.releaseActions;
96
+ getLog: typeof generalCommands.getLog;
97
+ mobileShake: typeof generalCommands.mobileShake;
98
+ doubleClick: typeof generalCommands.doubleClick;
99
+ execute: typeof generalCommands.execute;
100
+ fakeAddition: typeof generalCommands.fakeAddition;
101
+ getUrl: typeof generalCommands.getUrl;
102
+ bidiNavigate: typeof generalCommands.bidiNavigate;
103
+ constructor(opts?: InitialOpts, shouldValidateCaps?: boolean);
104
+ proxyActive(): boolean;
105
+ canProxy(): boolean;
106
+ get bidiProxyUrl(): string | null;
107
+ proxyReqRes(req: Request, res: Response): void;
108
+ proxyCommand<T = unknown>(): Promise<T>;
109
+ /**
110
+ * Create session and load fake app XML from caps.app.
111
+ * Starts clock event emitter if caps.runClock is true.
112
+ */
113
+ createSession(w3cCapabilities1: W3CFakeDriverCaps, w3cCapabilities2?: W3CFakeDriverCaps, w3cCapabilities3?: W3CFakeDriverCaps, driverData?: DriverData[]): Promise<[string, FakeDriverCaps]>;
114
+ deleteSession(sessionId?: string): Promise<void>;
115
+ getWindowHandle(): Promise<string>;
116
+ getWindowHandles(): Promise<string[]>;
117
+ get driverData(): {
118
+ isUnique: boolean;
36
119
  };
37
- }>, void, import("@appium/types").StringRecord>, FakeDriver_base, FakeDriver_base_1, FakeDriver_base_2, FakeDriver_base_3, FakeDriver_base_4 implements ExternalDriver<FakeDriverConstraints> {
120
+ getFakeThing(): Promise<Thing | null>;
121
+ setFakeThing(thing: Thing): Promise<null>;
122
+ getFakeDriverArgs(): Promise<typeof this.cliArgs>;
123
+ /** TODO: track deprecated commands when called and return their names. */
124
+ getDeprecatedCommandsCalled(): Promise<string[]>;
125
+ callDeprecatedCommand(): Promise<void>;
126
+ doSomeMath(num1: number, num2: number): Promise<number>;
127
+ doSomeMath2(num1: number, num2: number): Promise<number>;
128
+ private startClock;
129
+ private stopClock;
38
130
  static newBidiCommands: {
39
131
  readonly 'appium:fake': {
40
132
  readonly getFakeThing: {
@@ -65,9 +157,6 @@ export class FakeDriver<Thing = any> extends BaseDriver<{
65
157
  readonly GET: {
66
158
  readonly command: "getFakeThing";
67
159
  };
68
- /**
69
- * Sets a fake thing
70
- */
71
160
  readonly POST: {
72
161
  readonly command: "setFakeThing";
73
162
  readonly payloadParams: {
@@ -100,9 +189,6 @@ export class FakeDriver<Thing = any> extends BaseDriver<{
100
189
  readonly optional: readonly ["num3"];
101
190
  };
102
191
  };
103
- /**
104
- * Gets a thing (a fake thing)
105
- */
106
192
  readonly 'fake: getThing': {
107
193
  readonly command: "getFakeThing";
108
194
  };
@@ -116,121 +202,7 @@ export class FakeDriver<Thing = any> extends BaseDriver<{
116
202
  readonly command: "getDeprecatedCommandsCalled";
117
203
  };
118
204
  };
119
- static fakeRoute(req: any, res: any): void;
120
- static updateServer(expressApp: any, httpServer: any, cliArgs: any): Promise<void>;
121
- constructor(opts?: import("@appium/types").InitialOpts, shouldValidateCaps?: boolean);
122
- /**
123
- * @type {FakeDriverConstraints}
124
- * @readonly
125
- */
126
- readonly desiredCapConstraints: FakeDriverConstraints;
127
- /** @type {string} */
128
- curContext: string;
129
- /** @type {FakeApp} */
130
- appModel: FakeApp;
131
- /** @type {boolean} */
132
- _proxyActive: boolean;
133
- /** @type {boolean} */
134
- shook: boolean;
135
- /** @type {string?} */
136
- focusedElId: string | null;
137
- /** @type {Thing?} */
138
- fakeThing: Thing | null;
139
- /** @type {number} */
140
- maxElId: number;
141
- /** @type {Record<string,import('./fake-element').FakeElement>} */
142
- elMap: Record<string, import("./fake-element").FakeElement>;
143
- /** @type {string|null} */
144
- _bidiProxyUrl: string | null;
145
- /** @type {boolean} */
146
- _clockRunning: boolean;
147
- proxyActive(): boolean;
148
- canProxy(): boolean;
149
- proxyReqRes(req: any, res: any): void;
150
- /**
151
- * @template [T=any]
152
- * @returns {Promise<T>}
153
- */
154
- proxyCommand<T = any>(): Promise<T>;
155
- /**
156
- * @param {string} [sessionId]
157
- * @returns {Promise<void>}
158
- */
159
- deleteSession(sessionId?: string): Promise<void>;
160
- /**
161
- * @returns {Promise<string>}
162
- */
163
- getWindowHandle(): Promise<string>;
164
- /**
165
- * @returns {Promise<string[]>}
166
- */
167
- getWindowHandles(): Promise<string[]>;
168
- get driverData(): {
169
- isUnique: boolean;
170
- };
171
- getFakeThing(): Promise<Thing | null>;
172
- startClock(): Promise<void>;
173
- stopClock(): void;
174
- /**
175
- * Set the 'thing' value (so that it can be retrieved later)
176
- *
177
- * @param {Thing} thing
178
- * @returns {Promise<null>}
179
- */
180
- setFakeThing(thing: Thing): Promise<null>;
181
- /**
182
- * Get the driver args that were sent in via the CLI
183
- *
184
- * @returns {Promise<typeof this.cliArgs>}
185
- */
186
- getFakeDriverArgs(): Promise<typeof this.cliArgs>;
187
- /**
188
- * This is a command that will return a list of deprecated command names called
189
- *
190
- * @returns {Promise<string[]>}
191
- */
192
- getDeprecatedCommandsCalled(): Promise<string[]>;
193
- /**
194
- * This is a command that exists just to be an example of a deprecated command
195
- *
196
- * @returns {Promise<void>}
197
- */
198
- callDeprecatedCommand(): Promise<void>;
199
- /**
200
- * @param {number} num1
201
- * @param {number} num2
202
- */
203
- doSomeMath(num1: number, num2: number): Promise<number>;
204
- /**
205
- * @param {number} num1
206
- * @param {number} num2
207
- */
208
- doSomeMath2(num1: number, num2: number): Promise<number>;
209
- }
210
- export default FakeDriver;
211
- /**
212
- * Constraints for {@linkcode FakeDriver}'s capabilities
213
- */
214
- export type FakeDriverConstraints = typeof FAKE_DRIVER_CONSTRAINTS;
215
- export type FakeDriverCaps = import("./types").FakeDriverCaps;
216
- export type W3CFakeDriverCaps = import("./types").W3CFakeDriverCaps;
217
- export type Element = import("@appium/types").Element;
218
- export type DriverClass<D extends import("@appium/types").Driver> = import("@appium/types").DriverClass<D>;
219
- export type ExternalDriver<C extends import("@appium/types").Constraints> = import("@appium/types").ExternalDriver<C>;
220
- export type Orientation = import("@appium/types").Orientation;
221
- import { BaseDriver } from 'appium/driver';
222
- import { FakeApp } from './fake-app';
223
- declare namespace FAKE_DRIVER_CONSTRAINTS {
224
- namespace app {
225
- let presence: true;
226
- let isString: true;
227
- }
228
- namespace uniqueApp {
229
- let isBoolean: true;
230
- }
231
- namespace runClock {
232
- let isBoolean_1: true;
233
- export { isBoolean_1 as isBoolean };
234
- }
205
+ static fakeRoute(req: Request, res: Response): void;
206
+ static updateServer(expressApp: Express, httpServer: HttpServer, cliArgs: Record<string, unknown>): Promise<void>;
235
207
  }
236
208
  //# sourceMappingURL=driver.d.ts.map