appium-webdriveragent 6.0.0 → 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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [6.1.0](https://github.com/appium/WebDriverAgent/compare/v6.0.0...v6.1.0) (2024-02-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add a possibility of starting a test with a deep link ([#845](https://github.com/appium/WebDriverAgent/issues/845)) ([aa25e49](https://github.com/appium/WebDriverAgent/commit/aa25e49fa9821960b08e9f4f3ea5891ebdf7d48d))
7
+
1
8
  ## [6.0.0](https://github.com/appium/WebDriverAgent/compare/v5.15.8...v6.0.0) (2024-01-31)
2
9
 
3
10
 
@@ -136,7 +136,9 @@
136
136
  }
137
137
 
138
138
  NSString *bundleID = capabilities[FB_CAP_BUNDLE_ID];
139
+ NSString *initialUrl = capabilities[FB_CAP_INITIAL_URL];
139
140
  XCUIApplication *app = nil;
141
+ BOOL didOpenInitialUrl = NO;
140
142
  if (bundleID != nil) {
141
143
  app = [[XCUIApplication alloc] initWithBundleIdentifier:bundleID];
142
144
  BOOL forceAppLaunch = YES;
@@ -150,14 +152,47 @@
150
152
  || [capabilities[FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE] boolValue];
151
153
  app.launchArguments = (NSArray<NSString *> *)capabilities[FB_CAP_ARGUMENTS] ?: @[];
152
154
  app.launchEnvironment = (NSDictionary <NSString *, NSString *> *)capabilities[FB_CAP_ENVIRNOMENT] ?: @{};
153
- [app launch];
155
+ if (nil != initialUrl) {
156
+ NSError *openError;
157
+ didOpenInitialUrl = [XCUIDevice.sharedDevice fb_openUrl:initialUrl
158
+ withApplication:bundleID
159
+ error:&openError];
160
+ if (!didOpenInitialUrl) {
161
+ NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@ in %@ application. Original error: %@",
162
+ initialUrl, bundleID, openError.description];
163
+ return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]);
164
+ }
165
+ } else {
166
+ [app launch];
167
+ }
154
168
  if (![app running]) {
155
169
  NSString *errorMsg = [NSString stringWithFormat:@"Cannot launch %@ application. Make sure the correct bundle identifier has been provided in capabilities and check the device log for possible crash report occurrences", bundleID];
156
170
  return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg
157
171
  traceback:nil]);
158
172
  }
159
173
  } else if (appState == XCUIApplicationStateRunningBackground && !forceAppLaunch) {
160
- [app activate];
174
+ if (nil != initialUrl) {
175
+ NSError *openError;
176
+ didOpenInitialUrl = [XCUIDevice.sharedDevice fb_openUrl:initialUrl
177
+ withApplication:bundleID
178
+ error:&openError];
179
+ if (!didOpenInitialUrl) {
180
+ NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@ in %@ application. Original error: %@",
181
+ initialUrl, bundleID, openError.description];
182
+ return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]);
183
+ }
184
+ } else {
185
+ [app activate];
186
+ }
187
+ }
188
+ }
189
+
190
+ if (nil != initialUrl && nil == bundleID) {
191
+ NSError *openError;
192
+ if (![XCUIDevice.sharedDevice fb_openUrl:initialUrl error:&openError]) {
193
+ NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@. Original error: %@",
194
+ initialUrl, openError.description];
195
+ return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]);
161
196
  }
162
197
  }
163
198
 
@@ -9,16 +9,36 @@
9
9
 
10
10
  #import <Foundation/Foundation.h>
11
11
 
12
+ /** Whether to use alternative elements visivility detection method */
12
13
  extern NSString* const FB_CAP_USE_TEST_MANAGER_FOR_VISIBLITY_DETECTION;
14
+ /** Set the maximum amount of charatcers that could be typed within a minute (60 by default) */
13
15
  extern NSString* const FB_CAP_MAX_TYPING_FREQUENCY;
16
+ /** this setting was needed for some legacy stuff */
14
17
  extern NSString* const FB_CAP_USE_SINGLETON_TEST_MANAGER;
18
+ /** Whether to disable screneshots that XCTest automaticallly creates after each step */
15
19
  extern NSString* const FB_CAP_DISABLE_AUTOMATIC_SCREENSHOTS;
