appium-webdriveragent 4.10.21 → 4.10.23

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,17 @@
1
+ ## [4.10.23](https://github.com/appium/WebDriverAgent/compare/v4.10.22...v4.10.23) (2023-02-05)
2
+
3
+
4
+ ### Miscellaneous Chores
5
+
6
+ * bundle:tv for tvOS ([#657](https://github.com/appium/WebDriverAgent/issues/657)) ([9d2d047](https://github.com/appium/WebDriverAgent/commit/9d2d047fba57a33787c66a1e8a8449b9538c67be))
7
+
8
+ ## [4.10.22](https://github.com/appium/WebDriverAgent/compare/v4.10.21...v4.10.22) (2023-01-30)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Pull defaultAdditionalRequestParameters dynamically ([#658](https://github.com/appium/WebDriverAgent/issues/658)) ([d7c397b](https://github.com/appium/WebDriverAgent/commit/d7c397b0260a71568edd6d99ecf7b39ca3503083))
14
+
1
15
  ## [4.10.21](https://github.com/appium/WebDriverAgent/compare/v4.10.20...v4.10.21) (2023-01-26)
2
16
 
3
17
 
package/README.md CHANGED
@@ -33,7 +33,10 @@ If you are having some issues please checkout [wiki](https://github.com/facebook
33
33
  If you want to help us out, you are more than welcome to. However please make sure you have followed the guidelines in [CONTRIBUTING](CONTRIBUTING.md).
34
34
 
35
35
  ## Creating Bundles
36
- Follow [this doc](docs/CREATING_BUNDLES.md)
36
+
37
+ `npm run bundle`
38
+
39
+ Then, you find `WebDriverAgentRunner-Runner-sim-<version>.zip` for iOS and `WebDriverAgentRunner-Runner-tv_sim-<version>.zip` for tvOS files in the current directory.
37
40
 
38
41
  ## License
39
42
 
@@ -10,7 +10,25 @@ const DERIVED_DATA_PATH = `${ROOT_DIR}/wdaBuild`;
10
10
  const WDA_BUNDLE = 'WebDriverAgentRunner-Runner.app';
11
11
  const WDA_BUNDLE_PATH = path.join(DERIVED_DATA_PATH, 'Build', 'Products', 'Debug-iphonesimulator');
12
12
 
13
+ const WDA_BUNDLE_TV = 'WebDriverAgentRunner_tvOS-Runner.app';
14
+ const WDA_BUNDLE_TV_PATH = path.join(DERIVED_DATA_PATH, 'Build', 'Products', 'Debug-appletvsimulator');
15
+
16
+ const TARGETS = ['runner', 'tv_runner'];
17
+ const SDKS = ['sim', 'tv_sim'];
18
+
13
19
  async function buildWebDriverAgent (xcodeVersion) {
20
+ const target = process.env.TARGET;
21
+ const sdk = process.env.SDK;
22
+
23
+ if (!TARGETS.includes(target)) {
24
+ throw Error(`Please set TARGETS environment variable from the supported targets ${JSON.stringify(TARGETS)}`);
25
+ }
26
+
27
+ if (!SDKS.includes(sdk)) {
28
+ throw Error(`Please set SDK environment variable from the supported SDKs ${JSON.stringify(SDKS)}`);
29
+ }
30
+
31
+
14
32
  LOG.info(`Cleaning ${DERIVED_DATA_PATH} if exists`);
15
33
  try {
16
34
  await exec('xcodebuild', ['clean', '-derivedDataPath', DERIVED_DATA_PATH, '-scheme', 'WebDriverAgentRunner'], {
@@ -25,7 +43,7 @@ async function buildWebDriverAgent (xcodeVersion) {
25
43
  // Clean and build
26
44
  try {
27
45
  await exec('/bin/bash', ['./Scripts/build.sh'], {
28
- env: {TARGET: 'runner', SDK: 'sim', DERIVED_DATA_PATH},
46
+ env: {TARGET: target, SDK: sdk, DERIVED_DATA_PATH},
29
47
  cwd: ROOT_DIR
30
48
  });
31
49
  } catch (e) {
@@ -34,14 +52,18 @@ async function buildWebDriverAgent (xcodeVersion) {
34
52
  throw e;
35
53
  }
36
54
 
37
- const zipName = `WebDriverAgentRunner-Runner-Sim-${xcodeVersion}.zip`;
38
- LOG.info(`Creating ${zipName} which includes ${WDA_BUNDLE}`);
55
+ const isTv = target === 'tv_runner';
56
+ const bundle = isTv ? WDA_BUNDLE_TV : WDA_BUNDLE;
57
+ const bundle_path = isTv ? WDA_BUNDLE_TV_PATH : WDA_BUNDLE_PATH;
58
+
59
+ const zipName = `WebDriverAgentRunner-Runner-${sdk}-${xcodeVersion}.zip`;
60
+ LOG.info(`Creating ${zipName} which includes ${bundle}`);
39
61
  const appBundleZipPath = path.join(ROOT_DIR, zipName);
40
62
  await fs.rimraf(appBundleZipPath);
41
63
  LOG.info(`Created './${zipName}'`);
42
64
  try {
43
- await exec('xattr', ['-cr', WDA_BUNDLE], {cwd: WDA_BUNDLE_PATH});
44
- await exec('zip', ['-qr', appBundleZipPath, WDA_BUNDLE], {cwd: WDA_BUNDLE_PATH});
65
+ await exec('xattr', ['-cr', bundle], {cwd: bundle_path});
66
+ await exec('zip', ['-qr', appBundleZipPath, bundle], {cwd: bundle_path});
45
67
  } catch (e) {
46
68
  LOG.error(`===FAILED TO ZIP ARCHIVE`);
47
69
  LOG.error(e.stderr);
@@ -45,26 +45,18 @@ static id swizzledDefaultParameters(id self, SEL _cmd)
45
45
  {
46
46
  static dispatch_once_t onceToken;
47
47
  dispatch_once(&onceToken, ^{
48
- NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:original_defaultParameters(self, _cmd)];
49
- [params addEntriesFromDictionary:defaultAdditionalRequestParameters];
50
- defaultRequestParameters = params.copy;
48
+ defaultRequestParameters = original_defaultParameters(self, _cmd);
51
49
  });
52
- if (nil == defaultRequestParameters) {
53
- return original_defaultParameters(self, _cmd);
54
- }
55
50
  NSMutableDictionary *result = [NSMutableDictionary dictionaryWithDictionary:defaultRequestParameters];
56
- if (nil != customRequestParameters && customRequestParameters.count > 0) {
57
- [result addEntriesFromDictionary:customRequestParameters];
58
- }
51
+ [result addEntriesFromDictionary:defaultAdditionalRequestParameters ?: @{}];
52
+ [result addEntriesFromDictionary:customRequestParameters ?: @{}];
59
53
  return result.copy;
60
54
  }
61
55
 
62
56
  static id swizzledSnapshotParameters(id self, SEL _cmd)
63
57
  {
64
58
  NSDictionary *result = original_snapshotParameters(self, _cmd);
65
- if (nil == defaultAdditionalRequestParameters) {
66
- defaultAdditionalRequestParameters = result;
67
- }
59
+ defaultAdditionalRequestParameters = result;
68
60
  return result;
69
61
  }
70
62
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "4.10.21",
3
+ "version": "4.10.23",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -13,7 +13,9 @@
13
13
  "prepare": "npm run build",
14
14
  "test": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.js\"",
15
15
  "e2e-test": "mocha --exit --timeout 10m \"./test/functional/**/*-specs.js\"",
16
- "bundle": "node ./Scripts/build-webdriveragent.js",
16
+ "bundle": "npm run bundle:ios && npm run bundle:tv",
17
+ "bundle:ios": "TARGET=runner SDK=sim node ./Scripts/build-webdriveragent.js",
18
+ "bundle:tv": "TARGET=tv_runner SDK=tv_sim node ./Scripts/build-webdriveragent.js",
17
19
  "fetch-prebuilt-wda": "node ./Scripts/fetch-prebuilt-wda.js"
18
20
  },
19
21
  "engines": {