From ca6e36f63dc4decde08e53b2b976689a0178e0ce Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Sat, 24 Oct 2020 22:04:05 +0200 Subject: [PATCH] chore: bump WDA (#1246) --- README.md | 1 + lib/desired-caps.js | 3 +++ lib/driver.js | 40 ++++++++++++---------------------------- package.json | 4 ++-- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 13f2b1efe..a96171a56 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ Differences are noted here: |`usePrebuiltWDA`|Skips the build phase of running the WDA app. Building is then the responsibility of the user. Only works for Xcode 8+. Defaults to `false`.|e.g., `true`| |`useCarthageSsl`|Use SSL to download dependencies for `WebDriverAgent`. Defaults to `true`| `true`, `false` | |`shouldUseSingletonTestManager`|Use default proxy for test management within `WebDriverAgent`. Setting this to `false` sometimes helps with socket hangup problems. Defaults to `true`.|e.g., `false`| +|`waitForIdleTimeout`|The amount of time in float seconds to wait until the application under test is idling. XCTest requires the app's main thread to be idling in order to execute any action on it, so WDA might not even start/freeze if the app under test is constantly hogging the main thread. The default value is `10` (seconds). Setting it to zero disables idling checks completely (not recommended) and has the same effect as setting `waitForQuiescence` to `false`. Available since Appium 1.19.1. | |`useXctestrunFile`|Use Xctestrun file to launch WDA. It will search for such file in `bootstrapPath`. Expected name of file is `WebDriverAgentRunner_iphoneos-arm64.xctestrun` for real device and `WebDriverAgentRunner_iphonesimulator-x86_64.xctestrun` for simulator. One can do `build-for-testing` for `WebDriverAgent` project for simulator and real device and then you will see [Product Folder like this](docs/useXctestrunFile.png) and you need to copy content of this folder at `bootstrapPath` location. Since this capability expects that you have already built `WDA` project, it neither checks whether you have necessary dependencies to build `WDA` nor will it try to build project. Defaults to `false`. _Tips: `Xcodebuild` builds for the target platform version. We'd recommend you to build with minimal OS version which you'd like to run as the original WDA module. e.g. If you build WDA for 12.2, the module cannot run on iOS 11.4 because of loading some module error on simulator. A module built with 11.4 can work on iOS 12.2. (This is xcodebuild's expected behaviour.)_ |e.g., `true`| |`useSimpleBuildTest`| Build with `build` and run test with `test` in xcodebuild for all Xcode version if this is `true`, or build with `build-for-testing` and run tests with `test-without-building` for over Xcode 8 if this is `false`. Defaults to `false`. | `true` or `false` | |`wdaEventloopIdleDelay`|Delays the invocation of `-[XCUIApplicationProcess setEventLoopHasIdled:]` by the number of seconds specified with this capability. This can help quiescence apps that fail to do so for no obvious reason (and creating a session fails for that reason). This increases the time for session creation because `-[XCUIApplicationProcess setEventLoopHasIdled:]` is called multiple times. If you enable this capability start with at least `3` seconds and try increasing it, if creating the session still fails. Defaults to `0`. |e.g. `5`| diff --git a/lib/desired-caps.js b/lib/desired-caps.js index 8158ec219..8ffc37c7c 100644 --- a/lib/desired-caps.js +++ b/lib/desired-caps.js @@ -229,6 +229,9 @@ let desiredCapConstraints = _.defaults({ }, allowProvisioningDeviceRegistration: { isBoolean: true + }, + waitForIdleTimeout: { + isNumber: true } }, iosDesiredCapConstraints); diff --git a/lib/driver.js b/lib/driver.js index 93325baa2..a73c3fb2f 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -917,34 +917,21 @@ class XCUITestDriver extends BaseDriver { } async startWdaSession (bundleId, processArguments) { - let args = processArguments ? (processArguments.args || []) : []; + const args = processArguments ? (processArguments.args || []) : []; if (!_.isArray(args)) { throw new Error(`processArguments.args capability is expected to be an array. ` + - `${JSON.stringify(args)} is given instead`); + `${JSON.stringify(args)} is given instead`); } - let env = processArguments ? (processArguments.env || {}) : {}; + const env = processArguments ? (processArguments.env || {}) : {}; if (!_.isPlainObject(env)) { throw new Error(`processArguments.env capability is expected to be a dictionary. ` + - `${JSON.stringify(env)} is given instead`); + `${JSON.stringify(env)} is given instead`); } - let shouldWaitForQuiescence = util.hasValue(this.opts.waitForQuiescence) ? this.opts.waitForQuiescence : true; - let maxTypingFrequency = util.hasValue(this.opts.maxTypingFrequency) ? this.opts.maxTypingFrequency : 60; - let shouldUseSingletonTestManager = util.hasValue(this.opts.shouldUseSingletonTestManager) ? this.opts.shouldUseSingletonTestManager : true; - let shouldUseTestManagerForVisibilityDetection = false; - let eventloopIdleDelaySec = this.opts.wdaEventloopIdleDelay || 0; - if (util.hasValue(this.opts.simpleIsVisibleCheck)) { - shouldUseTestManagerForVisibilityDetection = this.opts.simpleIsVisibleCheck; - } - if (util.compareVersions(this.opts.platformVersion, '==', '9.3')) { - log.info(`Forcing shouldUseSingletonTestManager capability value to true, because of known XCTest issues under 9.3 platform version`); - shouldUseTestManagerForVisibilityDetection = true; - } if (util.hasValue(this.opts.language)) { args.push('-AppleLanguages', `(${this.opts.language})`); args.push('-NSLanguages', `(${this.opts.language})`); } - if (util.hasValue(this.opts.locale)) { args.push('-AppleLocale', this.opts.locale); } @@ -953,18 +940,15 @@ class XCUITestDriver extends BaseDriver { bundleId: this.opts.autoLaunch === false ? undefined : bundleId, arguments: args, environment: env, - eventloopIdleDelaySec, - shouldWaitForQuiescence, - shouldUseTestManagerForVisibilityDetection, - maxTypingFrequency, - shouldUseSingletonTestManager, + eventloopIdleDelaySec: this.opts.wdaEventloopIdleDelay ?? 0, + shouldWaitForQuiescence: this.opts.waitForQuiescence ?? true, + shouldUseTestManagerForVisibilityDetection: this.opts.simpleIsVisibleCheck ?? false, + maxTypingFrequency: this.opts.maxTypingFrequency ?? 60, + shouldUseSingletonTestManager: this.opts.shouldUseSingletonTestManager ?? true, + waitForIdleTimeout: this.opts.waitForIdleTimeout, + shouldUseCompactResponses: this.opts.shouldUseCompactResponses, + elementResponseFields: this.opts.elementResponseFields, }; - if (util.hasValue(this.opts.shouldUseCompactResponses)) { - wdaCaps.shouldUseCompactResponses = this.opts.shouldUseCompactResponses; - } - if (util.hasValue(this.opts.elementResponseFields)) { - wdaCaps.elementResponseFields = this.opts.elementResponseFields; - } if (this.opts.autoAcceptAlerts) { wdaCaps.defaultAlertAction = 'accept'; } else if (this.opts.autoDismissAlerts) { diff --git a/package.json b/package.json index 27fa26dc2..d2fe50457 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "appium-ios-simulator": "^3.25.1", "appium-remote-debugger": "^8.13.0", "appium-support": "^2.47.1", - "appium-webdriveragent": "^2.26.1", + "appium-webdriveragent": "^2.28.1", "appium-xcode": "^3.8.0", "async-lock": "^1.0.0", "asyncbox": "^2.3.1", @@ -108,7 +108,7 @@ "gulp": "^4.0.0", "ios-test-app": "^3.0.0", "ios-uicatalog": "^3.5.0", - "mocha": "^8.0.1", + "mocha": "~8.1.3", "mocha-junit-reporter": "^2.0.0", "mocha-multi-reporters": "^1.1.7", "pem": "^1.8.3",