20
+ /** Whether to terminate the application under test after the session ends */
16
21
  extern NSString* const FB_CAP_SHOULD_TERMINATE_APP;
22
+ /** The maximum amount of seconds to wait for the event loop to become idle */
17
23
  extern NSString* const FB_CAP_EVENT_LOOP_IDLE_DELAY_SEC;
24
+ /** Bundle identifier of the application to run the test for */
18
25
  extern NSString* const FB_CAP_BUNDLE_ID;
26
+ /**
27
+ Usually an URL used as initial link to run Mobile Safari, but could be any other deep link.
28
+ This might also work together with `FB_CAP_BUNLDE_ID`, which tells XCTest to open
29
+ the given deep link in the particular app.
30
+ Only works since iOS 16.4
31
+ */
32
+ extern NSString* const FB_CAP_INITIAL_URL;
33
+ /** Whether to enforrce (re)start of the application under test on session startup */
19
34
  extern NSString* const FB_CAP_FORCE_APP_LAUNCH;
35
+ /** Whether to wait for quiescence before starting interaction with apps laucnhes in scope of the test session */
20
36
  extern NSString* const FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE;
37
+ /** Array of command line arguments to be passed to the application under test */
21
38
  extern NSString* const FB_CAP_ARGUMENTS;
39
+ /** Dictionary of environment variables to be passed to the application under test */
22
40
  extern NSString* const FB_CAP_ENVIRNOMENT;
41
+ /** Whether to use native XCTest caching strategy */
23
42
  extern NSString* const FB_CAP_USE_NATIVE_CACHING_STRATEGY;
43
+ /** Whether to enforce software keyboard presence on simulator */
24
44
  extern NSString* const FB_CAP_FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE;
@@ -16,6 +16,7 @@ NSString* const FB_CAP_DISABLE_AUTOMATIC_SCREENSHOTS = @"disableAutomaticScreens
16
16
  NSString* const FB_CAP_SHOULD_TERMINATE_APP = @"shouldTerminateApp";
17
17
  NSString* const FB_CAP_EVENT_LOOP_IDLE_DELAY_SEC = @"eventloopIdleDelaySec";
18
18
  NSString* const FB_CAP_BUNDLE_ID = @"bundleId";
19
+ NSString* const FB_CAP_INITIAL_URL = @"initialUrl";
19
20
  NSString* const FB_CAP_FORCE_APP_LAUNCH = @"forceAppLaunch";
20
21
  NSString* const FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE = @"shouldWaitForQuiescence";
21
22
  NSString* const FB_CAP_ARGUMENTS = @"arguments";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -8,9 +8,8 @@
8
8
  "dev": "npm run build -- --watch",
9
9
  "clean": "npm run build -- --clean",
10
10
  "lint": "eslint .",
11
+ "format": "prettier -w ./lib",
11
12
  "lint:fix": "npm run lint -- --fix",
12
- "precommit-msg": "echo 'Pre-commit checks...' && exit 0",
13
- "precommit-lint": "lint-staged",
14
13
  "prepare": "npm run build",
15
14
  "test": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.js\"",
16
15
  "e2e-test": "mocha --exit --timeout 10m \"./test/functional/**/*-specs.js\"",
@@ -23,20 +22,11 @@
23
22
  "node": ">=14",
24
23
  "npm": ">=8"
25
24
  },
26
- "lint-staged": {
27
- "*.js": [
28
- "eslint --fix"
29
- ]
30
- },
31
25
  "prettier": {
32
26
  "bracketSpacing": false,
33
27
  "printWidth": 100,
34
28
  "singleQuote": true
35
29
  },
36
- "pre-commit": [
37
- "precommit-msg",
38
- "precommit-lint"
39
- ],
40
30
  "repository": {
41
31
  "type": "git",
42
32
  "url": "git+https://github.com/appium/WebDriverAgent.git"
@@ -83,9 +73,7 @@
83
73
  "eslint-plugin-import": "^2.28.0",
84
74
  "eslint-plugin-mocha": "^10.1.0",
85
75
  "eslint-plugin-promise": "^6.1.1",
86
- "lint-staged": "^15.0.2",
87
76
  "mocha": "^10.0.0",
88
- "pre-commit": "^1.2.2",
89
77
  "prettier": "^3.0.0",
90
78
  "semantic-release": "^23.0.0",
91
79
  "sinon": "^17.0.0",