diff --git a/CHANGELOG.md b/CHANGELOG.md index e41776692..ae9968eeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [6.1.1](https://github.com/appium/WebDriverAgent/compare/v6.1.0...v6.1.1) (2024-02-11) + + +### Miscellaneous Chores + +* 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)) + ## [6.1.0](https://github.com/appium/WebDriverAgent/compare/v6.0.0...v6.1.0) (2024-02-10) diff --git a/WebDriverAgentLib/Commands/FBSessionCommands.m b/WebDriverAgentLib/Commands/FBSessionCommands.m index fe82a0a35..9594058a9 100644 --- a/WebDriverAgentLib/Commands/FBSessionCommands.m +++ b/WebDriverAgentLib/Commands/FBSessionCommands.m @@ -138,7 +138,6 @@ + (NSArray *)routes NSString *bundleID = capabilities[FB_CAP_BUNDLE_ID]; NSString *initialUrl = capabilities[FB_CAP_INITIAL_URL]; XCUIApplication *app = nil; - BOOL didOpenInitialUrl = NO; if (bundleID != nil) { app = [[XCUIApplication alloc] initWithBundleIdentifier:bundleID]; BOOL forceAppLaunch = YES; @@ -153,19 +152,21 @@ + (NSArray *)routes app.launchArguments = (NSArray *)capabilities[FB_CAP_ARGUMENTS] ?: @[]; app.launchEnvironment = (NSDictionary *)capabilities[FB_CAP_ENVIRNOMENT] ?: @{}; if (nil != initialUrl) { + if (app.running) { + [app terminate]; + } NSError *openError; - didOpenInitialUrl = [XCUIDevice.sharedDevice fb_openUrl:initialUrl - withApplication:bundleID - error:&openError]; - if (!didOpenInitialUrl) { - NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@ in %@ application. Original error: %@", + if (![XCUIDevice.sharedDevice fb_openUrl:initialUrl + withApplication:bundleID + error:&openError]) { + NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@ wuth the %@ application. Original error: %@", initialUrl, bundleID, openError.description]; return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]); } } else { [app launch]; } - if (![app running]) { + if (!app.running) { 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]; return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]); @@ -173,11 +174,10 @@ + (NSArray *)routes } else if (appState == XCUIApplicationStateRunningBackground && !forceAppLaunch) { if (nil != initialUrl) { NSError *openError; - didOpenInitialUrl = [XCUIDevice.sharedDevice fb_openUrl:initialUrl - withApplication:bundleID - error:&openError]; - if (!didOpenInitialUrl) { - NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@ in %@ application. Original error: %@", + if (![XCUIDevice.sharedDevice fb_openUrl:initialUrl + withApplication:bundleID + error:&openError]) { + NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@ with the %@ application. Original error: %@", initialUrl, bundleID, openError.description]; return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]); } diff --git a/package.json b/package.json index 175c61b1a..c4f3cda47 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "6.1.0", + "version": "6.1.1", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": {