appium-webdriveragent 6.1.0 → 6.1.1

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.1](https://github.com/appium/WebDriverAgent/compare/v6.1.0...v6.1.1) (2024-02-11)
2
+
3
+
4
+ ### Miscellaneous Chores
5
+
6
+ * Make sure the app under test is restarted if opened from a deep link ([#846](https://github.com/appium/WebDriverAgent/issues/846)) ([88b0a5b](https://github.com/appium/WebDriverAgent/commit/88b0a5b0f8aefa05a7dc28d17faf62c229e0706f))
7
+
1
8
  ## [6.1.0](https://github.com/appium/WebDriverAgent/compare/v6.0.0...v6.1.0) (2024-02-10)
2
9
 
3
10
 
@@ -138,7 +138,6 @@
138
138
  NSString *bundleID = capabilities[FB_CAP_BUNDLE_ID];
139
139
  NSString *initialUrl = capabilities[FB_CAP_INITIAL_URL];
140
140
  XCUIApplication *app = nil;
141
- BOOL didOpenInitialUrl = NO;
142
141
  if (bundleID != nil) {
143
142
  app = [[XCUIApplication alloc] initWithBundleIdentifier:bundleID];
144
143
  BOOL forceAppLaunch = YES;
@@ -153,19 +152,21 @@
153
152
  app.launchArguments = (NSArray<NSString *> *)capabilities[FB_CAP_ARGUMENTS] ?: @[];
154
153
  app.launchEnvironment = (NSDictionary <NSString *, NSString *> *)capabilities[FB_CAP_ENVIRNOMENT] ?: @{};
155
154
  if (nil != initialUrl) {
155
+ if (app.running) {
156
+ [app terminate];
157
+ }
156
158
  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: %@",
159
+ if (![XCUIDevice.sharedDevice fb_openUrl:initialUrl
160
+ withApplication:bundleID
161
+ error:&openError]) {
162
+ NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@ wuth the %@ application. Original error: %@",
162
163
  initialUrl, bundleID, openError.description];
163
164
  return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]);
164
165
  }
165
166
  } else {
166
167
  [app launch];
167
168
  }
168
- if (![app running]) {
169
+ if (!app.running) {
169
170
  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];
170
171
  return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg
171
172
  traceback:nil]);
@@ -173,11 +174,10 @@
173
174
  } else if (appState == XCUIApplicationStateRunningBackground && !forceAppLaunch) {
174
175
  if (nil != initialUrl) {
175
176
  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: %@",
177
+ if (![XCUIDevice.sharedDevice fb_openUrl:initialUrl
178
+ withApplication:bundleID
179
+ error:&openError]) {
180
+ NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@ with the %@ application. Original error: %@",
181
181
  initialUrl, bundleID, openError.description];
182
182
  return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]);
183
183
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "6.1.0",
3
+ "version": "6.1.1",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {