Skip to content

Commit

Permalink
Merge pull request #57 from appium/master
Browse files Browse the repository at this point in the history
Fork Sync: Update from parent repository
  • Loading branch information
github-actions[bot] authored Feb 11, 2024
2 parents 25c8978 + ed06d2f commit 821bdf8
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 16 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [6.1.0](https://github.com/appium/WebDriverAgent/compare/v6.0.0...v6.1.0) (2024-02-10)


### Features

* 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))

## [6.0.0](https://github.com/appium/WebDriverAgent/compare/v5.15.8...v6.0.0) (2024-01-31)


Expand Down
39 changes: 37 additions & 2 deletions WebDriverAgentLib/Commands/FBSessionCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ + (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;
Expand All @@ -150,14 +152,47 @@ + (NSArray *)routes
|| [capabilities[FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE] boolValue];
app.launchArguments = (NSArray<NSString *> *)capabilities[FB_CAP_ARGUMENTS] ?: @[];
app.launchEnvironment = (NSDictionary <NSString *, NSString *> *)capabilities[FB_CAP_ENVIRNOMENT] ?: @{};
[app launch];
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: %@",
initialUrl, bundleID, openError.description];
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]);
}
} else {
[app launch];
}
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]);
}
} else if (appState == XCUIApplicationStateRunningBackground && !forceAppLaunch) {
[app activate];
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: %@",
initialUrl, bundleID, openError.description];
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]);
}
} else {
[app activate];
}
}
}

if (nil != initialUrl && nil == bundleID) {
NSError *openError;
if (![XCUIDevice.sharedDevice fb_openUrl:initialUrl error:&openError]) {
NSString *errorMsg = [NSString stringWithFormat:@"Cannot open the URL %@. Original error: %@",
initialUrl, openError.description];
return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg traceback:nil]);
}
}

Expand Down
20 changes: 20 additions & 0 deletions WebDriverAgentLib/Utilities/FBCapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,36 @@

#import <Foundation/Foundation.h>

/** Whether to use alternative elements visivility detection method */
extern NSString* const FB_CAP_USE_TEST_MANAGER_FOR_VISIBLITY_DETECTION;
/** Set the maximum amount of charatcers that could be typed within a minute (60 by default) */
extern NSString* const FB_CAP_MAX_TYPING_FREQUENCY;
/** this setting was needed for some legacy stuff */
extern NSString* const FB_CAP_USE_SINGLETON_TEST_MANAGER;
/** Whether to disable screneshots that XCTest automaticallly creates after each step */
extern NSString* const FB_CAP_DISABLE_AUTOMATIC_SCREENSHOTS;
/** Whether to terminate the application under test after the session ends */
extern NSString* const FB_CAP_SHOULD_TERMINATE_APP;
/** The maximum amount of seconds to wait for the event loop to become idle */
extern NSString* const FB_CAP_EVENT_LOOP_IDLE_DELAY_SEC;
/** Bundle identifier of the application to run the test for */
extern NSString* const FB_CAP_BUNDLE_ID;
/**
Usually an URL used as initial link to run Mobile Safari, but could be any other deep link.
This might also work together with `FB_CAP_BUNLDE_ID`, which tells XCTest to open
the given deep link in the particular app.
Only works since iOS 16.4
*/
extern NSString* const FB_CAP_INITIAL_URL;
/** Whether to enforrce (re)start of the application under test on session startup */
extern NSString* const FB_CAP_FORCE_APP_LAUNCH;
/** Whether to wait for quiescence before starting interaction with apps laucnhes in scope of the test session */
extern NSString* const FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE;
/** Array of command line arguments to be passed to the application under test */
extern NSString* const FB_CAP_ARGUMENTS;
/** Dictionary of environment variables to be passed to the application under test */
extern NSString* const FB_CAP_ENVIRNOMENT;
/** Whether to use native XCTest caching strategy */
extern NSString* const FB_CAP_USE_NATIVE_CACHING_STRATEGY;
/** Whether to enforce software keyboard presence on simulator */
extern NSString* const FB_CAP_FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE;
1 change: 1 addition & 0 deletions WebDriverAgentLib/Utilities/FBCapabilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
NSString* const FB_CAP_SHOULD_TERMINATE_APP = @"shouldTerminateApp";
NSString* const FB_CAP_EVENT_LOOP_IDLE_DELAY_SEC = @"eventloopIdleDelaySec";
NSString* const FB_CAP_BUNDLE_ID = @"bundleId";
NSString* const FB_CAP_INITIAL_URL = @"initialUrl";
NSString* const FB_CAP_FORCE_APP_LAUNCH = @"forceAppLaunch";
NSString* const FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE = @"shouldWaitForQuiescence";
NSString* const FB_CAP_ARGUMENTS = @"arguments";
Expand Down
16 changes: 2 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"name": "appium-webdriveragent",
"version": "6.0.0",
"version": "6.1.0",
"description": "Package bundling WebDriverAgent",
"main": "./build/index.js",
"scripts": {
"build": "tsc -b",
"dev": "npm run build -- --watch",
"clean": "npm run build -- --clean",
"lint": "eslint .",
"format": "prettier -w ./lib",
"lint:fix": "npm run lint -- --fix",
"precommit-msg": "echo 'Pre-commit checks...' && exit 0",
"precommit-lint": "lint-staged",
"prepare": "npm run build",
"test": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.js\"",
"e2e-test": "mocha --exit --timeout 10m \"./test/functional/**/*-specs.js\"",
Expand All @@ -23,20 +22,11 @@
"node": ">=14",
"npm": ">=8"
},
"lint-staged": {
"*.js": [
"eslint --fix"
]
},
"prettier": {
"bracketSpacing": false,
"printWidth": 100,
"singleQuote": true
},
"pre-commit": [
"precommit-msg",
"precommit-lint"
],
"repository": {
"type": "git",
"url": "git+https://github.com/appium/WebDriverAgent.git"
Expand Down Expand Up @@ -83,9 +73,7 @@
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-promise": "^6.1.1",
"lint-staged": "^15.0.2",
"mocha": "^10.0.0",
"pre-commit": "^1.2.2",
"prettier": "^3.0.0",
"semantic-release": "^23.0.0",
"sinon": "^17.0.0",
Expand Down

0 comments on commit 821bdf8

Please sign in to comment.