appium-geckodriver 1.3.9 → 1.4.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [1.4.0](https://github.com/appium/appium-geckodriver/compare/v1.3.10...v1.4.0) (2024-09-18)
2
+
3
+ ### Features
4
+
5
+ * Add geckodriver download script ([#122](https://github.com/appium/appium-geckodriver/issues/122)) ([9f3fa7d](https://github.com/appium/appium-geckodriver/commit/9f3fa7dd6722357c4e2e6a1df2920c086b89a22e))
6
+
7
+ ## [1.3.10](https://github.com/appium/appium-geckodriver/compare/v1.3.9...v1.3.10) (2024-08-21)
8
+
9
+ ### Miscellaneous Chores
10
+
11
+ * **deps-dev:** bump webdriverio from 8.40.3 to 9.0.5 ([#121](https://github.com/appium/appium-geckodriver/issues/121)) ([853e924](https://github.com/appium/appium-geckodriver/commit/853e924257706d72f977f83faac7a87235fd9840))
12
+
1
13
  ## [1.3.9](https://github.com/appium/appium-geckodriver/compare/v1.3.8...v1.3.9) (2024-07-29)
2
14
 
3
15
  ### Miscellaneous Chores
package/README.md CHANGED
@@ -19,6 +19,9 @@ Under the hood this driver is a wrapper/proxy over `geckodriver` binary. Check t
19
19
 
20
20
  It is mandatory to have both Firefox browser installed and the geckodriver binary downloaded on the platform where automated tests are going to be executed. Firefox could be downloaded from the [official download site](https://www.mozilla.org/en-GB/firefox/all/) and the driver binary could be retrieved from the GitHub [releases page](https://github.com/mozilla/geckodriver/releases). The binary must be put into one of the folders included to PATH environment variable. On macOS it also might be necessary to run `xattr -cr "<binary_path>"` to avoid [notarization](https://firefox-source-docs.mozilla.org/testing/geckodriver/Notarization.html) issues.
21
21
 
22
+ Since driver version 1.4.0 the geckodriver binary deployment could be automated via the
23
+ [install-geckodriver](#install-geckodriver) driver script.
24
+
22
25
  Then you need to decide where the automated test is going to be executed. Gecko driver supports the following target platforms:
23
26
  - macOS
24
27
  - Windows
@@ -56,6 +59,21 @@ setWindowRect | See https://www.w3.org/TR/webdriver/#capabilities
56
59
  timeouts | See https://www.w3.org/TR/webdriver/#capabilities
57
60
  unhandledPromptBehavior | See https://www.w3.org/TR/webdriver/#capabilities
58
61
 
62
+ ## Scripts
63
+
64
+ ### install-geckodriver
65
+
66
+ This script is used to install the given or latest stable version of Geckodriver server from
67
+ the [GitHub releases](https://github.com/mozilla/geckodriver/release) page.
68
+ Run `appium driver run gecko install-geckodriver <optional_version>`, where `optional_version`
69
+ must be either valid Geckodriver version number or should not be present (the latest stable version is used then).
70
+ By default, the script will download and unpack the binary into `/usr/local/bin/geckodriver`
71
+ on macOS and Linux or into `%LOCALAPPDATA%\Mozilla\geckodriver.exe` on Windows.
72
+ You must also make sure the `%LOCALAPPDATA%\Mozilla` (Windows) or `/usr/local/bin/` (Linux & macOS)
73
+ folder is present in the PATH environment variable before
74
+ starting an actual automation session. The deployment script should also show a warning message if
75
+ it is unable to find the parent folder in the PATH folders list.
76
+
59
77
  ## Example
60
78
 
61
79
  ```python
@@ -1,3 +1,3 @@
1
+ export const log: import("@appium/types").AppiumLogger;
1
2
  export default log;
2
- declare const log: import("@appium/types").AppiumLogger;
3
3
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/logger.js"],"names":[],"mappings":";AAEA,wDAA4C"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/logger.js"],"names":[],"mappings":"AAEA,uDAAmD"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.log = void 0;
3
4
  const support_1 = require("appium/support");
4
- const log = support_1.logger.getLogger('GeckoDriver');
5
- exports.default = log;
5
+ exports.log = support_1.logger.getLogger('GeckoDriver');
6
+ exports.default = exports.log;
6
7
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../lib/logger.js"],"names":[],"mappings":";;AAAA,4CAAwC;AAExC,MAAM,GAAG,GAAG,gBAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AAE5C,kBAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../lib/logger.js"],"names":[],"mappings":";;;AAAA,4CAAwC;AAE3B,QAAA,GAAG,GAAG,gBAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AAEnD,kBAAe,WAAG,CAAC"}
@@ -2,4 +2,33 @@ export function formatCapsForServer(caps: any): {
2
2
  browserName: string;
3
3
  platformName: any;
4
4
  };
5
+ /**
6
+ *
7
+ * @param {string} srcUrl
8
+ * @param {string} dstPath
9
+ * @returns {Promise<void>}
10
+ */
11
+ export function downloadToFile(srcUrl: string, dstPath: string): Promise<void>;
12
+ /**
13
+ *
14
+ * @param {string} p
15
+ * @returns {Promise<void>}
16
+ */
17
+ export function mkdirp(p: string): Promise<void>;
18
+ /**
19
+ *
20
+ * @param {string} srcAcrhive
21
+ * @param {string} fileToExtract
22
+ * @param {string} dstPath
23
+ * @returns {Promise<void>}
24
+ */
25
+ export function extractFileFromTarGz(srcAcrhive: string, fileToExtract: string, dstPath: string): Promise<void>;
26
+ /**
27
+ *
28
+ * @param {string} srcAcrhive
29
+ * @param {string} fileToExtract
30
+ * @param {string} dstPath
31
+ * @returns {Promise<void>}
32
+ */
33
+ export function extractFileFromZip(srcAcrhive: string, fileToExtract: string, dstPath: string): Promise<void>;
5
34
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":"AAeA;;;EAeC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":"AAoBA;;;EAeC;AAED;;;;;GAKG;AACH,uCAJW,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;AAED;;;;GAIG;AACH,0BAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;AAED;;;;;;GAMG;AACH,iDALW,MAAM,iBACN,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAuCzB;AAED;;;;;;GAMG;AACH,+CALW,MAAM,iBACN,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAqBzB"}
@@ -4,7 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.formatCapsForServer = formatCapsForServer;
7
+ exports.downloadToFile = downloadToFile;
8
+ exports.mkdirp = mkdirp;
9
+ exports.extractFileFromTarGz = extractFileFromTarGz;
10
+ exports.extractFileFromZip = extractFileFromZip;
7
11
  const lodash_1 = __importDefault(require("lodash"));
12
+ const support_1 = require("appium/support");
13
+ const tar_stream_1 = __importDefault(require("tar-stream"));
14
+ const node_zlib_1 = __importDefault(require("node:zlib"));
15
+ const bluebird_1 = __importDefault(require("bluebird"));
16
+ const node_path_1 = __importDefault(require("node:path"));
8
17
  const GECKO_CAP_PREFIXES = ['moz:'];
9
18
  // https://www.w3.org/TR/webdriver/#capabilities
10
19
  const STANDARD_CAPS = [
@@ -33,4 +42,91 @@ function formatCapsForServer(caps) {
33
42
  }
34
43
  return result;
35
44
  }
45
+ /**
46
+ *
47
+ * @param {string} srcUrl
48
+ * @param {string} dstPath
49
+ * @returns {Promise<void>}
50
+ */
51
+ async function downloadToFile(srcUrl, dstPath) {
52
+ await support_1.net.downloadFile(srcUrl, dstPath);
53
+ }
54
+ /**
55
+ *
56
+ * @param {string} p
57
+ * @returns {Promise<void>}
58
+ */
59
+ async function mkdirp(p) {
60
+ await support_1.fs.mkdirp(p);
61
+ }
62
+ /**
63
+ *
64
+ * @param {string} srcAcrhive
65
+ * @param {string} fileToExtract
66
+ * @param {string} dstPath
67
+ * @returns {Promise<void>}
68
+ */
69
+ async function extractFileFromTarGz(srcAcrhive, fileToExtract, dstPath) {
70
+ const chunks = [];
71
+ const extract = tar_stream_1.default.extract();
72
+ const extractPromise = new bluebird_1.default((resolve, reject) => {
73
+ extract.on('entry', (header, stream, next) => {
74
+ if (header.name === fileToExtract) {
75
+ stream.on('data', (chunk) => {
76
+ chunks.push(chunk);
77
+ });
78
+ }
79
+ stream.on('end', function () {
80
+ next();
81
+ });
82
+ stream.resume();
83
+ });
84
+ extract.once('error', reject);
85
+ extract.once('finish', async () => {
86
+ if (chunks.length) {
87
+ try {
88
+ await support_1.fs.writeFile(dstPath, Buffer.concat(chunks));
89
+ }
90
+ catch (e) {
91
+ return reject(e);
92
+ }
93
+ }
94
+ else {
95
+ return reject(new Error(`The file '${fileToExtract}' could not be found in the '${srcAcrhive}' archive`));
96
+ }
97
+ resolve();
98
+ });
99
+ });
100
+ support_1.fs.createReadStream(srcAcrhive)
101
+ .pipe(node_zlib_1.default.createGunzip())
102
+ .pipe(extract);
103
+ await extractPromise;
104
+ }
105
+ /**
106
+ *
107
+ * @param {string} srcAcrhive
108
+ * @param {string} fileToExtract
109
+ * @param {string} dstPath
110
+ * @returns {Promise<void>}
111
+ */
112
+ async function extractFileFromZip(srcAcrhive, fileToExtract, dstPath) {
113
+ let didFindEntry = false;
114
+ await support_1.zip.readEntries(srcAcrhive, async ({ entry, extractEntryTo }) => {
115
+ if (didFindEntry || entry.fileName !== fileToExtract) {
116
+ return;
117
+ }
118
+ didFindEntry = true;
119
+ const tmpRoot = await support_1.tempDir.openDir();
120
+ try {
121
+ await extractEntryTo(tmpRoot);
122
+ await support_1.fs.mv(node_path_1.default.resolve(tmpRoot, entry.fileName), dstPath);
123
+ }
124
+ finally {
125
+ await support_1.fs.rimraf(tmpRoot);
126
+ }
127
+ });
128
+ if (!didFindEntry) {
129
+ throw new Error(`The file '${fileToExtract}' could not be found in the '${srcAcrhive}' archive`);
130
+ }
131
+ }
36
132
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":";;;;;AAgCS,kDAAmB;AAhC5B,oDAAuB;AAEvB,MAAM,kBAAkB,GAAG,CAAC,MAAM,CAAC,CAAC;AACpC,gDAAgD;AAChD,MAAM,aAAa,GAAG;IACpB,gBAAgB;IAChB,cAAc;IACd,qBAAqB;IACrB,kBAAkB;IAClB,OAAO;IACP,eAAe;IACf,UAAU;IACV,yBAAyB;CAC1B,CAAC;AAEF,SAAS,mBAAmB,CAAE,IAAI;IAChC,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC;IACjC,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACjG,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,qDAAqD;QACrD,MAAM,CAAC,YAAY,GAAG,gBAAC,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":";;;;;AAoBA,kDAeC;AAQD,wCAEC;AAOD,wBAEC;AASD,oDAqCC;AASD,gDAmBC;AAhID,oDAAuB;AACvB,4CAAuD;AACvD,4DAA6B;AAC7B,0DAA6B;AAC7B,wDAAyB;AACzB,0DAA6B;AAE7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