From 1af64b8834371a3fdb3d0aab82fdfdeff6194555 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Sep 2023 10:21:40 -0700 Subject: [PATCH 01/71] chore(deps-dev): bump @types/teen_process from 2.0.0 to 2.0.1 (#765) Bumps [@types/teen_process](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/teen_process) from 2.0.0 to 2.0.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/teen_process) --- updated-dependencies: - dependency-name: "@types/teen_process" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a1c2045ac..4b3a65883 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@types/node": "^20.4.7", "@types/sinon": "^10.0.16", "@types/sinon-chai": "^3.2.9", - "@types/teen_process": "2.0.0", + "@types/teen_process": "2.0.1", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "appium-xcode": "^5.0.0", From 10ac5a5ec473c33e4e21791161e3686aa241e3a2 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 14 Sep 2023 17:29:44 +0000 Subject: [PATCH 02/71] chore(release): 5.8.4 [skip ci] ## [5.8.4](https://github.com/appium/WebDriverAgent/compare/v5.8.3...v5.8.4) (2023-09-14) ### Miscellaneous Chores * **deps-dev:** bump @types/teen_process from 2.0.0 to 2.0.1 ([#765](https://github.com/appium/WebDriverAgent/issues/765)) ([1af64b8](https://github.com/appium/WebDriverAgent/commit/1af64b8834371a3fdb3d0aab82fdfdeff6194555)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 311f82c73..57efb91e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.8.4](https://github.com/appium/WebDriverAgent/compare/v5.8.3...v5.8.4) (2023-09-14) + + +### Miscellaneous Chores + +* **deps-dev:** bump @types/teen_process from 2.0.0 to 2.0.1 ([#765](https://github.com/appium/WebDriverAgent/issues/765)) ([1af64b8](https://github.com/appium/WebDriverAgent/commit/1af64b8834371a3fdb3d0aab82fdfdeff6194555)) + ## [5.8.3](https://github.com/appium/WebDriverAgent/compare/v5.8.2...v5.8.3) (2023-09-01) diff --git a/package.json b/package.json index 4b3a65883..052bfd598 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.8.3", + "version": "5.8.4", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 2ffd187b2e8b3c1ed04537320179bdfe9f9635df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Sep 2023 09:38:13 -0700 Subject: [PATCH 03/71] chore(deps-dev): bump sinon from 15.2.0 to 16.0.0 (#766) Bumps [sinon](https://github.com/sinonjs/sinon) from 15.2.0 to 16.0.0. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md) - [Commits](https://github.com/sinonjs/sinon/compare/v15.2.0...v16.0.0) --- updated-dependencies: - dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 052bfd598..2c9cf024a 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "pre-commit": "^1.2.2", "prettier": "^3.0.0", "semantic-release": "^21.1.0", - "sinon": "^15.0.0", + "sinon": "^16.0.0", "ts-node": "^10.9.1", "typescript": "^5.1.6" }, From 224cfbbb0a3cf6c2f6a593a5c60fb8dd424f5fe5 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 15 Sep 2023 16:45:31 +0000 Subject: [PATCH 04/71] chore(release): 5.8.5 [skip ci] ## [5.8.5](https://github.com/appium/WebDriverAgent/compare/v5.8.4...v5.8.5) (2023-09-15) ### Miscellaneous Chores * **deps-dev:** bump sinon from 15.2.0 to 16.0.0 ([#766](https://github.com/appium/WebDriverAgent/issues/766)) ([2ffd187](https://github.com/appium/WebDriverAgent/commit/2ffd187b2e8b3c1ed04537320179bdfe9f9635df)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57efb91e0..dba290295 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.8.5](https://github.com/appium/WebDriverAgent/compare/v5.8.4...v5.8.5) (2023-09-15) + + +### Miscellaneous Chores + +* **deps-dev:** bump sinon from 15.2.0 to 16.0.0 ([#766](https://github.com/appium/WebDriverAgent/issues/766)) ([2ffd187](https://github.com/appium/WebDriverAgent/commit/2ffd187b2e8b3c1ed04537320179bdfe9f9635df)) + ## [5.8.4](https://github.com/appium/WebDriverAgent/compare/v5.8.3...v5.8.4) (2023-09-14) diff --git a/package.json b/package.json index 2c9cf024a..b8dd1fcd9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.8.4", + "version": "5.8.5", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 3ec962842f121bb6dbfc28ab1b30f69d0adc0123 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Tue, 19 Sep 2023 04:07:47 -0400 Subject: [PATCH 05/71] ci: use Xcode 14.3 to build WDA (#770) * ci: use Xcode 14.3 to build WDA * use the same one in release --- .github/workflows/publish.js.yml | 4 ++-- .github/workflows/wda-package.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.js.yml b/.github/workflows/publish.js.yml index 6d1915ca7..6cd3a0276 100644 --- a/.github/workflows/publish.js.yml +++ b/.github/workflows/publish.js.yml @@ -10,10 +10,10 @@ on: jobs: build: - runs-on: macos-12 + runs-on: macos-13 env: - XCODE_VERSION: 14.2 + XCODE_VERSION: 14.3.1 ZIP_PKG_NAME_IOS: "WebDriverAgentRunner-Runner.zip" PKG_PATH_IOS: "appium_wda_ios" ZIP_PKG_NAME_TVOS: "WebDriverAgentRunner_tvOS-Runner.zip" diff --git a/.github/workflows/wda-package.yml b/.github/workflows/wda-package.yml index d544e927e..b4b4223f2 100644 --- a/.github/workflows/wda-package.yml +++ b/.github/workflows/wda-package.yml @@ -8,8 +8,8 @@ on: - completed env: - HOST: macos-12 - XCODE_VERSION: 14.2 + HOST: macos-13 + XCODE_VERSION: 14.3.1 DESTINATION_SIM: platform=iOS Simulator,name=iPhone 14 Pro DESTINATION_SIM_tvOS: platform=tvOS Simulator,name=Apple TV From 012af21383829397c7265daa0513829cc4e93aee Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 21 Sep 2023 16:38:50 -0700 Subject: [PATCH 06/71] chore: add log to leave it in the system log (#772) --- WebDriverAgentLib/Commands/FBSessionCommands.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WebDriverAgentLib/Commands/FBSessionCommands.m b/WebDriverAgentLib/Commands/FBSessionCommands.m index 565939080..17153b8b5 100644 --- a/WebDriverAgentLib/Commands/FBSessionCommands.m +++ b/WebDriverAgentLib/Commands/FBSessionCommands.m @@ -421,6 +421,8 @@ + (NSDictionary *)sessionInformation + (NSDictionary *)currentCapabilities { FBApplication *application = [FBSession activeSession].activeApplication; + // to log the info in the system + [FBLogger logFmt:@"Current active application bundle id is %@", application.bundleID]; return @{ @"device": ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ? @"ipad" : @"iphone", From 49c135c7ee19336e68c4dca70e4e9eb0e1b2f56f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 21 Sep 2023 23:45:14 +0000 Subject: [PATCH 07/71] chore(release): 5.8.6 [skip ci] ## [5.8.6](https://github.com/appium/WebDriverAgent/compare/v5.8.5...v5.8.6) (2023-09-21) ### Miscellaneous Chores * add log to leave it in the system log ([#772](https://github.com/appium/WebDriverAgent/issues/772)) ([012af21](https://github.com/appium/WebDriverAgent/commit/012af21383829397c7265daa0513829cc4e93aee)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dba290295..12bb43640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.8.6](https://github.com/appium/WebDriverAgent/compare/v5.8.5...v5.8.6) (2023-09-21) + + +### Miscellaneous Chores + +* add log to leave it in the system log ([#772](https://github.com/appium/WebDriverAgent/issues/772)) ([012af21](https://github.com/appium/WebDriverAgent/commit/012af21383829397c7265daa0513829cc4e93aee)) + ## [5.8.5](https://github.com/appium/WebDriverAgent/compare/v5.8.4...v5.8.5) (2023-09-15) diff --git a/package.json b/package.json index b8dd1fcd9..fb268bf9e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.8.5", + "version": "5.8.6", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 8481b02fc84de1147e1254ea7fd114f8735b0226 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 21 Sep 2023 18:36:57 -0700 Subject: [PATCH 08/71] chore: tweak device in currentCapabilities (#773) * chore: tweak device * chore: tweak * keep lower case * Update FBSessionCommands.m --- .../Commands/FBSessionCommands.m | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/WebDriverAgentLib/Commands/FBSessionCommands.m b/WebDriverAgentLib/Commands/FBSessionCommands.m index 17153b8b5..7d8d3e077 100644 --- a/WebDriverAgentLib/Commands/FBSessionCommands.m +++ b/WebDriverAgentLib/Commands/FBSessionCommands.m @@ -257,7 +257,8 @@ + (NSArray *)routes #endif @"ip" : [XCUIDevice sharedDevice].fb_wifiIPAddress ?: [NSNull null] }, - @"build" : buildInfo.copy + @"build" : buildInfo.copy, + @"device": [self.class deviceNameByUserInterfaceIdiom:[UIDevice currentDevice].userInterfaceIdiom] } ); } @@ -418,6 +419,23 @@ + (NSDictionary *)sessionInformation }; } +/* + Return the device kind as lower case +*/ ++ (NSString *)deviceNameByUserInterfaceIdiom:(UIUserInterfaceIdiom) userInterfaceIdiom +{ + if (userInterfaceIdiom == UIUserInterfaceIdiomPad) { + return @"ipad"; + } else if (userInterfaceIdiom == UIUserInterfaceIdiomTV) { + return @"apple tv"; + } else if (userInterfaceIdiom == UIUserInterfaceIdiomPhone) { + return @"iphone"; + } + // CarPlay, Mac, Vision UI or unknown are possible + return @"Unknown"; + +} + + (NSDictionary *)currentCapabilities { FBApplication *application = [FBSession activeSession].activeApplication; @@ -425,7 +443,7 @@ + (NSDictionary *)currentCapabilities [FBLogger logFmt:@"Current active application bundle id is %@", application.bundleID]; return @{ - @"device": ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ? @"ipad" : @"iphone", + @"device": [self.class deviceNameByUserInterfaceIdiom:[UIDevice currentDevice].userInterfaceIdiom], @"sdkVersion": [[UIDevice currentDevice] systemVersion], @"browserName": application.label ?: [NSNull null], @"CFBundleIdentifier": application.bundleID ?: [NSNull null], From 5d2bd5fe4228cfa624f8700619879b62012ceca8 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 22 Sep 2023 01:42:06 +0000 Subject: [PATCH 09/71] chore(release): 5.8.7 [skip ci] ## [5.8.7](https://github.com/appium/WebDriverAgent/compare/v5.8.6...v5.8.7) (2023-09-22) ### Miscellaneous Chores * tweak device in currentCapabilities ([#773](https://github.com/appium/WebDriverAgent/issues/773)) ([8481b02](https://github.com/appium/WebDriverAgent/commit/8481b02fc84de1147e1254ea7fd114f8735b0226)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12bb43640..946a76c6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.8.7](https://github.com/appium/WebDriverAgent/compare/v5.8.6...v5.8.7) (2023-09-22) + + +### Miscellaneous Chores + +* tweak device in currentCapabilities ([#773](https://github.com/appium/WebDriverAgent/issues/773)) ([8481b02](https://github.com/appium/WebDriverAgent/commit/8481b02fc84de1147e1254ea7fd114f8735b0226)) + ## [5.8.6](https://github.com/appium/WebDriverAgent/compare/v5.8.5...v5.8.6) (2023-09-21) diff --git a/package.json b/package.json index fb268bf9e..177169744 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.8.6", + "version": "5.8.7", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 2784ce440f8b5ab9710db08d9ffda704697ac07c Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 22 Sep 2023 11:18:11 -0700 Subject: [PATCH 10/71] feat: do not get active process information in a new session request (#774) * fix: improve new session creation performance * Update FBSessionCommands.m --- WebDriverAgentLib/Commands/FBSessionCommands.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/WebDriverAgentLib/Commands/FBSessionCommands.m b/WebDriverAgentLib/Commands/FBSessionCommands.m index 7d8d3e077..7bd87a768 100644 --- a/WebDriverAgentLib/Commands/FBSessionCommands.m +++ b/WebDriverAgentLib/Commands/FBSessionCommands.m @@ -410,6 +410,10 @@ + (NSString *)buildTimestamp ]; } +/** + Return current session information. + This response does not have any active application information. +*/ + (NSDictionary *)sessionInformation { return @@ -438,15 +442,10 @@ + (NSString *)deviceNameByUserInterfaceIdiom:(UIUserInterfaceIdiom) userInterfac + (NSDictionary *)currentCapabilities { - FBApplication *application = [FBSession activeSession].activeApplication; - // to log the info in the system - [FBLogger logFmt:@"Current active application bundle id is %@", application.bundleID]; return @{ @"device": [self.class deviceNameByUserInterfaceIdiom:[UIDevice currentDevice].userInterfaceIdiom], - @"sdkVersion": [[UIDevice currentDevice] systemVersion], - @"browserName": application.label ?: [NSNull null], - @"CFBundleIdentifier": application.bundleID ?: [NSNull null], + @"sdkVersion": [[UIDevice currentDevice] systemVersion] }; } From 40a81ebed7730b510b0eacb20d830687276ffb17 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 22 Sep 2023 18:41:08 +0000 Subject: [PATCH 11/71] chore(release): 5.9.0 [skip ci] ## [5.9.0](https://github.com/appium/WebDriverAgent/compare/v5.8.7...v5.9.0) (2023-09-22) ### Features * do not get active process information in a new session request ([#774](https://github.com/appium/WebDriverAgent/issues/774)) ([2784ce4](https://github.com/appium/WebDriverAgent/commit/2784ce440f8b5ab9710db08d9ffda704697ac07c)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 946a76c6f..aadb3e23c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.9.0](https://github.com/appium/WebDriverAgent/compare/v5.8.7...v5.9.0) (2023-09-22) + + +### Features + +* do not get active process information in a new session request ([#774](https://github.com/appium/WebDriverAgent/issues/774)) ([2784ce4](https://github.com/appium/WebDriverAgent/commit/2784ce440f8b5ab9710db08d9ffda704697ac07c)) + ## [5.8.7](https://github.com/appium/WebDriverAgent/compare/v5.8.6...v5.8.7) (2023-09-22) diff --git a/package.json b/package.json index 177169744..4559104ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.8.7", + "version": "5.9.0", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 51ba527b6cde3773ebcd5323cfa7e0890b2563aa Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Sat, 23 Sep 2023 01:03:00 +0200 Subject: [PATCH 12/71] fix: Provide signing arguments as command line parameters (#779) --- lib/utils.js | 16 ++-------------- lib/xcodebuild.js | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 4a1191600..1474d929f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,4 +1,4 @@ -import { fs, tempDir, plist } from '@appium/support'; +import { fs, plist } from '@appium/support'; import { exec } from 'teen_process'; import path from 'path'; import log from './logger'; @@ -157,18 +157,6 @@ async function setRealDeviceSecurity (keychainPath, keychainPassword) { await exec('security', ['set-keychain-settings', '-t', '3600', '-l', keychainPath]); } -async function generateXcodeConfigFile (orgId, signingId) { - log.debug(`Generating xcode config file for orgId '${orgId}' and signingId ` + - `'${signingId}'`); - const contents = `DEVELOPMENT_TEAM = ${orgId} -CODE_SIGN_IDENTITY = ${signingId} -`; - const xcconfigPath = await tempDir.path('appium-temp.xcconfig'); - log.debug(`Writing xcode config file to ${xcconfigPath}`); - await fs.writeFile(xcconfigPath, contents, 'utf8'); - return xcconfigPath; -} - /** * Information of the device under test * @typedef {Object} DeviceInfo @@ -394,7 +382,7 @@ async function getPIDsListeningOnPort (port, filteringFunc = null) { } export { updateProjectFile, resetProjectFile, setRealDeviceSecurity, - getAdditionalRunContent, getXctestrunFileName, generateXcodeConfigFile, + getAdditionalRunContent, getXctestrunFileName, setXctestrunFile, getXctestrunFilePath, killProcess, randomInt, getWDAUpgradeTimestamp, resetTestProcesses, getPIDsListeningOnPort, killAppUsingPattern, isTvOS diff --git a/lib/xcodebuild.js b/lib/xcodebuild.js index 23f365417..de6b58818 100644 --- a/lib/xcodebuild.js +++ b/lib/xcodebuild.js @@ -4,7 +4,7 @@ import { fs, logger, timing } from '@appium/support'; import defaultLogger from './logger'; import B from 'bluebird'; import { - setRealDeviceSecurity, generateXcodeConfigFile, setXctestrunFile, + setRealDeviceSecurity, setXctestrunFile, updateProjectFile, resetProjectFile, killProcess, getWDAUpgradeTimestamp, isTvOS } from './utils'; import _ from 'lodash'; @@ -238,9 +238,17 @@ class XcodeBuild { 'Will build for the default platform instead'); } - if (this.realDevice && this.xcodeConfigFile) { - this.log.debug(`Using Xcode configuration file: '${this.xcodeConfigFile}'`); - args.push('-xcconfig', this.xcodeConfigFile); + if (this.realDevice) { + if (this.xcodeConfigFile) { + this.log.debug(`Using Xcode configuration file: '${this.xcodeConfigFile}'`); + args.push('-xcconfig', this.xcodeConfigFile); + } + if (this.xcodeOrgId && this.xcodeSigningId) { + args.push( + `DEVELOPMENT_TEAM=${this.xcodeOrgId}`, + `CODE_SIGN_IDENTITY=${this.xcodeSigningId}`, + ); + } } if (!process.env.APPIUM_XCUITEST_TREAT_WARNINGS_AS_ERRORS) { @@ -260,9 +268,6 @@ class XcodeBuild { if (this.keychainPath && this.keychainPassword) { await setRealDeviceSecurity(this.keychainPath, this.keychainPassword); } - if (this.xcodeOrgId && this.xcodeSigningId && !this.xcodeConfigFile) { - this.xcodeConfigFile = await generateXcodeConfigFile(this.xcodeOrgId, this.xcodeSigningId); - } } const {cmd, args} = this.getCommand(buildOnly); From adf14cc7f6e3a26448315e07a3621bdac7c4aa24 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 22 Sep 2023 23:09:21 +0000 Subject: [PATCH 13/71] chore(release): 5.9.1 [skip ci] ## [5.9.1](https://github.com/appium/WebDriverAgent/compare/v5.9.0...v5.9.1) (2023-09-22) ### Bug Fixes * Provide signing arguments as command line parameters ([#779](https://github.com/appium/WebDriverAgent/issues/779)) ([51ba527](https://github.com/appium/WebDriverAgent/commit/51ba527b6cde3773ebcd5323cfa7e0890b2563aa)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aadb3e23c..26faf0900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.9.1](https://github.com/appium/WebDriverAgent/compare/v5.9.0...v5.9.1) (2023-09-22) + + +### Bug Fixes + +* Provide signing arguments as command line parameters ([#779](https://github.com/appium/WebDriverAgent/issues/779)) ([51ba527](https://github.com/appium/WebDriverAgent/commit/51ba527b6cde3773ebcd5323cfa7e0890b2563aa)) + ## [5.9.0](https://github.com/appium/WebDriverAgent/compare/v5.8.7...v5.9.0) (2023-09-22) diff --git a/package.json b/package.json index 4559104ad..04337817f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.9.0", + "version": "5.9.1", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From ae6c842f3c4e7deb51fcc7a1a1045d4eeede69fd Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Mon, 25 Sep 2023 16:52:16 -0700 Subject: [PATCH 14/71] feat: remove test frameworks in Frameworks and add device local references as rpath for real devices (#780) * ci: use xcode 15 * Remove embedded frameworks * Update wda-package.yml * tweak * keep using 14.3.1 * explicitly set ENABLE_TESTING_SEARCH_PATHS as YES * add system reference * add FBUtf8SafeDictionary for tv as well * Update publish.js.yml --- .github/workflows/publish.js.yml | 6 ++- Scripts/ci/build-real.sh | 6 +++ WebDriverAgent.xcodeproj/project.pbxproj | 47 ++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.js.yml b/.github/workflows/publish.js.yml index 6cd3a0276..92299e7a8 100644 --- a/.github/workflows/publish.js.yml +++ b/.github/workflows/publish.js.yml @@ -44,9 +44,10 @@ jobs: -scheme WebDriverAgentRunner \ -destination generic/platform=iOS \ CODE_SIGNING_ALLOWED=NO ARCHS=arm64 - - name: Creating a zip of WebDriverAgentRunner-Runner.app for iOS + - name: Creating a zip of WebDriverAgentRunner-Runner.app for iOS after removing test frameworks run: | pushd appium_wda_ios/Build/Products/Debug-iphoneos + rm -rf WebDriverAgentRunner-Runner.app/Frameworks/XC*.framework zip -r $ZIP_PKG_NAME_IOS WebDriverAgentRunner-Runner.app popd mv $PKG_PATH_IOS/Build/Products/Debug-iphoneos/$ZIP_PKG_NAME_IOS ./ @@ -58,9 +59,10 @@ jobs: -scheme WebDriverAgentRunner_tvOS \ -destination generic/platform=tvOS \ CODE_SIGNING_ALLOWED=NO ARCHS=arm64 - - name: Creating a zip of WebDriverAgentRunner-Runner.app for tvOS + - name: Creating a zip of WebDriverAgentRunner-Runner.app for tvOS after removing test frameworks run: | pushd appium_wda_tvos/Build/Products/Debug-appletvos + rm -rf WebDriverAgentRunner_tvOS-Runner.app/Frameworks/XC*.framework zip -r $ZIP_PKG_NAME_TVOS WebDriverAgentRunner_tvOS-Runner.app popd mv $PKG_PATH_TVOS/Build/Products/Debug-appletvos/$ZIP_PKG_NAME_TVOS ./ diff --git a/Scripts/ci/build-real.sh b/Scripts/ci/build-real.sh index 9303ffe3b..93eec1145 100755 --- a/Scripts/ci/build-real.sh +++ b/Scripts/ci/build-real.sh @@ -12,6 +12,12 @@ xcodebuild clean build-for-testing \ # Only .app is needed. pushd $WD + +# to remove test packages to refer to the device local instead of embedded ones +# XCTAutomationSupport.framework, XCTest.framewor, XCTestCore.framework, +# XCUIAutomation.framework, XCUnit.framework +rm -rf $SCHEME-Runner.app/Frameworks/XC*.framework + zip -r $ZIP_PKG_NAME $SCHEME-Runner.app popd mv $WD/$ZIP_PKG_NAME ./ diff --git a/WebDriverAgent.xcodeproj/project.pbxproj b/WebDriverAgent.xcodeproj/project.pbxproj index a5b933127..3630797a6 100644 --- a/WebDriverAgent.xcodeproj/project.pbxproj +++ b/WebDriverAgent.xcodeproj/project.pbxproj @@ -312,6 +312,8 @@ 64B26508228C5514002A5025 /* XCUIElementDouble.m in Sources */ = {isa = PBXBuildFile; fileRef = 64B26507228C5514002A5025 /* XCUIElementDouble.m */; }; 64B2650A228CE4FF002A5025 /* FBTVNavigationTracker-Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 64B26509228CE4FF002A5025 /* FBTVNavigationTracker-Private.h */; }; 64B2650B228CE4FF002A5025 /* FBTVNavigationTracker-Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 64B26509228CE4FF002A5025 /* FBTVNavigationTracker-Private.h */; }; + 64E3502E2AC0B6EB005F3ACB /* NSDictionary+FBUtf8SafeDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 716F0DA02A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.m */; }; + 64E3502F2AC0B6FE005F3ACB /* NSDictionary+FBUtf8SafeDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 716F0D9F2A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.h */; }; 711084441DA3AA7500F913D6 /* FBXPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 711084421DA3AA7500F913D6 /* FBXPath.h */; settings = {ATTRIBUTES = (Public, ); }; }; 711084451DA3AA7500F913D6 /* FBXPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 711084431DA3AA7500F913D6 /* FBXPath.m */; }; 7119097C2152580600BA3C7E /* XCUIScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 7119097B2152580600BA3C7E /* XCUIScreen.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -2382,6 +2384,7 @@ 641EE6A62240C5CA00173FCB /* FBImageIOScaler.h in Headers */, 641EE6A72240C5CA00173FCB /* FBSession-Private.h in Headers */, 641EE6A82240C5CA00173FCB /* NSString+FBXMLSafeString.h in Headers */, + 64E3502F2AC0B6FE005F3ACB /* NSDictionary+FBUtf8SafeDictionary.h in Headers */, 641EE6A92240C5CA00173FCB /* FBCommandStatus.h in Headers */, 71822702258744A400661B83 /* HTTPResponseProxy.h in Headers */, 71822741258744BB00661B83 /* HTTPLogging.h in Headers */, @@ -2414,7 +2417,6 @@ 641EE6C02240C5CA00173FCB /* XCUIApplication+FBHelpers.h in Headers */, 641EE6C12240C5CA00173FCB /* _XCTestObservationCenterImplementation.h in Headers */, 714EAA0E2673FDFE005C5B47 /* FBCapabilities.h in Headers */, - 716F0DA22A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.h in Headers */, 641EE6C22240C5CA00173FCB /* XCUIDevice+FBHelpers.h in Headers */, 71D3B3D6267FC7260076473D /* XCUIElement+FBResolve.h in Headers */, 641EE6C32240C5CA00173FCB /* FBClassChainQueryParser.h in Headers */, @@ -3049,6 +3051,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 64E3502E2AC0B6EB005F3ACB /* NSDictionary+FBUtf8SafeDictionary.m in Sources */, 718226CF2587443700661B83 /* GCDAsyncSocket.m in Sources */, E444DCBC24917A5E0060D7EB /* HTTPResponseProxy.m in Sources */, 71D3B3D8267FC7260076473D /* XCUIElement+FBResolve.m in Sources */, @@ -3117,7 +3120,6 @@ 641EE5FF2240C5CA00173FCB /* XCUIElement+FBForceTouch.m in Sources */, 716C9E0327315EFF005AD475 /* XCUIApplication+FBUIInterruptions.m in Sources */, 641EE6002240C5CA00173FCB /* FBTouchActionCommands.m in Sources */, - 716F0DA42A16CA1000CDD977 /* NSDictionary+FBUtf8SafeDictionary.m in Sources */, 719DCF182601EAFB000E765F /* FBNotificationsHelper.m in Sources */, 714EAA102673FDFE005C5B47 /* FBCapabilities.m in Sources */, 641EE6012240C5CA00173FCB /* FBImageIOScaler.m in Sources */, @@ -3172,7 +3174,6 @@ buildActionMask = 2147483647; files = ( 64B26508228C5514002A5025 /* XCUIElementDouble.m in Sources */, - 716F0DA72A17323300CDD977 /* NSDictionaryFBUtf8SafeTests.m in Sources */, 64B26504228C5299002A5025 /* FBTVNavigationTrackerTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3496,12 +3497,17 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_TESTING_SEARCH_PATHS = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = WebDriverAgentRunner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", + /System/Developer/Library/Frameworks, + /System/Developer/Library/PrivateFrameworks, + /Developer/Library/PrivateFrameworks, + /Developer/Library/Frameworks, ); MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -3551,12 +3557,17 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_TESTING_SEARCH_PATHS = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = WebDriverAgentRunner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", + /System/Developer/Library/Frameworks, + /System/Developer/Library/PrivateFrameworks, + /Developer/Library/PrivateFrameworks, + /Developer/Library/Frameworks, ); MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -3603,6 +3614,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = ( "$(PLATFORM_DIR)/Developer/Library/Frameworks", "$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks", @@ -3614,6 +3626,10 @@ "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", + /System/Developer/Library/Frameworks, + /System/Developer/Library/PrivateFrameworks, + /Developer/Library/PrivateFrameworks, + /Developer/Library/Frameworks, ); OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.WebDriverAgentLib; @@ -3664,6 +3680,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = ( "$(PLATFORM_DIR)/Developer/Library/Frameworks", "$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks", @@ -3675,6 +3692,10 @@ "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", + /System/Developer/Library/Frameworks, + /System/Developer/Library/PrivateFrameworks, + /Developer/Library/PrivateFrameworks, + /Developer/Library/Frameworks, ); ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; @@ -3915,6 +3936,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = ( "$(PLATFORM_DIR)/Developer/Library/Frameworks", "$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks", @@ -3926,6 +3948,10 @@ "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", + /Developer/Library/Frameworks, + /Developer/Library/PrivateFrameworks, + /System/Developer/Library/PrivateFrameworks, + /System/Developer/Library/Frameworks, ); OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.WebDriverAgentLib; @@ -3974,6 +4000,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = ( "$(PLATFORM_DIR)/Developer/Library/Frameworks", "$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks", @@ -3985,6 +4012,10 @@ "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", + /Developer/Library/Frameworks, + /Developer/Library/PrivateFrameworks, + /System/Developer/Library/PrivateFrameworks, + /System/Developer/Library/Frameworks, ); ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; @@ -4212,12 +4243,17 @@ buildSettings = { CLANG_STATIC_ANALYZER_MODE = deep; DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = WebDriverAgentRunner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", + /Developer/Library/Frameworks, + /Developer/Library/PrivateFrameworks, + /System/Developer/Library/PrivateFrameworks, + /System/Developer/Library/Frameworks, ); OTHER_LDFLAGS = ( "$(inherited)", @@ -4259,12 +4295,17 @@ baseConfigurationReference = EEE5CABF1C80361500CBBDD9 /* IOSSettings.xcconfig */; buildSettings = { CLANG_STATIC_ANALYZER_MODE = deep; + ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = WebDriverAgentRunner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", + /Developer/Library/Frameworks, + /Developer/Library/PrivateFrameworks, + /System/Developer/Library/PrivateFrameworks, + /System/Developer/Library/Frameworks, ); ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( From 7b2c1e58a91c69e66e7403b4b9d262537e164c3b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 25 Sep 2023 23:58:30 +0000 Subject: [PATCH 15/71] chore(release): 5.10.0 [skip ci] ## [5.10.0](https://github.com/appium/WebDriverAgent/compare/v5.9.1...v5.10.0) (2023-09-25) ### Features * remove test frameworks in Frameworks and add device local references as rpath for real devices ([#780](https://github.com/appium/WebDriverAgent/issues/780)) ([ae6c842](https://github.com/appium/WebDriverAgent/commit/ae6c842f3c4e7deb51fcc7a1a1045d4eeede69fd)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26faf0900..2f1e109ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.10.0](https://github.com/appium/WebDriverAgent/compare/v5.9.1...v5.10.0) (2023-09-25) + + +### Features + +* remove test frameworks in Frameworks and add device local references as rpath for real devices ([#780](https://github.com/appium/WebDriverAgent/issues/780)) ([ae6c842](https://github.com/appium/WebDriverAgent/commit/ae6c842f3c4e7deb51fcc7a1a1045d4eeede69fd)) + ## [5.9.1](https://github.com/appium/WebDriverAgent/compare/v5.9.0...v5.9.1) (2023-09-22) diff --git a/package.json b/package.json index 04337817f..d29c29436 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.9.1", + "version": "5.10.0", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From f043d67dd90fbfca00b8cf53ccae63dbd67fa150 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Thu, 5 Oct 2023 10:36:30 +0200 Subject: [PATCH 16/71] chore: Remove the hardcoded keyboard wait delay from handleKeys (#784) --- WebDriverAgentLib/Commands/FBElementCommands.m | 5 ----- 1 file changed, 5 deletions(-) diff --git a/WebDriverAgentLib/Commands/FBElementCommands.m b/WebDriverAgentLib/Commands/FBElementCommands.m index adb5f6092..0f163521b 100644 --- a/WebDriverAgentLib/Commands/FBElementCommands.m +++ b/WebDriverAgentLib/Commands/FBElementCommands.m @@ -557,11 +557,6 @@ + (NSArray *)routes { NSString *textToType = [request.arguments[@"value"] componentsJoinedByString:@""]; NSUInteger frequency = [request.arguments[@"frequency"] unsignedIntegerValue] ?: [FBConfiguration maxTypingFrequency]; - if (![FBKeyboard waitUntilVisibleForApplication:request.session.activeApplication - timeout:1 - error:nil]) { - [FBLogger log:@"The on-screen keyboard seems to not exist. Continuing with typing anyway"]; - } NSError *error; if (![FBKeyboard typeText:textToType frequency:frequency error:&error]) { return FBResponseWithStatus([FBCommandStatus invalidElementStateErrorWithMessage:error.description From 570866edde713b344efb423b1e3eccf26c7ebab0 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 5 Oct 2023 08:42:01 +0000 Subject: [PATCH 17/71] chore(release): 5.10.1 [skip ci] ## [5.10.1](https://github.com/appium/WebDriverAgent/compare/v5.10.0...v5.10.1) (2023-10-05) ### Miscellaneous Chores * Remove the hardcoded keyboard wait delay from handleKeys ([#784](https://github.com/appium/WebDriverAgent/issues/784)) ([f043d67](https://github.com/appium/WebDriverAgent/commit/f043d67dd90fbfca00b8cf53ccae63dbd67fa150)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f1e109ea..f679c40ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.10.1](https://github.com/appium/WebDriverAgent/compare/v5.10.0...v5.10.1) (2023-10-05) + + +### Miscellaneous Chores + +* Remove the hardcoded keyboard wait delay from handleKeys ([#784](https://github.com/appium/WebDriverAgent/issues/784)) ([f043d67](https://github.com/appium/WebDriverAgent/commit/f043d67dd90fbfca00b8cf53ccae63dbd67fa150)) + ## [5.10.0](https://github.com/appium/WebDriverAgent/compare/v5.9.1...v5.10.0) (2023-09-25) diff --git a/package.json b/package.json index d29c29436..b97e25626 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.10.0", + "version": "5.10.1", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From ae1603a3b5b5c4828ed4959c63d6274254f832a2 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Thu, 5 Oct 2023 22:13:00 +0200 Subject: [PATCH 18/71] feat: Add /calibrate endpoint (#785) --- WebDriverAgentLib/Routing/FBWebServer.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/WebDriverAgentLib/Routing/FBWebServer.m b/WebDriverAgentLib/Routing/FBWebServer.m index a9b9a0625..7e991e0e2 100644 --- a/WebDriverAgentLib/Routing/FBWebServer.m +++ b/WebDriverAgentLib/Routing/FBWebServer.m @@ -220,6 +220,16 @@ - (void)registerServerKeyRouteHandlers [response respondWithString:@"I-AM-ALIVE"]; }]; + NSString *calibrationPage = @"" + "{\"x\":null,\"y\":null}" + "
" + "" + "
" + ""; + [self.server get:@"/calibrate" withBlock:^(RouteRequest *request, RouteResponse *response) { + [response respondWithString:calibrationPage]; + }]; + [self.server get:@"/wda/shutdown" withBlock:^(RouteRequest *request, RouteResponse *response) { [response respondWithString:@"Shutting down"]; [self.delegate webServerDidRequestShutdown:self]; From a9ced34da71c80a7654358043be37f02af7a1508 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 5 Oct 2023 20:32:08 +0000 Subject: [PATCH 19/71] chore(release): 5.11.0 [skip ci] ## [5.11.0](https://github.com/appium/WebDriverAgent/compare/v5.10.1...v5.11.0) (2023-10-05) ### Features * Add /calibrate endpoint ([#785](https://github.com/appium/WebDriverAgent/issues/785)) ([ae1603a](https://github.com/appium/WebDriverAgent/commit/ae1603a3b5b5c4828ed4959c63d6274254f832a2)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f679c40ad..23f5fd036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.11.0](https://github.com/appium/WebDriverAgent/compare/v5.10.1...v5.11.0) (2023-10-05) + + +### Features + +* Add /calibrate endpoint ([#785](https://github.com/appium/WebDriverAgent/issues/785)) ([ae1603a](https://github.com/appium/WebDriverAgent/commit/ae1603a3b5b5c4828ed4959c63d6274254f832a2)) + ## [5.10.1](https://github.com/appium/WebDriverAgent/compare/v5.10.0...v5.10.1) (2023-10-05) diff --git a/package.json b/package.json index b97e25626..67a6d23e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.10.1", + "version": "5.11.0", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 123eefba5e5e30100cb3cdff09a516179f78afe7 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Thu, 19 Oct 2023 15:39:14 +0200 Subject: [PATCH 20/71] chore: Use latest types version --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 67a6d23e6..62dee72a5 100644 --- a/package.json +++ b/package.json @@ -56,10 +56,10 @@ "homepage": "https://github.com/appium/WebDriverAgent#readme", "devDependencies": { "@appium/eslint-config-appium": "^8.0.4", - "@appium/eslint-config-appium-ts": "^0.3.1", + "@appium/eslint-config-appium-ts": "^0.x", "@appium/test-support": "^3.0.0", - "@appium/tsconfig": "^0.3.0", - "@appium/types": "^0.13.2", + "@appium/tsconfig": "^0.x", + "@appium/types": "^0.x", "@semantic-release/changelog": "^6.0.1", "@semantic-release/git": "^10.0.1", "@types/bluebird": "^3.5.38", From 1fb0c4fb7d8de0249dbafde3a563a275477bcd51 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 19 Oct 2023 15:33:00 +0000 Subject: [PATCH 21/71] chore(release): 5.11.1 [skip ci] ## [5.11.1](https://github.com/appium/WebDriverAgent/compare/v5.11.0...v5.11.1) (2023-10-19) ### Miscellaneous Chores * Use latest types version ([123eefb](https://github.com/appium/WebDriverAgent/commit/123eefba5e5e30100cb3cdff09a516179f78afe7)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23f5fd036..588587618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.11.1](https://github.com/appium/WebDriverAgent/compare/v5.11.0...v5.11.1) (2023-10-19) + + +### Miscellaneous Chores + +* Use latest types version ([123eefb](https://github.com/appium/WebDriverAgent/commit/123eefba5e5e30100cb3cdff09a516179f78afe7)) + ## [5.11.0](https://github.com/appium/WebDriverAgent/compare/v5.10.1...v5.11.0) (2023-10-05) diff --git a/package.json b/package.json index 62dee72a5..bb8c4bcdb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.11.0", + "version": "5.11.1", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 895cdfc1a316117bb7c8b5be0265b439c1e911bc Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Thu, 19 Oct 2023 17:40:34 +0200 Subject: [PATCH 22/71] chore: Use latest teen_process types --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bb8c4bcdb..b1f5abf9a 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@types/node": "^20.4.7", "@types/sinon": "^10.0.16", "@types/sinon-chai": "^3.2.9", - "@types/teen_process": "2.0.1", + "@types/teen_process": "^2.0.1", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "appium-xcode": "^5.0.0", From 18e1dadf5bcdebeb18f25c683c317330af08d479 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 19 Oct 2023 23:09:42 +0000 Subject: [PATCH 23/71] chore(release): 5.11.2 [skip ci] ## [5.11.2](https://github.com/appium/WebDriverAgent/compare/v5.11.1...v5.11.2) (2023-10-19) ### Miscellaneous Chores * Use latest teen_process types ([895cdfc](https://github.com/appium/WebDriverAgent/commit/895cdfc1a316117bb7c8b5be0265b439c1e911bc)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 588587618..178875429 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.11.2](https://github.com/appium/WebDriverAgent/compare/v5.11.1...v5.11.2) (2023-10-19) + + +### Miscellaneous Chores + +* Use latest teen_process types ([895cdfc](https://github.com/appium/WebDriverAgent/commit/895cdfc1a316117bb7c8b5be0265b439c1e911bc)) + ## [5.11.1](https://github.com/appium/WebDriverAgent/compare/v5.11.0...v5.11.1) (2023-10-19) diff --git a/package.json b/package.json index b1f5abf9a..fccb85615 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.11.1", + "version": "5.11.2", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 543c49860d2d35148bcbaa33e14d3e1dab058cef Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 21 Oct 2023 11:44:58 -0700 Subject: [PATCH 24/71] chore: use PRODUCT_BUNDLE_IDENTIFIER to info.plist (#794) --- WebDriverAgentRunner/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebDriverAgentRunner/Info.plist b/WebDriverAgentRunner/Info.plist index 70c8682fd..0b10cd4f3 100644 --- a/WebDriverAgentRunner/Info.plist +++ b/WebDriverAgentRunner/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.facebook.wda.runner + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName From 651d2bb06c9f901edb89b6f9c63ba600208ddaaf Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 21 Oct 2023 18:52:42 +0000 Subject: [PATCH 25/71] chore(release): 5.11.3 [skip ci] ## [5.11.3](https://github.com/appium/WebDriverAgent/compare/v5.11.2...v5.11.3) (2023-10-21) ### Miscellaneous Chores * use PRODUCT_BUNDLE_IDENTIFIER to info.plist ([#794](https://github.com/appium/WebDriverAgent/issues/794)) ([543c498](https://github.com/appium/WebDriverAgent/commit/543c49860d2d35148bcbaa33e14d3e1dab058cef)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 178875429..3b320b852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.11.3](https://github.com/appium/WebDriverAgent/compare/v5.11.2...v5.11.3) (2023-10-21) + + +### Miscellaneous Chores + +* use PRODUCT_BUNDLE_IDENTIFIER to info.plist ([#794](https://github.com/appium/WebDriverAgent/issues/794)) ([543c498](https://github.com/appium/WebDriverAgent/commit/543c49860d2d35148bcbaa33e14d3e1dab058cef)) + ## [5.11.2](https://github.com/appium/WebDriverAgent/compare/v5.11.1...v5.11.2) (2023-10-19) diff --git a/package.json b/package.json index fccb85615..097d7ced6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.11.2", + "version": "5.11.3", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 4921899d96800dbcd59a9c27ba793ad16d0c715b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 20:17:16 +0200 Subject: [PATCH 26/71] chore(deps-dev): bump sinon from 16.1.3 to 17.0.0 (#795) Bumps [sinon](https://github.com/sinonjs/sinon) from 16.1.3 to 17.0.0. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md) - [Commits](https://github.com/sinonjs/sinon/compare/v16.1.3...v17.0.0) --- updated-dependencies: - dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 097d7ced6..0b7d67eae 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "pre-commit": "^1.2.2", "prettier": "^3.0.0", "semantic-release": "^21.1.0", - "sinon": "^16.0.0", + "sinon": "^17.0.0", "ts-node": "^10.9.1", "typescript": "^5.1.6" }, From d99c79b254f4e83d9de85eac7dd5dd08aab85284 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 23 Oct 2023 20:41:43 +0000 Subject: [PATCH 27/71] chore(release): 5.11.4 [skip ci] ## [5.11.4](https://github.com/appium/WebDriverAgent/compare/v5.11.3...v5.11.4) (2023-10-23) ### Miscellaneous Chores * **deps-dev:** bump sinon from 16.1.3 to 17.0.0 ([#795](https://github.com/appium/WebDriverAgent/issues/795)) ([4921899](https://github.com/appium/WebDriverAgent/commit/4921899d96800dbcd59a9c27ba793ad16d0c715b)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b320b852..dc0c66b0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.11.4](https://github.com/appium/WebDriverAgent/compare/v5.11.3...v5.11.4) (2023-10-23) + + +### Miscellaneous Chores + +* **deps-dev:** bump sinon from 16.1.3 to 17.0.0 ([#795](https://github.com/appium/WebDriverAgent/issues/795)) ([4921899](https://github.com/appium/WebDriverAgent/commit/4921899d96800dbcd59a9c27ba793ad16d0c715b)) + ## [5.11.3](https://github.com/appium/WebDriverAgent/compare/v5.11.2...v5.11.3) (2023-10-21) diff --git a/package.json b/package.json index 0b7d67eae..90fe1b65b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.11.3", + "version": "5.11.4", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 440279d4f6d069e440180faf4bee8e5dc1758787 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 23:41:47 +0200 Subject: [PATCH 28/71] chore(deps-dev): bump lint-staged from 14.0.1 to 15.0.2 (#792) Bumps [lint-staged](https://github.com/okonet/lint-staged) from 14.0.1 to 15.0.2. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Changelog](https://github.com/lint-staged/lint-staged/blob/master/CHANGELOG.md) - [Commits](https://github.com/okonet/lint-staged/compare/v14.0.1...v15.0.2) --- updated-dependencies: - dependency-name: lint-staged dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 90fe1b65b..3fd1bb791 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "eslint-plugin-import": "^2.28.0", "eslint-plugin-mocha": "^10.1.0", "eslint-plugin-promise": "^6.1.1", - "lint-staged": "^14.0.0", + "lint-staged": "^15.0.2", "mocha": "^10.0.0", "pre-commit": "^1.2.2", "prettier": "^3.0.0", From f130961f189f2746d4a2b0a18105fc10203312ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 23:42:02 +0200 Subject: [PATCH 29/71] chore(deps-dev): bump eslint-config-prettier from 8.10.0 to 9.0.0 (#791) Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.10.0 to 9.0.0. - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.10.0...v9.0.0) --- updated-dependencies: - dependency-name: eslint-config-prettier dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3fd1bb791..c09665648 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "chai-as-promised": "^7.1.1", "conventional-changelog-conventionalcommits": "^7.0.1", "eslint": "^8.46.0", - "eslint-config-prettier": "^8.9.0", + "eslint-config-prettier": "^9.0.0", "eslint-import-resolver-typescript": "^3.5.5", "eslint-plugin-import": "^2.28.0", "eslint-plugin-mocha": "^10.1.0", From a96718308dbd6b13feb30e6ce8f01a7d9b74b146 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 23:42:20 +0200 Subject: [PATCH 30/71] chore(deps-dev): bump semantic-release from 21.1.2 to 22.0.5 (#781) Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 21.1.2 to 22.0.5. - [Release notes](https://github.com/semantic-release/semantic-release/releases) - [Commits](https://github.com/semantic-release/semantic-release/compare/v21.1.2...v22.0.5) --- updated-dependencies: - dependency-name: semantic-release dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c09665648..0466d7f54 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "mocha": "^10.0.0", "pre-commit": "^1.2.2", "prettier": "^3.0.0", - "semantic-release": "^21.1.0", + "semantic-release": "^22.0.5", "sinon": "^17.0.0", "ts-node": "^10.9.1", "typescript": "^5.1.6" From 8f8e582c4f8b51e878791ddbd7f1dac47555ab23 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 23 Oct 2023 23:44:22 +0000 Subject: [PATCH 31/71] chore(release): 5.11.5 [skip ci] ## [5.11.5](https://github.com/appium/WebDriverAgent/compare/v5.11.4...v5.11.5) (2023-10-23) ### Miscellaneous Chores * **deps-dev:** bump eslint-config-prettier from 8.10.0 to 9.0.0 ([#791](https://github.com/appium/WebDriverAgent/issues/791)) ([f130961](https://github.com/appium/WebDriverAgent/commit/f130961f189f2746d4a2b0a18105fc10203312ca)) * **deps-dev:** bump lint-staged from 14.0.1 to 15.0.2 ([#792](https://github.com/appium/WebDriverAgent/issues/792)) ([440279d](https://github.com/appium/WebDriverAgent/commit/440279d4f6d069e440180faf4bee8e5dc1758787)) * **deps-dev:** bump semantic-release from 21.1.2 to 22.0.5 ([#781](https://github.com/appium/WebDriverAgent/issues/781)) ([a967183](https://github.com/appium/WebDriverAgent/commit/a96718308dbd6b13feb30e6ce8f01a7d9b74b146)) --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc0c66b0b..01869dbf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [5.11.5](https://github.com/appium/WebDriverAgent/compare/v5.11.4...v5.11.5) (2023-10-23) + + +### Miscellaneous Chores + +* **deps-dev:** bump eslint-config-prettier from 8.10.0 to 9.0.0 ([#791](https://github.com/appium/WebDriverAgent/issues/791)) ([f130961](https://github.com/appium/WebDriverAgent/commit/f130961f189f2746d4a2b0a18105fc10203312ca)) +* **deps-dev:** bump lint-staged from 14.0.1 to 15.0.2 ([#792](https://github.com/appium/WebDriverAgent/issues/792)) ([440279d](https://github.com/appium/WebDriverAgent/commit/440279d4f6d069e440180faf4bee8e5dc1758787)) +* **deps-dev:** bump semantic-release from 21.1.2 to 22.0.5 ([#781](https://github.com/appium/WebDriverAgent/issues/781)) ([a967183](https://github.com/appium/WebDriverAgent/commit/a96718308dbd6b13feb30e6ce8f01a7d9b74b146)) + ## [5.11.4](https://github.com/appium/WebDriverAgent/compare/v5.11.3...v5.11.4) (2023-10-23) diff --git a/package.json b/package.json index 0466d7f54..1bdb2802e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.11.4", + "version": "5.11.5", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From e2f4405a3449f1f4d390eae06bf91a220e81b58b Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 25 Oct 2023 11:08:27 -0700 Subject: [PATCH 32/71] chore: disable debugger for wda (#768) --- .../xcshareddata/xcschemes/WebDriverAgentRunner.xcscheme | 4 ++-- .../xcshareddata/xcschemes/WebDriverAgentRunner_tvOS.xcscheme | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner.xcscheme b/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner.xcscheme index 82f803a90..8857b934c 100644 --- a/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner.xcscheme +++ b/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner.xcscheme @@ -24,8 +24,8 @@ diff --git a/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner_tvOS.xcscheme b/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner_tvOS.xcscheme index 198d2e6cc..e55655225 100644 --- a/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner_tvOS.xcscheme +++ b/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner_tvOS.xcscheme @@ -24,8 +24,8 @@ From b2b6de43ab448d359f92adfb8dc0b6de302de827 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 25 Oct 2023 19:24:31 +0000 Subject: [PATCH 33/71] chore(release): 5.11.6 [skip ci] ## [5.11.6](https://github.com/appium/WebDriverAgent/compare/v5.11.5...v5.11.6) (2023-10-25) ### Miscellaneous Chores * disable debugger for wda ([#768](https://github.com/appium/WebDriverAgent/issues/768)) ([e2f4405](https://github.com/appium/WebDriverAgent/commit/e2f4405a3449f1f4d390eae06bf91a220e81b58b)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01869dbf2..161e35a0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.11.6](https://github.com/appium/WebDriverAgent/compare/v5.11.5...v5.11.6) (2023-10-25) + + +### Miscellaneous Chores + +* disable debugger for wda ([#768](https://github.com/appium/WebDriverAgent/issues/768)) ([e2f4405](https://github.com/appium/WebDriverAgent/commit/e2f4405a3449f1f4d390eae06bf91a220e81b58b)) + ## [5.11.5](https://github.com/appium/WebDriverAgent/compare/v5.11.4...v5.11.5) (2023-10-23) diff --git a/package.json b/package.json index 1bdb2802e..bd447f321 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.11.5", + "version": "5.11.6", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From dabf141acd3186b1c27231ef52826fa42208c980 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 22:44:50 +0200 Subject: [PATCH 34/71] chore(deps-dev): bump @typescript-eslint/eslint-plugin from 5.62.0 to 6.9.0 (#796) * chore(deps-dev): bump @typescript-eslint/eslint-plugin Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.62.0 to 6.9.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.9.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Bump parser --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mykola Mokhnach --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bd447f321..8f668c0c0 100644 --- a/package.json +++ b/package.json @@ -71,8 +71,8 @@ "@types/sinon": "^10.0.16", "@types/sinon-chai": "^3.2.9", "@types/teen_process": "^2.0.1", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", + "@typescript-eslint/eslint-plugin": "^6.9.0", + "@typescript-eslint/parser": "^6.9.0", "appium-xcode": "^5.0.0", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", From ea6fb73f4906f33697e2877361f800a69c0effbc Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 25 Oct 2023 20:52:59 +0000 Subject: [PATCH 35/71] chore(release): 5.11.7 [skip ci] ## [5.11.7](https://github.com/appium/WebDriverAgent/compare/v5.11.6...v5.11.7) (2023-10-25) ### Miscellaneous Chores * **deps-dev:** bump @typescript-eslint/eslint-plugin from 5.62.0 to 6.9.0 ([#796](https://github.com/appium/WebDriverAgent/issues/796)) ([dabf141](https://github.com/appium/WebDriverAgent/commit/dabf141acd3186b1c27231ef52826fa42208c980)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 161e35a0a..23456c82b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.11.7](https://github.com/appium/WebDriverAgent/compare/v5.11.6...v5.11.7) (2023-10-25) + + +### Miscellaneous Chores + +* **deps-dev:** bump @typescript-eslint/eslint-plugin from 5.62.0 to 6.9.0 ([#796](https://github.com/appium/WebDriverAgent/issues/796)) ([dabf141](https://github.com/appium/WebDriverAgent/commit/dabf141acd3186b1c27231ef52826fa42208c980)) + ## [5.11.6](https://github.com/appium/WebDriverAgent/compare/v5.11.5...v5.11.6) (2023-10-25) diff --git a/package.json b/package.json index 8f668c0c0..fd9ca5401 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.11.6", + "version": "5.11.7", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From aaf70c9196e4dcb2073da151cda23b2b221d4dae Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Thu, 26 Oct 2023 16:52:20 +0200 Subject: [PATCH 36/71] feat: Add an endpoint for keyboard input (#797) --- WebDriverAgentLib/Commands/FBCustomCommands.m | 45 +++++++++++++ WebDriverAgentLib/Utilities/FBKeyboard.h | 10 +++ WebDriverAgentLib/Utilities/FBKeyboard.m | 65 +++++++++++++++++++ 3 files changed, 120 insertions(+) diff --git a/WebDriverAgentLib/Commands/FBCustomCommands.m b/WebDriverAgentLib/Commands/FBCustomCommands.m index 9d8e324d7..934cdf73f 100644 --- a/WebDriverAgentLib/Commands/FBCustomCommands.m +++ b/WebDriverAgentLib/Commands/FBCustomCommands.m @@ -70,6 +70,9 @@ + (NSArray *)routes [[FBRoute GET:@"/wda/device/location"] respondWithTarget:self action:@selector(handleGetLocation:)], [[FBRoute GET:@"/wda/device/location"].withoutSession respondWithTarget:self action:@selector(handleGetLocation:)], #if !TARGET_OS_TV // tvOS does not provide relevant APIs +#if __clang_major__ >= 15 + [[FBRoute POST:@"/wda/element/:uuid/keyboardInput"] respondWithTarget:self action:@selector(handleKeyboardInput:)], +#endif [[FBRoute GET:@"/wda/simulatedLocation"] respondWithTarget:self action:@selector(handleGetSimulatedLocation:)], [[FBRoute GET:@"/wda/simulatedLocation"].withoutSession respondWithTarget:self action:@selector(handleGetSimulatedLocation:)], [[FBRoute POST:@"/wda/simulatedLocation"] respondWithTarget:self action:@selector(handleSetSimulatedLocation:)], @@ -543,6 +546,48 @@ + (NSString *)timeZone } return FBResponseWithOK(); } + +#if __clang_major__ >= 15 ++ (id)handleKeyboardInput:(FBRouteRequest *)request +{ + FBElementCache *elementCache = request.session.elementCache; + BOOL hasElement = nil != request.parameters[@"uuid"]; + XCUIElement *destination = hasElement + ? [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]] + : request.session.activeApplication; + id keys = request.arguments[@"keys"]; + if (![keys isKindOfClass:NSArray.class]) { + NSString *message = @"The 'keys' argument must be an array"; + return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message + traceback:nil]); + } + for (id item in (NSArray *)keys) { + if ([item isKindOfClass:NSString.class]) { + NSString *keyValue = [FBKeyboard keyValueForName:item] ?: item; + [destination typeKey:keyValue modifierFlags:XCUIKeyModifierNone]; + } else if ([item isKindOfClass:NSDictionary.class]) { + id key = [(NSDictionary *)item objectForKey:@"key"]; + if (![key isKindOfClass:NSString.class]) { + NSString *message = [NSString stringWithFormat:@"All dictionaries of 'keys' array must have the 'key' item of type string. Got '%@' instead in the item %@", key, item]; + return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message + traceback:nil]); + } + id modifiers = [(NSDictionary *)item objectForKey:@"modifierFlags"]; + NSUInteger modifierFlags = XCUIKeyModifierNone; + if ([modifiers isKindOfClass:NSNumber.class]) { + modifierFlags = [(NSNumber *)modifiers unsignedIntValue]; + } + NSString *keyValue = [FBKeyboard keyValueForName:item] ?: key; + [destination typeKey:keyValue modifierFlags:modifierFlags]; + } else { + NSString *message = @"All items of the 'keys' array must be either dictionaries or strings"; + return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message + traceback:nil]); + } + } + return FBResponseWithOK(); +} +#endif #endif + (id)handlePerformAccessibilityAudit:(FBRouteRequest *)request diff --git a/WebDriverAgentLib/Utilities/FBKeyboard.h b/WebDriverAgentLib/Utilities/FBKeyboard.h index cbe1180cd..5a16e1aed 100644 --- a/WebDriverAgentLib/Utilities/FBKeyboard.h +++ b/WebDriverAgentLib/Utilities/FBKeyboard.h @@ -13,6 +13,16 @@ NS_ASSUME_NONNULL_BEGIN @interface FBKeyboard : NSObject +#if (!TARGET_OS_TV && __clang_major__ >= 15) +/** + Transforms key name to its string representation, which could be used with XCTest + + @param name one of available keyboard key names defined in https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc + @return Either the key value or nil if no matches have been found + */ ++ (nullable NSString *)keyValueForName:(NSString *)name; +#endif + /** Types a string into active element. There must be element with keyboard focus; otherwise an error is raised. diff --git a/WebDriverAgentLib/Utilities/FBKeyboard.m b/WebDriverAgentLib/Utilities/FBKeyboard.m index 7d474ac02..0cf9964c6 100644 --- a/WebDriverAgentLib/Utilities/FBKeyboard.m +++ b/WebDriverAgentLib/Utilities/FBKeyboard.m @@ -80,4 +80,69 @@ + (BOOL)waitUntilVisibleForApplication:(XCUIApplication *)app timeout:(NSTimeInt error:error]; } +#if (!TARGET_OS_TV && __clang_major__ >= 15) + ++ (NSString *)keyValueForName:(NSString *)name +{ + static dispatch_once_t onceKeys; + static NSDictionary *keysMapping; + dispatch_once(&onceKeys, ^{ + keysMapping = @{ + @"XCUIKeyboardKeyDelete": XCUIKeyboardKeyDelete, + @"XCUIKeyboardKeyReturn": XCUIKeyboardKeyReturn, + @"XCUIKeyboardKeyEnter": XCUIKeyboardKeyEnter, + @"XCUIKeyboardKeyTab": XCUIKeyboardKeyTab, + @"XCUIKeyboardKeySpace": XCUIKeyboardKeySpace, + @"XCUIKeyboardKeyEscape": XCUIKeyboardKeyEscape, + + @"XCUIKeyboardKeyUpArrow": XCUIKeyboardKeyUpArrow, + @"XCUIKeyboardKeyDownArrow": XCUIKeyboardKeyDownArrow, + @"XCUIKeyboardKeyLeftArrow": XCUIKeyboardKeyLeftArrow, + @"XCUIKeyboardKeyRightArrow": XCUIKeyboardKeyRightArrow, + + @"XCUIKeyboardKeyF1": XCUIKeyboardKeyF1, + @"XCUIKeyboardKeyF2": XCUIKeyboardKeyF2, + @"XCUIKeyboardKeyF3": XCUIKeyboardKeyF3, + @"XCUIKeyboardKeyF4": XCUIKeyboardKeyF4, + @"XCUIKeyboardKeyF5": XCUIKeyboardKeyF5, + @"XCUIKeyboardKeyF6": XCUIKeyboardKeyF6, + @"XCUIKeyboardKeyF7": XCUIKeyboardKeyF7, + @"XCUIKeyboardKeyF8": XCUIKeyboardKeyF8, + @"XCUIKeyboardKeyF9": XCUIKeyboardKeyF9, + @"XCUIKeyboardKeyF10": XCUIKeyboardKeyF10, + @"XCUIKeyboardKeyF11": XCUIKeyboardKeyF11, + @"XCUIKeyboardKeyF12": XCUIKeyboardKeyF12, + @"XCUIKeyboardKeyF13": XCUIKeyboardKeyF13, + @"XCUIKeyboardKeyF14": XCUIKeyboardKeyF14, + @"XCUIKeyboardKeyF15": XCUIKeyboardKeyF15, + @"XCUIKeyboardKeyF16": XCUIKeyboardKeyF16, + @"XCUIKeyboardKeyF17": XCUIKeyboardKeyF17, + @"XCUIKeyboardKeyF18": XCUIKeyboardKeyF18, + @"XCUIKeyboardKeyF19": XCUIKeyboardKeyF19, + + @"XCUIKeyboardKeyForwardDelete": XCUIKeyboardKeyForwardDelete, + @"XCUIKeyboardKeyHome": XCUIKeyboardKeyHome, + @"XCUIKeyboardKeyEnd": XCUIKeyboardKeyEnd, + @"XCUIKeyboardKeyPageUp": XCUIKeyboardKeyPageUp, + @"XCUIKeyboardKeyPageDown": XCUIKeyboardKeyPageDown, + @"XCUIKeyboardKeyClear": XCUIKeyboardKeyClear, + @"XCUIKeyboardKeyHelp": XCUIKeyboardKeyHelp, + + @"XCUIKeyboardKeyCapsLock": XCUIKeyboardKeyCapsLock, + @"XCUIKeyboardKeyShift": XCUIKeyboardKeyShift, + @"XCUIKeyboardKeyControl": XCUIKeyboardKeyControl, + @"XCUIKeyboardKeyOption": XCUIKeyboardKeyOption, + @"XCUIKeyboardKeyCommand": XCUIKeyboardKeyCommand, + @"XCUIKeyboardKeyRightShift": XCUIKeyboardKeyRightShift, + @"XCUIKeyboardKeyRightControl": XCUIKeyboardKeyRightControl, + @"XCUIKeyboardKeyRightOption": XCUIKeyboardKeyRightOption, + @"XCUIKeyboardKeyRightCommand": XCUIKeyboardKeyRightCommand, + @"XCUIKeyboardKeySecondaryFn": XCUIKeyboardKeySecondaryFn + }; + }); + return keysMapping[name]; +} + +#endif + @end From beb413e37a22d6802f8096b18a68427307caacfd Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 26 Oct 2023 15:03:58 +0000 Subject: [PATCH 37/71] chore(release): 5.12.0 [skip ci] ## [5.12.0](https://github.com/appium/WebDriverAgent/compare/v5.11.7...v5.12.0) (2023-10-26) ### Features * Add an endpoint for keyboard input ([#797](https://github.com/appium/WebDriverAgent/issues/797)) ([aaf70c9](https://github.com/appium/WebDriverAgent/commit/aaf70c9196e4dcb2073da151cda23b2b221d4dae)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23456c82b..77b02b2f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.12.0](https://github.com/appium/WebDriverAgent/compare/v5.11.7...v5.12.0) (2023-10-26) + + +### Features + +* Add an endpoint for keyboard input ([#797](https://github.com/appium/WebDriverAgent/issues/797)) ([aaf70c9](https://github.com/appium/WebDriverAgent/commit/aaf70c9196e4dcb2073da151cda23b2b221d4dae)) + ## [5.11.7](https://github.com/appium/WebDriverAgent/compare/v5.11.6...v5.11.7) (2023-10-25) diff --git a/package.json b/package.json index fd9ca5401..aa2b8e157 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.11.7", + "version": "5.12.0", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 58ebe8eb52966963ee30a5c066beb3bf9fed3161 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 28 Oct 2023 15:02:37 -0700 Subject: [PATCH 38/71] fix: when 0 is given for handleKeyboardInput (#798) --- WebDriverAgentLib/Commands/FBCustomCommands.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebDriverAgentLib/Commands/FBCustomCommands.m b/WebDriverAgentLib/Commands/FBCustomCommands.m index 934cdf73f..21b67173f 100644 --- a/WebDriverAgentLib/Commands/FBCustomCommands.m +++ b/WebDriverAgentLib/Commands/FBCustomCommands.m @@ -551,7 +551,7 @@ + (NSString *)timeZone + (id)handleKeyboardInput:(FBRouteRequest *)request { FBElementCache *elementCache = request.session.elementCache; - BOOL hasElement = nil != request.parameters[@"uuid"]; + BOOL hasElement = ![request.parameters[@"uuid"] isEqual:@"0"]; XCUIElement *destination = hasElement ? [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]] : request.session.activeApplication; From deb3c05998d100c0eece079e8d8662ad23ae7c5d Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 28 Oct 2023 23:00:37 +0000 Subject: [PATCH 39/71] chore(release): 5.12.1 [skip ci] ## [5.12.1](https://github.com/appium/WebDriverAgent/compare/v5.12.0...v5.12.1) (2023-10-28) ### Bug Fixes * when 0 is given for handleKeyboardInput ([#798](https://github.com/appium/WebDriverAgent/issues/798)) ([58ebe8e](https://github.com/appium/WebDriverAgent/commit/58ebe8eb52966963ee30a5c066beb3bf9fed3161)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b02b2f4..7fd267cc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.12.1](https://github.com/appium/WebDriverAgent/compare/v5.12.0...v5.12.1) (2023-10-28) + + +### Bug Fixes + +* when 0 is given for handleKeyboardInput ([#798](https://github.com/appium/WebDriverAgent/issues/798)) ([58ebe8e](https://github.com/appium/WebDriverAgent/commit/58ebe8eb52966963ee30a5c066beb3bf9fed3161)) + ## [5.12.0](https://github.com/appium/WebDriverAgent/compare/v5.11.7...v5.12.0) (2023-10-26) diff --git a/package.json b/package.json index aa2b8e157..d95bb937e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.12.0", + "version": "5.12.1", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 247ace68f373c09054fabc3be088061089946806 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 29 Oct 2023 15:25:18 -0700 Subject: [PATCH 40/71] chore: return operation error in `handleKeyboardInput` (#799) * fix: when 0 is given * chore: return explicit unsupported error * Update FBCustomCommands.m --- WebDriverAgentLib/Commands/FBCustomCommands.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/WebDriverAgentLib/Commands/FBCustomCommands.m b/WebDriverAgentLib/Commands/FBCustomCommands.m index 21b67173f..5b1ce72ae 100644 --- a/WebDriverAgentLib/Commands/FBCustomCommands.m +++ b/WebDriverAgentLib/Commands/FBCustomCommands.m @@ -556,6 +556,13 @@ + (NSString *)timeZone ? [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]] : request.session.activeApplication; id keys = request.arguments[@"keys"]; + + if (![destination respondsToSelector:@selector(typeKey:modifierFlags:)]) { + NSString *message = @"typeKey API is only supported since Xcode15 and iPadOS 17"; + return FBResponseWithStatus([FBCommandStatus unsupportedOperationErrorWithMessage:message + traceback:nil]); + } + if (![keys isKindOfClass:NSArray.class]) { NSString *message = @"The 'keys' argument must be an array"; return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message From 2aa2a28631a7731d3a6951b1378c042cfcdda59f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 29 Oct 2023 22:31:33 +0000 Subject: [PATCH 41/71] chore(release): 5.12.2 [skip ci] ## [5.12.2](https://github.com/appium/WebDriverAgent/compare/v5.12.1...v5.12.2) (2023-10-29) ### Miscellaneous Chores * return operation error in `handleKeyboardInput` ([#799](https://github.com/appium/WebDriverAgent/issues/799)) ([247ace6](https://github.com/appium/WebDriverAgent/commit/247ace68f373c09054fabc3be088061089946806)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fd267cc7..421164cf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.12.2](https://github.com/appium/WebDriverAgent/compare/v5.12.1...v5.12.2) (2023-10-29) + + +### Miscellaneous Chores + +* return operation error in `handleKeyboardInput` ([#799](https://github.com/appium/WebDriverAgent/issues/799)) ([247ace6](https://github.com/appium/WebDriverAgent/commit/247ace68f373c09054fabc3be088061089946806)) + ## [5.12.1](https://github.com/appium/WebDriverAgent/compare/v5.12.0...v5.12.1) (2023-10-28) diff --git a/package.json b/package.json index d95bb937e..571d5d356 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.12.1", + "version": "5.12.2", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 796d5e743676b174221e27e739a0164f4b91533c Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Tue, 31 Oct 2023 08:50:43 +0100 Subject: [PATCH 42/71] chore: Return better error on WDA startup timeout (#801) --- lib/xcodebuild.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/xcodebuild.js b/lib/xcodebuild.js index de6b58818..8194d1984 100644 --- a/lib/xcodebuild.js +++ b/lib/xcodebuild.js @@ -405,12 +405,13 @@ class XcodeBuild { this.log.debug(`Waiting up to ${this.launchTimeout}ms for WebDriverAgent to start`); let currentStatus = null; try { - let retries = parseInt(`${this.launchTimeout / 500}`, 10); + const retries = Math.trunc(this.launchTimeout / 500); await retryInterval(retries, 1000, async () => { if (this._didProcessExit) { // there has been an error elsewhere and we need to short-circuit - return; + return currentStatus; } + const proxyTimeout = this.noSessionProxy.timeout; this.noSessionProxy.timeout = 1000; try { @@ -434,10 +435,11 @@ class XcodeBuild { this.log.debug(`WebDriverAgent successfully started after ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`); } catch (err) { - // at this point, if we have not had any errors from xcode itself (reported - // elsewhere), we can let this go through and try to create the session - this.log.debug(err.message); - this.log.warn(`Getting status of WebDriverAgent on device timed out. Continuing`); + this.log.debug(err.stack); + throw new Error( + `We were not able to retrieve the /status response from the WebDriverAgent server after ${this.launchTimeout}ms timeout.` + + `Try to increase the value of 'appium:wdaLaunchTimeout' capability as a possible workaround.` + ); } return currentStatus; } From d92c98535f5bde04a4c89a1843aea690ded8e286 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 31 Oct 2023 07:56:58 +0000 Subject: [PATCH 43/71] chore(release): 5.12.3 [skip ci] ## [5.12.3](https://github.com/appium/WebDriverAgent/compare/v5.12.2...v5.12.3) (2023-10-31) ### Miscellaneous Chores * Return better error on WDA startup timeout ([#801](https://github.com/appium/WebDriverAgent/issues/801)) ([796d5e7](https://github.com/appium/WebDriverAgent/commit/796d5e743676b174221e27e739a0164f4b91533c)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 421164cf9..bcd3ee38f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.12.3](https://github.com/appium/WebDriverAgent/compare/v5.12.2...v5.12.3) (2023-10-31) + + +### Miscellaneous Chores + +* Return better error on WDA startup timeout ([#801](https://github.com/appium/WebDriverAgent/issues/801)) ([796d5e7](https://github.com/appium/WebDriverAgent/commit/796d5e743676b174221e27e739a0164f4b91533c)) + ## [5.12.2](https://github.com/appium/WebDriverAgent/compare/v5.12.1...v5.12.2) (2023-10-29) diff --git a/package.json b/package.json index 571d5d356..7696d13c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.12.2", + "version": "5.12.3", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 9925af44ec5fbfb66e6f034dfd93a6c25de48661 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Tue, 31 Oct 2023 20:24:12 +0100 Subject: [PATCH 44/71] feat: Add "elementDescription" property to audit issues containing the debug description of an element (#802) --- WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m | 1 + 1 file changed, 1 insertion(+) diff --git a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m index 7c9ff9967..4faaed1ae 100644 --- a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m @@ -374,6 +374,7 @@ - (BOOL)fb_dismissKeyboardWithKeyNames:(nullable NSArray *)keyNames @"compactDescription": extractIssueProperty(issue, @"compactDescription") ?: @"", @"auditType": auditType, @"element": [extractIssueProperty(issue, @"element") description] ?: @"", + @"elementDescription": [extractIssueProperty(issue, @"element") debugDescription] ?: @"", }]; return YES; }; From d3d9107139bb9d7a6149b224b75edc184a8180a6 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 31 Oct 2023 19:32:28 +0000 Subject: [PATCH 45/71] chore(release): 5.13.0 [skip ci] ## [5.13.0](https://github.com/appium/WebDriverAgent/compare/v5.12.3...v5.13.0) (2023-10-31) ### Features * Add "elementDescription" property to audit issues containing the debug description of an element ([#802](https://github.com/appium/WebDriverAgent/issues/802)) ([9925af4](https://github.com/appium/WebDriverAgent/commit/9925af44ec5fbfb66e6f034dfd93a6c25de48661)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcd3ee38f..ed392b5b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.13.0](https://github.com/appium/WebDriverAgent/compare/v5.12.3...v5.13.0) (2023-10-31) + + +### Features + +* Add "elementDescription" property to audit issues containing the debug description of an element ([#802](https://github.com/appium/WebDriverAgent/issues/802)) ([9925af4](https://github.com/appium/WebDriverAgent/commit/9925af44ec5fbfb66e6f034dfd93a6c25de48661)) + ## [5.12.3](https://github.com/appium/WebDriverAgent/compare/v5.12.2...v5.12.3) (2023-10-31) diff --git a/package.json b/package.json index 7696d13c9..bec7dbf83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.12.3", + "version": "5.13.0", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 0f2305d2559dc0807d7df0d0e06f7fc3c549701c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 17:41:52 +0100 Subject: [PATCH 46/71] chore(deps): bump asyncbox from 2.9.4 to 3.0.0 (#803) Bumps [asyncbox](https://github.com/jlipps/asyncbox) from 2.9.4 to 3.0.0. - [Commits](https://github.com/jlipps/asyncbox/commits/v3.0.0) --- updated-dependencies: - dependency-name: asyncbox dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bec7dbf83..50ec457f1 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "appium-ios-device": "^2.5.0", "appium-ios-simulator": "^5.0.1", "async-lock": "^1.0.0", - "asyncbox": "^2.5.3", + "asyncbox": "^3.0.0", "axios": "^1.4.0", "bluebird": "^3.5.5", "lodash": "^4.17.11", From 29fd2e2b7060182e9aa21a40da335d76fcfe0546 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 1 Nov 2023 16:53:48 +0000 Subject: [PATCH 47/71] chore(release): 5.13.1 [skip ci] ## [5.13.1](https://github.com/appium/WebDriverAgent/compare/v5.13.0...v5.13.1) (2023-11-01) ### Miscellaneous Chores * **deps:** bump asyncbox from 2.9.4 to 3.0.0 ([#803](https://github.com/appium/WebDriverAgent/issues/803)) ([0f2305d](https://github.com/appium/WebDriverAgent/commit/0f2305d2559dc0807d7df0d0e06f7fc3c549701c)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed392b5b4..c503cf2dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.13.1](https://github.com/appium/WebDriverAgent/compare/v5.13.0...v5.13.1) (2023-11-01) + + +### Miscellaneous Chores + +* **deps:** bump asyncbox from 2.9.4 to 3.0.0 ([#803](https://github.com/appium/WebDriverAgent/issues/803)) ([0f2305d](https://github.com/appium/WebDriverAgent/commit/0f2305d2559dc0807d7df0d0e06f7fc3c549701c)) + ## [5.13.0](https://github.com/appium/WebDriverAgent/compare/v5.12.3...v5.13.0) (2023-10-31) diff --git a/package.json b/package.json index 50ec457f1..349f6a3cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.13.0", + "version": "5.13.1", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 824f74c69769973858350bd5db0061510c546b09 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:50:18 +0100 Subject: [PATCH 48/71] chore(deps-dev): bump @types/sinon from 10.0.20 to 17.0.0 (#805) Bumps [@types/sinon](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/sinon) from 10.0.20 to 17.0.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/sinon) --- updated-dependencies: - dependency-name: "@types/sinon" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 349f6a3cb..4097a0993 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "@types/lodash": "^4.14.196", "@types/mocha": "^10.0.1", "@types/node": "^20.4.7", - "@types/sinon": "^10.0.16", + "@types/sinon": "^17.0.0", "@types/sinon-chai": "^3.2.9", "@types/teen_process": "^2.0.1", "@typescript-eslint/eslint-plugin": "^6.9.0", From c6c5df1851b30285696a0ac3fd1945955d1cf0eb Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 6 Nov 2023 17:14:37 +0000 Subject: [PATCH 49/71] chore(release): 5.13.2 [skip ci] ## [5.13.2](https://github.com/appium/WebDriverAgent/compare/v5.13.1...v5.13.2) (2023-11-06) ### Miscellaneous Chores * **deps-dev:** bump @types/sinon from 10.0.20 to 17.0.0 ([#805](https://github.com/appium/WebDriverAgent/issues/805)) ([824f74c](https://github.com/appium/WebDriverAgent/commit/824f74c69769973858350bd5db0061510c546b09)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c503cf2dd..c862368a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.13.2](https://github.com/appium/WebDriverAgent/compare/v5.13.1...v5.13.2) (2023-11-06) + + +### Miscellaneous Chores + +* **deps-dev:** bump @types/sinon from 10.0.20 to 17.0.0 ([#805](https://github.com/appium/WebDriverAgent/issues/805)) ([824f74c](https://github.com/appium/WebDriverAgent/commit/824f74c69769973858350bd5db0061510c546b09)) + ## [5.13.1](https://github.com/appium/WebDriverAgent/compare/v5.13.0...v5.13.1) (2023-11-01) diff --git a/package.json b/package.json index 4097a0993..762e03f5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.13.1", + "version": "5.13.2", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 79832bc6c69e289091fbbb97aee6a1f1d17ca4c3 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 9 Nov 2023 23:05:55 -0800 Subject: [PATCH 50/71] fix: unrecognized selector sent to instance 0x2829adb20 error in clear (#809) --- WebDriverAgentLib/Categories/XCUIElement+FBTyping.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m b/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m index a538be380..54b0d5362 100644 --- a/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m +++ b/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m @@ -143,7 +143,12 @@ - (BOOL)fb_clearTextWithSnapshot:(FBXCElementSnapshotWrapper *)snapshot do { if (retry >= MAX_CLEAR_RETRIES - 1) { // Last chance retry. Tripple-tap the field to select its content - [self tapWithNumberOfTaps:3 numberOfTouches:1]; + + if ([self respondsToSelector:@selector(tapWithNumberOfTaps:numberOfTouches:)]) { + // e.g. tvOS 17 raised unrecognized selector error for XCUIElementTypeSearchField + // while following typeText worked. + [self tapWithNumberOfTaps:3 numberOfTouches:1]; + } return [FBKeyboard typeText:backspaceDeleteSequence error:error]; } From 518858a8eee914e35c3d4e3c3783611bdedc4577 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 10 Nov 2023 07:11:28 +0000 Subject: [PATCH 51/71] chore(release): 5.13.3 [skip ci] ## [5.13.3](https://github.com/appium/WebDriverAgent/compare/v5.13.2...v5.13.3) (2023-11-10) ### Bug Fixes * unrecognized selector sent to instance 0x2829adb20 error in clear ([#809](https://github.com/appium/WebDriverAgent/issues/809)) ([79832bc](https://github.com/appium/WebDriverAgent/commit/79832bc6c69e289091fbbb97aee6a1f1d17ca4c3)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c862368a2..e93f006e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.13.3](https://github.com/appium/WebDriverAgent/compare/v5.13.2...v5.13.3) (2023-11-10) + + +### Bug Fixes + +* unrecognized selector sent to instance 0x2829adb20 error in clear ([#809](https://github.com/appium/WebDriverAgent/issues/809)) ([79832bc](https://github.com/appium/WebDriverAgent/commit/79832bc6c69e289091fbbb97aee6a1f1d17ca4c3)) + ## [5.13.2](https://github.com/appium/WebDriverAgent/compare/v5.13.1...v5.13.2) (2023-11-06) diff --git a/package.json b/package.json index 762e03f5e..e59934abe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.13.2", + "version": "5.13.3", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From dd093ea0b7209c3d2f3d0b1fa7f3a7b58507dd2d Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 10 Nov 2023 14:50:59 -0800 Subject: [PATCH 52/71] feat: use khidusage_keyboardclear to `clear` for iOS/iPad as the 1st attempt, tune tvOS (#811) * feat: Add khidusage_keyboardclear as possible option for text field clear on iOS * feat: tune clear text * revert * revert another place * tune for tvOS * leave testing note * remove unnecessary MAX_CLEAR_RETRIES * Update XCUIElement+FBTyping.m * Update XCUIElement+FBTyping.m --------- Co-authored-by: Mykola Mokhnach --- .../Categories/XCUIElement+FBTyping.m | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m b/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m index 54b0d5362..c6e31f4fc 100644 --- a/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m +++ b/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m @@ -15,11 +15,12 @@ #import "NSString+FBVisualLength.h" #import "FBXCElementSnapshotWrapper.h" #import "FBXCElementSnapshotWrapper+Helpers.h" +#import "XCUIDevice+FBHelpers.h" #import "XCUIElement+FBCaching.h" #import "XCUIElement+FBUtilities.h" #import "FBXCodeCompatibility.h" -#define MAX_CLEAR_RETRIES 2 +#define MAX_CLEAR_RETRIES 3 @interface NSString (FBRepeat) @@ -136,27 +137,32 @@ - (BOOL)fb_clearTextWithSnapshot:(FBXCElementSnapshotWrapper *)snapshot backspaceDeleteSequence = [[NSString alloc] initWithData:(NSData *)[@"\\u0008\\u007F" dataUsingEncoding:NSASCIIStringEncoding] encoding:NSNonLossyASCIIStringEncoding]; }); - + + NSUInteger preClearTextLength = [currentValue fb_visualLength]; + NSString *backspacesToType = [backspaceDeleteSequence fb_repeatTimes:preClearTextLength]; + +#if TARGET_OS_IOS NSUInteger retry = 0; NSString *placeholderValue = snapshot.placeholderValue; - NSUInteger preClearTextLength = [currentValue fb_visualLength]; do { - if (retry >= MAX_CLEAR_RETRIES - 1) { - // Last chance retry. Tripple-tap the field to select its content - - if ([self respondsToSelector:@selector(tapWithNumberOfTaps:numberOfTouches:)]) { - // e.g. tvOS 17 raised unrecognized selector error for XCUIElementTypeSearchField - // while following typeText worked. - [self tapWithNumberOfTaps:3 numberOfTouches:1]; - } - return [FBKeyboard typeText:backspaceDeleteSequence error:error]; - } - - NSString *textToType = [backspaceDeleteSequence fb_repeatTimes:preClearTextLength]; + // the ios needs to have keyboard focus to clear text if (shouldPrepareForInput && 0 == retry) { [self fb_prepareForTextInputWithSnapshot:snapshot]; } - if (![FBKeyboard typeText:textToType error:error]) { + + if (retry == 0) { + // 1st attempt is via the IOHIDEvent as the fastest operation + // https://github.com/appium/appium/issues/19389 + [[XCUIDevice sharedDevice] fb_performIOHIDEventWithPage:0x07 // kHIDPage_KeyboardOrKeypad + usage:0x9c // kHIDUsage_KeyboardClear + duration:0.01 + error:nil]; + } else if (retry >= MAX_CLEAR_RETRIES - 1) { + // Last chance retry. Tripple-tap the field to select its content + [self tapWithNumberOfTaps:3 numberOfTouches:1]; + return [FBKeyboard typeText:backspaceDeleteSequence error:error]; + } else if (![FBKeyboard typeText:backspacesToType error:error]) { + // 2nd operation return NO; } @@ -170,6 +176,13 @@ - (BOOL)fb_clearTextWithSnapshot:(FBXCElementSnapshotWrapper *)snapshot retry++; } while (preClearTextLength > 0); return YES; +#else + // tvOS does not need a focus. + // kHIDPage_KeyboardOrKeypad did not work for tvOS's search field. (tvOS 17 at least) + // Tested XCUIElementTypeSearchField and XCUIElementTypeTextView whch were + // common search field and email/passowrd input in tvOS apps. + return [FBKeyboard typeText:backspacesToType error:error]; +#endif } @end From b67222eac62a828a4b42fce80819281035830e7c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 10 Nov 2023 22:58:13 +0000 Subject: [PATCH 53/71] chore(release): 5.14.0 [skip ci] ## [5.14.0](https://github.com/appium/WebDriverAgent/compare/v5.13.3...v5.14.0) (2023-11-10) ### Features * use khidusage_keyboardclear to `clear` for iOS/iPad as the 1st attempt, tune tvOS ([#811](https://github.com/appium/WebDriverAgent/issues/811)) ([dd093ea](https://github.com/appium/WebDriverAgent/commit/dd093ea0b7209c3d2f3d0b1fa7f3a7b58507dd2d)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e93f006e4..69b8f87f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.14.0](https://github.com/appium/WebDriverAgent/compare/v5.13.3...v5.14.0) (2023-11-10) + + +### Features + +* use khidusage_keyboardclear to `clear` for iOS/iPad as the 1st attempt, tune tvOS ([#811](https://github.com/appium/WebDriverAgent/issues/811)) ([dd093ea](https://github.com/appium/WebDriverAgent/commit/dd093ea0b7209c3d2f3d0b1fa7f3a7b58507dd2d)) + ## [5.13.3](https://github.com/appium/WebDriverAgent/compare/v5.13.2...v5.13.3) (2023-11-10) diff --git a/package.json b/package.json index e59934abe..77f598f2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.13.3", + "version": "5.14.0", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 0d7e4a697adb7355279583eaa05118f396056e6f Mon Sep 17 00:00:00 2001 From: Ilya Kharebashvili Date: Thu, 16 Nov 2023 12:26:43 +0200 Subject: [PATCH 54/71] feat: Add element attributes to the performAccessibilityAudit output (#808) --- .../Categories/XCUIApplication+FBHelpers.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m index 4faaed1ae..2656de7d6 100644 --- a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m @@ -369,12 +369,19 @@ - (BOOL)fb_dismissKeyboardWithKeyNames:(nullable NSArray *)keyNames if (nil != auditTypeValue) { auditType = valuesToNamesMap[auditTypeValue] ?: [auditTypeValue stringValue]; } + + id extractedElement = extractIssueProperty(issue, @"element"); + + id elementSnapshot = [extractedElement fb_takeSnapshot]; + NSDictionary *elementAttributes = elementSnapshot ? [self.class dictionaryForElement:elementSnapshot recursive:NO] : @{}; + [resultArray addObject:@{ @"detailedDescription": extractIssueProperty(issue, @"detailedDescription") ?: @"", @"compactDescription": extractIssueProperty(issue, @"compactDescription") ?: @"", @"auditType": auditType, - @"element": [extractIssueProperty(issue, @"element") description] ?: @"", - @"elementDescription": [extractIssueProperty(issue, @"element") debugDescription] ?: @"", + @"element": [extractedElement description] ?: @"", + @"elementDescription": [extractedElement debugDescription] ?: @"", + @"elementAttributes": elementAttributes ?: @{}, }]; return YES; }; From 1e1905c5bf94cdd4dc4a2a917ac0a3bf9890a7c7 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 16 Nov 2023 10:32:25 +0000 Subject: [PATCH 55/71] chore(release): 5.15.0 [skip ci] ## [5.15.0](https://github.com/appium/WebDriverAgent/compare/v5.14.0...v5.15.0) (2023-11-16) ### Features * Add element attributes to the performAccessibilityAudit output ([#808](https://github.com/appium/WebDriverAgent/issues/808)) ([0d7e4a6](https://github.com/appium/WebDriverAgent/commit/0d7e4a697adb7355279583eaa05118f396056e6f)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69b8f87f7..539251658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.15.0](https://github.com/appium/WebDriverAgent/compare/v5.14.0...v5.15.0) (2023-11-16) + + +### Features + +* Add element attributes to the performAccessibilityAudit output ([#808](https://github.com/appium/WebDriverAgent/issues/808)) ([0d7e4a6](https://github.com/appium/WebDriverAgent/commit/0d7e4a697adb7355279583eaa05118f396056e6f)) + ## [5.14.0](https://github.com/appium/WebDriverAgent/compare/v5.13.3...v5.14.0) (2023-11-10) diff --git a/package.json b/package.json index 77f598f2f..d5568caef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.14.0", + "version": "5.15.0", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 0b41757c0d21004afab32860b4e510d4bc426018 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Thu, 16 Nov 2023 15:59:31 +0100 Subject: [PATCH 56/71] refactor: Optimize screenshots preprocessing (#812) --- WebDriverAgent.xcodeproj/project.pbxproj | 40 ++-- .../Commands/FBSessionCommands.m | 4 + WebDriverAgentLib/Utilities/FBConfiguration.h | 17 +- WebDriverAgentLib/Utilities/FBConfiguration.m | 10 + WebDriverAgentLib/Utilities/FBImageIOScaler.m | 195 ------------------ .../{FBImageIOScaler.h => FBImageProcessor.h} | 25 +-- .../Utilities/FBImageProcessor.m | 171 +++++++++++++++ WebDriverAgentLib/Utilities/FBImageUtils.h | 6 + WebDriverAgentLib/Utilities/FBImageUtils.m | 34 +++ WebDriverAgentLib/Utilities/FBMjpegServer.m | 33 ++- WebDriverAgentLib/Utilities/FBScreenshot.h | 13 -- WebDriverAgentLib/Utilities/FBScreenshot.m | 16 +- WebDriverAgentLib/Utilities/FBSettings.h | 1 + WebDriverAgentLib/Utilities/FBSettings.m | 1 + ...OScalerTests.m => FBImageProcessorTests.m} | 44 ++-- .../IntegrationTests/XCUIDeviceHelperTests.m | 12 +- 16 files changed, 313 insertions(+), 309 deletions(-) delete mode 100644 WebDriverAgentLib/Utilities/FBImageIOScaler.m rename WebDriverAgentLib/Utilities/{FBImageIOScaler.h => FBImageProcessor.h} (64%) create mode 100644 WebDriverAgentLib/Utilities/FBImageProcessor.m rename WebDriverAgentTests/IntegrationTests/{FBImageIOScalerTests.m => FBImageProcessorTests.m} (59%) diff --git a/WebDriverAgent.xcodeproj/project.pbxproj b/WebDriverAgent.xcodeproj/project.pbxproj index 3630797a6..836267cce 100644 --- a/WebDriverAgent.xcodeproj/project.pbxproj +++ b/WebDriverAgent.xcodeproj/project.pbxproj @@ -38,11 +38,11 @@ 315A15072518CC2800A3A064 /* TouchSpotView.m in Sources */ = {isa = PBXBuildFile; fileRef = 315A15062518CC2800A3A064 /* TouchSpotView.m */; }; 315A150A2518D6F400A3A064 /* TouchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 315A15092518D6F400A3A064 /* TouchViewController.m */; }; 6385F4A7220A40760095BBDB /* XCUIApplicationProcessDelay.m in Sources */ = {isa = PBXBuildFile; fileRef = 6385F4A5220A40760095BBDB /* XCUIApplicationProcessDelay.m */; }; - 63CCF91221ECE4C700E94ABD /* FBImageIOScaler.h in Headers */ = {isa = PBXBuildFile; fileRef = 63CCF91021ECE4C700E94ABD /* FBImageIOScaler.h */; }; - 63CCF91321ECE4C700E94ABD /* FBImageIOScaler.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CCF91121ECE4C700E94ABD /* FBImageIOScaler.m */; }; - 63FD950221F9D06100A3E356 /* FBImageIOScalerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 631B523421F6174300625362 /* FBImageIOScalerTests.m */; }; - 63FD950321F9D06100A3E356 /* FBImageIOScalerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 631B523421F6174300625362 /* FBImageIOScalerTests.m */; }; - 63FD950421F9D06200A3E356 /* FBImageIOScalerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 631B523421F6174300625362 /* FBImageIOScalerTests.m */; }; + 63CCF91221ECE4C700E94ABD /* FBImageProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 63CCF91021ECE4C700E94ABD /* FBImageProcessor.h */; }; + 63CCF91321ECE4C700E94ABD /* FBImageProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CCF91121ECE4C700E94ABD /* FBImageProcessor.m */; }; + 63FD950221F9D06100A3E356 /* FBImageProcessorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 631B523421F6174300625362 /* FBImageProcessorTests.m */; }; + 63FD950321F9D06100A3E356 /* FBImageProcessorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 631B523421F6174300625362 /* FBImageProcessorTests.m */; }; + 63FD950421F9D06200A3E356 /* FBImageProcessorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 631B523421F6174300625362 /* FBImageProcessorTests.m */; }; 641EE3452240C1C800173FCB /* UITestingUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7FD1CAEE048008C271F /* UITestingUITests.m */; }; 641EE5D72240C5CA00173FCB /* FBScreenshotCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB75F1CAEDF0C008C271F /* FBScreenshotCommands.m */; }; 641EE5D92240C5CA00173FCB /* XCUIElement+FBPickerWheel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7136A4781E8918E60024FC3D /* XCUIElement+FBPickerWheel.m */; }; @@ -80,7 +80,7 @@ 641EE5FE2240C5CA00173FCB /* XCUIElement+FBWebDriverAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = EEE376481D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.m */; }; 641EE5FF2240C5CA00173FCB /* XCUIElement+FBForceTouch.m in Sources */ = {isa = PBXBuildFile; fileRef = EE8DDD7C20C5733B004D4925 /* XCUIElement+FBForceTouch.m */; }; 641EE6002240C5CA00173FCB /* FBTouchActionCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = 71241D7A1FAE3D2500B9559F /* FBTouchActionCommands.m */; }; - 641EE6012240C5CA00173FCB /* FBImageIOScaler.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CCF91121ECE4C700E94ABD /* FBImageIOScaler.m */; }; + 641EE6012240C5CA00173FCB /* FBImageProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CCF91121ECE4C700E94ABD /* FBImageProcessor.m */; }; 641EE6022240C5CA00173FCB /* FBTouchIDCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7631CAEDF0C008C271F /* FBTouchIDCommands.m */; }; 641EE6032240C5CA00173FCB /* FBDebugCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7551CAEDF0C008C271F /* FBDebugCommands.m */; }; 641EE6042240C5CA00173FCB /* NSString+FBXMLSafeString.m in Sources */ = {isa = PBXBuildFile; fileRef = 716E0BCD1E917E810087A825 /* NSString+FBXMLSafeString.m */; }; @@ -222,7 +222,7 @@ 641EE6A32240C5CA00173FCB /* XCUIApplication+FBTouchAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 71BD20711F86116100B36EC2 /* XCUIApplication+FBTouchAction.h */; }; 641EE6A42240C5CA00173FCB /* FBCommandHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7751CAEDF0C008C271F /* FBCommandHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; 641EE6A52240C5CA00173FCB /* FBSessionCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7601CAEDF0C008C271F /* FBSessionCommands.h */; }; - 641EE6A62240C5CA00173FCB /* FBImageIOScaler.h in Headers */ = {isa = PBXBuildFile; fileRef = 63CCF91021ECE4C700E94ABD /* FBImageIOScaler.h */; }; + 641EE6A62240C5CA00173FCB /* FBImageProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 63CCF91021ECE4C700E94ABD /* FBImageProcessor.h */; }; 641EE6A72240C5CA00173FCB /* FBSession-Private.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7891CAEDF0C008C271F /* FBSession-Private.h */; }; 641EE6A82240C5CA00173FCB /* NSString+FBXMLSafeString.h in Headers */ = {isa = PBXBuildFile; fileRef = 716E0BCC1E917E810087A825 /* NSString+FBXMLSafeString.h */; }; 641EE6A92240C5CA00173FCB /* FBCommandStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7761CAEDF0C008C271F /* FBCommandStatus.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -918,11 +918,11 @@ 315A15082518D6F400A3A064 /* TouchViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TouchViewController.h; sourceTree = ""; }; 315A15092518D6F400A3A064 /* TouchViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TouchViewController.m; sourceTree = ""; }; 44757A831D42CE8300ECF35E /* XCUIDeviceRotationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XCUIDeviceRotationTests.m; sourceTree = ""; }; - 631B523421F6174300625362 /* FBImageIOScalerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBImageIOScalerTests.m; sourceTree = ""; }; + 631B523421F6174300625362 /* FBImageProcessorTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBImageProcessorTests.m; sourceTree = ""; }; 633E904A220DEE7F007CADF9 /* XCUIApplicationProcessDelay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XCUIApplicationProcessDelay.h; sourceTree = ""; }; 6385F4A5220A40760095BBDB /* XCUIApplicationProcessDelay.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XCUIApplicationProcessDelay.m; sourceTree = ""; }; - 63CCF91021ECE4C700E94ABD /* FBImageIOScaler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBImageIOScaler.h; sourceTree = ""; }; - 63CCF91121ECE4C700E94ABD /* FBImageIOScaler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBImageIOScaler.m; sourceTree = ""; }; + 63CCF91021ECE4C700E94ABD /* FBImageProcessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBImageProcessor.h; sourceTree = ""; }; + 63CCF91121ECE4C700E94ABD /* FBImageProcessor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBImageProcessor.m; sourceTree = ""; }; 641EE2DA2240BBE300173FCB /* WebDriverAgentRunner_tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebDriverAgentRunner_tvOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 641EE6F82240C5CA00173FCB /* WebDriverAgentLib_tvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebDriverAgentLib_tvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 641EE7042240CDCF00173FCB /* XCUIElement+FBTVFocuse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "XCUIElement+FBTVFocuse.h"; sourceTree = ""; }; @@ -1890,8 +1890,8 @@ EE3A18611CDE618F00DE4205 /* FBErrorBuilder.m */, EE6A89381D0B38640083E92B /* FBFailureProofTestCase.h */, EE6A89391D0B38640083E92B /* FBFailureProofTestCase.m */, - 63CCF91021ECE4C700E94ABD /* FBImageIOScaler.h */, - 63CCF91121ECE4C700E94ABD /* FBImageIOScaler.m */, + 63CCF91021ECE4C700E94ABD /* FBImageProcessor.h */, + 63CCF91121ECE4C700E94ABD /* FBImageProcessor.m */, 7150348521A6DAD600A0F4BA /* FBImageUtils.h */, 7150348621A6DAD600A0F4BA /* FBImageUtils.m */, EE9B76A31CF7A43900275851 /* FBLogger.h */, @@ -2004,7 +2004,7 @@ 71E504941DF59BAD0020C32A /* XCUIElementAttributesTests.m */, EEBBD48D1D4785FC00656A81 /* XCUIElementFBFindTests.m */, EE1E06E11D181CC9007CF043 /* XCUIElementHelperIntegrationTests.m */, - 631B523421F6174300625362 /* FBImageIOScalerTests.m */, + 631B523421F6174300625362 /* FBImageProcessorTests.m */, 644D9CCD230E1F1A00C90459 /* FBConfigurationTests.m */, ); path = IntegrationTests; @@ -2381,7 +2381,7 @@ 641EE6A42240C5CA00173FCB /* FBCommandHandler.h in Headers */, 641EE6A52240C5CA00173FCB /* FBSessionCommands.h in Headers */, 641EE70C2240CE2D00173FCB /* FBTVNavigationTracker.h in Headers */, - 641EE6A62240C5CA00173FCB /* FBImageIOScaler.h in Headers */, + 641EE6A62240C5CA00173FCB /* FBImageProcessor.h in Headers */, 641EE6A72240C5CA00173FCB /* FBSession-Private.h in Headers */, 641EE6A82240C5CA00173FCB /* NSString+FBXMLSafeString.h in Headers */, 64E3502F2AC0B6FE005F3ACB /* NSDictionary+FBUtf8SafeDictionary.h in Headers */, @@ -2622,7 +2622,7 @@ EE158AC81CBD456F00A3E3F0 /* FBSessionCommands.h in Headers */, 71C8E55125399A6B008572C1 /* XCUIApplication+FBQuiescence.h in Headers */, 641EE70B2240CE2D00173FCB /* FBTVNavigationTracker.h in Headers */, - 63CCF91221ECE4C700E94ABD /* FBImageIOScaler.h in Headers */, + 63CCF91221ECE4C700E94ABD /* FBImageProcessor.h in Headers */, EE158AE31CBD456F00A3E3F0 /* FBSession-Private.h in Headers */, 716E0BCE1E917E810087A825 /* NSString+FBXMLSafeString.h in Headers */, EE158ACF1CBD456F00A3E3F0 /* FBCommandStatus.h in Headers */, @@ -3122,7 +3122,7 @@ 641EE6002240C5CA00173FCB /* FBTouchActionCommands.m in Sources */, 719DCF182601EAFB000E765F /* FBNotificationsHelper.m in Sources */, 714EAA102673FDFE005C5B47 /* FBCapabilities.m in Sources */, - 641EE6012240C5CA00173FCB /* FBImageIOScaler.m in Sources */, + 641EE6012240C5CA00173FCB /* FBImageProcessor.m in Sources */, 641EE6022240C5CA00173FCB /* FBTouchIDCommands.m in Sources */, 641EE6032240C5CA00173FCB /* FBDebugCommands.m in Sources */, 641EE6042240C5CA00173FCB /* NSString+FBXMLSafeString.m in Sources */, @@ -3236,7 +3236,7 @@ EEE3764A1D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.m in Sources */, EE8DDD7E20C5733C004D4925 /* XCUIElement+FBForceTouch.m in Sources */, 71241D7C1FAE3D2500B9559F /* FBTouchActionCommands.m in Sources */, - 63CCF91321ECE4C700E94ABD /* FBImageIOScaler.m in Sources */, + 63CCF91321ECE4C700E94ABD /* FBImageProcessor.m in Sources */, EE158ACB1CBD456F00A3E3F0 /* FBTouchIDCommands.m in Sources */, 71F5BE51252F14EB00EE9EBA /* FBExceptions.m in Sources */, EE158ABD1CBD456F00A3E3F0 /* FBDebugCommands.m in Sources */, @@ -3307,7 +3307,7 @@ files = ( 71241D801FAF087500B9559F /* FBW3CMultiTouchActionsIntegrationTests.m in Sources */, 71241D7E1FAF084E00B9559F /* FBW3CTouchActionsIntegrationTests.m in Sources */, - 63FD950221F9D06100A3E356 /* FBImageIOScalerTests.m in Sources */, + 63FD950221F9D06100A3E356 /* FBImageProcessorTests.m in Sources */, 719CD8FF2126C90200C7D0C2 /* FBAutoAlertsHandlerTests.m in Sources */, EE2202131ECC612200A29571 /* FBIntegrationTestCase.m in Sources */, 71BD20781F869E0F00B36EC2 /* FBAppiumTouchActionsIntegrationTests.m in Sources */, @@ -3324,7 +3324,7 @@ buildActionMask = 2147483647; files = ( EE5095E51EBCC9090028E2FE /* FBTypingTest.m in Sources */, - 63FD950321F9D06100A3E356 /* FBImageIOScalerTests.m in Sources */, + 63FD950321F9D06100A3E356 /* FBImageProcessorTests.m in Sources */, EE5095EB1EBCC9090028E2FE /* XCElementSnapshotHitPointTests.m in Sources */, EE5095EC1EBCC9090028E2FE /* XCUIApplicationHelperTests.m in Sources */, 7136C0F9243A182400921C76 /* FBW3CTypeActionsTests.m in Sources */, @@ -3397,7 +3397,7 @@ 7119E1EC1E891F8600D0B125 /* FBPickerWheelSelectTests.m in Sources */, 71ACF5B8242F2FDC00F0AAD4 /* FBSafariAlertTests.m in Sources */, EE1E06DA1D1808C2007CF043 /* FBIntegrationTestCase.m in Sources */, - 63FD950421F9D06200A3E356 /* FBImageIOScalerTests.m in Sources */, + 63FD950421F9D06200A3E356 /* FBImageProcessorTests.m in Sources */, EE05BAFA1D13003C00A3EB00 /* FBKeyboardTests.m in Sources */, EE55B3271D1D54CF003AAAEC /* FBScrollingTests.m in Sources */, EE6A89371D0B35920083E92B /* FBFailureProofTestCaseTests.m in Sources */, diff --git a/WebDriverAgentLib/Commands/FBSessionCommands.m b/WebDriverAgentLib/Commands/FBSessionCommands.m index 7bd87a768..4a7ae1a8d 100644 --- a/WebDriverAgentLib/Commands/FBSessionCommands.m +++ b/WebDriverAgentLib/Commands/FBSessionCommands.m @@ -280,6 +280,7 @@ + (NSArray *)routes FB_SETTING_MJPEG_SERVER_SCREENSHOT_QUALITY: @([FBConfiguration mjpegServerScreenshotQuality]), FB_SETTING_MJPEG_SERVER_FRAMERATE: @([FBConfiguration mjpegServerFramerate]), FB_SETTING_MJPEG_SCALING_FACTOR: @([FBConfiguration mjpegScalingFactor]), + FB_SETTING_MJPEG_FIX_ORIENTATION: @([FBConfiguration mjpegShouldFixOrientation]), FB_SETTING_SCREENSHOT_QUALITY: @([FBConfiguration screenshotQuality]), FB_SETTING_KEYBOARD_AUTOCORRECTION: @([FBConfiguration keyboardAutocorrection]), FB_SETTING_KEYBOARD_PREDICTION: @([FBConfiguration keyboardPrediction]), @@ -327,6 +328,9 @@ + (NSArray *)routes if (nil != [settings objectForKey:FB_SETTING_MJPEG_SCALING_FACTOR]) { [FBConfiguration setMjpegScalingFactor:[[settings objectForKey:FB_SETTING_MJPEG_SCALING_FACTOR] unsignedIntegerValue]]; } + if (nil != [settings objectForKey:FB_SETTING_MJPEG_FIX_ORIENTATION]) { + [FBConfiguration setMjpegShouldFixOrientation:[[settings objectForKey:FB_SETTING_MJPEG_FIX_ORIENTATION] boolValue]]; + } if (nil != [settings objectForKey:FB_SETTING_KEYBOARD_AUTOCORRECTION]) { [FBConfiguration setKeyboardAutocorrection:[[settings objectForKey:FB_SETTING_KEYBOARD_AUTOCORRECTION] boolValue]]; } diff --git a/WebDriverAgentLib/Utilities/FBConfiguration.h b/WebDriverAgentLib/Utilities/FBConfiguration.h index 8bb9d48ca..dd0015e56 100644 --- a/WebDriverAgentLib/Utilities/FBConfiguration.h +++ b/WebDriverAgentLib/Utilities/FBConfiguration.h @@ -84,6 +84,16 @@ extern NSString *const FBSnapshotMaxDepthKey; + (NSUInteger)mjpegServerScreenshotQuality; + (void)setMjpegServerScreenshotQuality:(NSUInteger)quality; +/** + Whether to apply orientation fixes to the streamed JPEG images. + This is an expensive operation and it is disabled by default, so screenshots + are returned in portrait, but their actual orientation value could still be found in the EXIF + metadata. + ! Enablement of this setting may lead to WDA process termination because of an excessive CPU usage. + */ ++ (BOOL)mjpegShouldFixOrientation; ++ (void)setMjpegShouldFixOrientation:(BOOL)enabled; + /** The framerate at which the background screenshots broadcaster should broadcast screenshots in range 1..60. The default value is 10 (Frames Per Second). @@ -93,7 +103,7 @@ extern NSString *const FBSnapshotMaxDepthKey; + (void)setMjpegServerFramerate:(NSUInteger)framerate; /** - The quality of display screenshots. The higher quality you set is the bigger screenshot size is. + The quality of display screenshots. The higher quality you set is the bigger screenshot size is. The highest quality value is 0 (lossless PNG) or 3 (lossless HEIC). The lowest quality is 2 (highly compressed JPEG). The default quality value is 3 (lossless HEIC). See https://developer.apple.com/documentation/xctest/xctimagequality?language=objc @@ -112,7 +122,10 @@ extern NSString *const FBSnapshotMaxDepthKey; + (NSInteger)mjpegServerPort; /** - The scaling factor for frames of the mjpeg stream (Default values is 100 and does not perform scaling). + The scaling factor for frames of the mjpeg stream. The default (and maximum) value is 100, + which does not perform any scaling. The minimum value must be greater than zero. + ! Setting this to a value less than 100, especially together with orientation fixing enabled + ! may lead to WDA process termination because of an excessive CPU usage. */ + (NSUInteger)mjpegScalingFactor; + (void)setMjpegScalingFactor:(NSUInteger)scalingFactor; diff --git a/WebDriverAgentLib/Utilities/FBConfiguration.m b/WebDriverAgentLib/Utilities/FBConfiguration.m index f149d2193..03b6a6b1b 100644 --- a/WebDriverAgentLib/Utilities/FBConfiguration.m +++ b/WebDriverAgentLib/Utilities/FBConfiguration.m @@ -33,6 +33,7 @@ static BOOL FBShouldUseSingletonTestManager = YES; static NSUInteger FBMjpegScalingFactor = 100; +static BOOL FBMjpegShouldFixOrientation = NO; static NSUInteger FBMjpegServerScreenshotQuality = 25; static NSUInteger FBMjpegServerFramerate = 10; @@ -143,6 +144,15 @@ + (void)setMjpegScalingFactor:(NSUInteger)scalingFactor { FBMjpegScalingFactor = scalingFactor; } ++ (BOOL)mjpegShouldFixOrientation +{ + return FBMjpegShouldFixOrientation; +} + ++ (void)setMjpegShouldFixOrientation:(BOOL)enabled { + FBMjpegShouldFixOrientation = enabled; +} + + (BOOL)verboseLoggingEnabled { return [NSProcessInfo.processInfo.environment[@"VERBOSE_LOGGING"] boolValue]; diff --git a/WebDriverAgentLib/Utilities/FBImageIOScaler.m b/WebDriverAgentLib/Utilities/FBImageIOScaler.m deleted file mode 100644 index 0ca87b747..000000000 --- a/WebDriverAgentLib/Utilities/FBImageIOScaler.m +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "FBImageIOScaler.h" - -#import -#import -@import UniformTypeIdentifiers; - -#import "FBConfiguration.h" -#import "FBErrorBuilder.h" -#import "FBLogger.h" - -const CGFloat FBMinScalingFactor = 0.01f; -const CGFloat FBMaxScalingFactor = 1.0f; -const CGFloat FBMinCompressionQuality = 0.0f; -const CGFloat FBMaxCompressionQuality = 1.0f; - -@interface FBImageIOScaler () - -@property (nonatomic) NSData *nextImage; -@property (nonatomic, readonly) NSLock *nextImageLock; -@property (nonatomic, readonly) dispatch_queue_t scalingQueue; - -@end - -@implementation FBImageIOScaler - -- (id)init -{ - self = [super init]; - if (self) { - _nextImageLock = [[NSLock alloc] init]; - _scalingQueue = dispatch_queue_create("image.scaling.queue", NULL); - } - return self; -} - -- (void)submitImage:(NSData *)image - scalingFactor:(CGFloat)scalingFactor - compressionQuality:(CGFloat)compressionQuality - completionHandler:(void (^)(NSData *))completionHandler -{ - [self.nextImageLock lock]; - if (self.nextImage != nil) { - [FBLogger verboseLog:@"Discarding screenshot"]; - } - scalingFactor = MAX(FBMinScalingFactor, MIN(FBMaxScalingFactor, scalingFactor)); - compressionQuality = MAX(FBMinCompressionQuality, MIN(FBMaxCompressionQuality, compressionQuality)); - self.nextImage = image; - [self.nextImageLock unlock]; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcompletion-handler" - dispatch_async(self.scalingQueue, ^{ - [self.nextImageLock lock]; - NSData *next = self.nextImage; - self.nextImage = nil; - [self.nextImageLock unlock]; - if (next == nil) { - return; - } - - NSError *error; - NSData *scaled = [self scaledJpegImageWithImage:next - scalingFactor:scalingFactor - compressionQuality:compressionQuality - error:&error]; - if (scaled == nil) { - [FBLogger logFmt:@"%@", error.description]; - return; - } - completionHandler(scaled); - }); -#pragma clang diagnostic pop -} - -// This method is more optimized for JPEG scaling -// and should be used in `submitImage` API, while the `scaledImageWithImage` -// one is more generic -- (nullable NSData *)scaledJpegImageWithImage:(NSData *)image - scalingFactor:(CGFloat)scalingFactor - compressionQuality:(CGFloat)compressionQuality - error:(NSError **)error -{ - CGImageSourceRef imageData = CGImageSourceCreateWithData((CFDataRef)image, nil); - CGSize size = [self.class imageSizeWithImage:imageData]; - CGFloat scaledMaxPixelSize = MAX(size.width, size.height) * scalingFactor; - CFDictionaryRef params = (__bridge CFDictionaryRef)@{ - (const NSString *)kCGImageSourceCreateThumbnailWithTransform: @(YES), - (const NSString *)kCGImageSourceCreateThumbnailFromImageIfAbsent: @(YES), - (const NSString *)kCGImageSourceThumbnailMaxPixelSize: @(scaledMaxPixelSize) - }; - CGImageRef scaled = CGImageSourceCreateThumbnailAtIndex(imageData, 0, params); - CFRelease(imageData); - if (nil == scaled) { - [[[FBErrorBuilder builder] - withDescriptionFormat:@"Failed to scale the image"] - buildError:error]; - return nil; - } - NSData *resData = [self jpegDataWithImage:scaled - compressionQuality:compressionQuality]; - if (nil == resData) { - [[[FBErrorBuilder builder] - withDescriptionFormat:@"Failed to compress the image to JPEG format"] - buildError:error]; - } - CGImageRelease(scaled); - return resData; -} - -- (nullable NSData *)scaledImageWithImage:(NSData *)image - uti:(UTType *)uti - rect:(CGRect)rect - scalingFactor:(CGFloat)scalingFactor - compressionQuality:(CGFloat)compressionQuality - error:(NSError **)error -{ - UIImage *uiImage = [UIImage imageWithData:image]; - CGSize size = uiImage.size; - CGSize scaledSize = CGSizeMake(size.width * scalingFactor, size.height * scalingFactor); - UIGraphicsBeginImageContext(scaledSize); - UIImageOrientation orientation = uiImage.imageOrientation; -#if !TARGET_OS_TV - if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationPortrait) { - orientation = UIImageOrientationUp; - } else if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationPortraitUpsideDown) { - orientation = UIImageOrientationDown; - } else if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationLandscapeLeft) { - orientation = UIImageOrientationRight; - } else if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationLandscapeRight) { - orientation = UIImageOrientationLeft; - } -#endif - uiImage = [UIImage imageWithCGImage:(CGImageRef)uiImage.CGImage - scale:uiImage.scale - orientation:orientation]; - [uiImage drawInRect:CGRectMake(0, 0, scaledSize.width, scaledSize.height)]; - UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - if (!CGRectIsNull(rect)) { - UIGraphicsBeginImageContext(rect.size); - [resultImage drawAtPoint:CGPointMake(-rect.origin.x, -rect.origin.y)]; - resultImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - } - - return [uti conformsToType:UTTypePNG] - ? UIImagePNGRepresentation(resultImage) - : UIImageJPEGRepresentation(resultImage, compressionQuality); -} - -- (nullable NSData *)jpegDataWithImage:(CGImageRef)imageRef - compressionQuality:(CGFloat)compressionQuality -{ - NSMutableData *newImageData = [NSMutableData data]; - CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData( - (__bridge CFMutableDataRef) newImageData, - (__bridge CFStringRef) UTTypeJPEG.identifier, - 1, - NULL); - CFDictionaryRef compressionOptions = (__bridge CFDictionaryRef)@{ - (const NSString *)kCGImageDestinationLossyCompressionQuality: @(compressionQuality) - }; - CGImageDestinationAddImage(imageDestination, imageRef, compressionOptions); - if(!CGImageDestinationFinalize(imageDestination)) { - [FBLogger log:@"Failed to write the image"]; - newImageData = nil; - } - CFRelease(imageDestination); - return newImageData; -} - -+ (CGSize)imageSizeWithImage:(CGImageSourceRef)imageSource -{ - NSDictionary *options = @{ - (const NSString *)kCGImageSourceShouldCache: @(NO) - }; - CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, (CFDictionaryRef)options); - NSNumber *width = [(__bridge NSDictionary *)properties objectForKey:(const NSString *)kCGImagePropertyPixelWidth]; - NSNumber *height = [(__bridge NSDictionary *)properties objectForKey:(const NSString *)kCGImagePropertyPixelHeight]; - CGSize size = CGSizeMake([width floatValue], [height floatValue]); - CFRelease(properties); - return size; -} - -@end diff --git a/WebDriverAgentLib/Utilities/FBImageIOScaler.h b/WebDriverAgentLib/Utilities/FBImageProcessor.h similarity index 64% rename from WebDriverAgentLib/Utilities/FBImageIOScaler.h rename to WebDriverAgentLib/Utilities/FBImageProcessor.h index 476daba04..a350bd9ce 100644 --- a/WebDriverAgentLib/Utilities/FBImageIOScaler.h +++ b/WebDriverAgentLib/Utilities/FBImageProcessor.h @@ -20,7 +20,7 @@ extern const CGFloat FBMaxScalingFactor; extern const CGFloat FBMinCompressionQuality; extern const CGFloat FBMaxCompressionQuality; -@interface FBImageIOScaler : NSObject +@interface FBImageProcessor : NSObject /** Puts the passed image on the queue and dispatches a scaling operation. If there is already a image on the @@ -29,34 +29,27 @@ extern const CGFloat FBMaxCompressionQuality; @param image The image to scale down @param completionHandler called after successfully scaling down an image @param scalingFactor the scaling factor in range 0.01..1.0. A value of 1.0 won't perform scaling at all - @param compressionQuality the compression quality in range 0.0..1.0 (0.0 for max. compression and 1.0 for lossless compression) - Only applicable for UTTypeJPEG */ -- (void)submitImage:(NSData *)image - scalingFactor:(CGFloat)scalingFactor - compressionQuality:(CGFloat)compressionQuality - completionHandler:(void (^)(NSData *))completionHandler; +- (void)submitImageData:(NSData *)image + scalingFactor:(CGFloat)scalingFactor + completionHandler:(void (^)(NSData *))completionHandler; /** Scales and crops the source image @param image The source image data @param uti Either UTTypePNG or UTTypeJPEG - @param rect The cropping rectange for the screenshot. The value is expected to be non-scaled one - since it happens after scaling/orientation change. - CGRectNull could be used to take a screenshot of the full screen. @param scalingFactor Scaling factor in range 0.01..1.0. A value of 1.0 won't perform scaling at all @param compressionQuality the compression quality in range 0.0..1.0 (0.0 for max. compression and 1.0 for lossless compression). Only works if UTI is set to kUTTypeJPEG @param error The actual error instance if the returned result is nil @returns Processed image data compressed according to the given UTI or nil in case of a failure */ -- (nullable NSData *)scaledImageWithImage:(NSData *)image - uti:(UTType *)uti - rect:(CGRect)rect - scalingFactor:(CGFloat)scalingFactor - compressionQuality:(CGFloat)compressionQuality - error:(NSError **)error; +- (nullable NSData *)scaledImageWithData:(NSData *)image + uti:(UTType *)uti + scalingFactor:(CGFloat)scalingFactor + compressionQuality:(CGFloat)compressionQuality + error:(NSError **)error; @end diff --git a/WebDriverAgentLib/Utilities/FBImageProcessor.m b/WebDriverAgentLib/Utilities/FBImageProcessor.m new file mode 100644 index 000000000..16601ce8e --- /dev/null +++ b/WebDriverAgentLib/Utilities/FBImageProcessor.m @@ -0,0 +1,171 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import "FBImageProcessor.h" + +#import +#import +@import UniformTypeIdentifiers; + +#import "FBConfiguration.h" +#import "FBErrorBuilder.h" +#import "FBImageUtils.h" +#import "FBLogger.h" + +const CGFloat FBMinScalingFactor = 0.01f; +const CGFloat FBMaxScalingFactor = 1.0f; +const CGFloat FBMinCompressionQuality = 0.0f; +const CGFloat FBMaxCompressionQuality = 1.0f; + +@interface FBImageProcessor () + +@property (nonatomic) NSData *nextImage; +@property (nonatomic, readonly) NSLock *nextImageLock; +@property (nonatomic, readonly) dispatch_queue_t scalingQueue; + +@end + +@implementation FBImageProcessor + +- (id)init +{ + self = [super init]; + if (self) { + _nextImageLock = [[NSLock alloc] init]; + _scalingQueue = dispatch_queue_create("image.scaling.queue", NULL); + } + return self; +} + +- (void)submitImageData:(NSData *)image + scalingFactor:(CGFloat)scalingFactor + completionHandler:(void (^)(NSData *))completionHandler +{ + [self.nextImageLock lock]; + if (self.nextImage != nil) { + [FBLogger verboseLog:@"Discarding screenshot"]; + } + self.nextImage = image; + [self.nextImageLock unlock]; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcompletion-handler" + dispatch_async(self.scalingQueue, ^{ + [self.nextImageLock lock]; + NSData *nextImageData = self.nextImage; + self.nextImage = nil; + [self.nextImageLock unlock]; + if (nextImageData == nil) { + return; + } + + // We do not want this value to be too high because then we get images larger in size than original ones + // Although, we also don't want to lose too much of the quality on recompression + CGFloat recompressionQuality = MAX(0.9, + MIN(FBMaxCompressionQuality, FBConfiguration.mjpegServerScreenshotQuality / 100.0)); + NSData *thumbnailData = [self.class fixedImageDataWithImageData:nextImageData + scalingFactor:scalingFactor + uti:UTTypeJPEG + compressionQuality:recompressionQuality + // iOS always returns screnshots in portrait orientation, but puts the real value into the metadata + // Use it with care. See https://github.com/appium/WebDriverAgent/pull/812 + fixOrientation:FBConfiguration.mjpegShouldFixOrientation + desiredOrientation:nil]; + completionHandler(thumbnailData ?: nextImageData); + }); +#pragma clang diagnostic pop +} + ++ (nullable NSData *)fixedImageDataWithImageData:(NSData *)imageData + scalingFactor:(CGFloat)scalingFactor + uti:(UTType *)uti + compressionQuality:(CGFloat)compressionQuality + fixOrientation:(BOOL)fixOrientation + desiredOrientation:(nullable NSNumber *)orientation +{ + scalingFactor = MAX(FBMinScalingFactor, MIN(FBMaxScalingFactor, scalingFactor)); + BOOL usesScaling = scalingFactor > 0.0 && scalingFactor < FBMaxScalingFactor; + @autoreleasepool { + if (!usesScaling && !fixOrientation) { + return [uti conformsToType:UTTypePNG] ? FBToPngData(imageData) : FBToJpegData(imageData, compressionQuality); + } + + UIImage *image = [UIImage imageWithData:imageData]; + if (nil == image + || ((image.imageOrientation == UIImageOrientationUp || !fixOrientation) && !usesScaling)) { + return [uti conformsToType:UTTypePNG] ? FBToPngData(imageData) : FBToJpegData(imageData, compressionQuality); + } + + CGSize scaledSize = CGSizeMake(image.size.width * scalingFactor, image.size.height * scalingFactor); + if (!fixOrientation && usesScaling) { + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + __block UIImage *result = nil; + [image prepareThumbnailOfSize:scaledSize + completionHandler:^(UIImage * _Nullable thumbnail) { + result = thumbnail; + dispatch_semaphore_signal(semaphore); + }]; + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); + if (nil == result) { + return [uti conformsToType:UTTypePNG] ? FBToPngData(imageData) : FBToJpegData(imageData, compressionQuality); + } + return [uti conformsToType:UTTypePNG] + ? UIImagePNGRepresentation(result) + : UIImageJPEGRepresentation(result, compressionQuality); + } + + UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init]; + format.scale = scalingFactor; + UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:scaledSize + format:format]; + UIImageOrientation desiredOrientation = orientation == nil + ? image.imageOrientation + : (UIImageOrientation)orientation.integerValue; + UIImage *uiImage = [UIImage imageWithCGImage:(CGImageRef)image.CGImage + scale:image.scale + orientation:desiredOrientation]; + return [uti conformsToType:UTTypePNG] + ? [renderer PNGDataWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) { + [uiImage drawInRect:CGRectMake(0, 0, scaledSize.width, scaledSize.height)]; + }] + : [renderer JPEGDataWithCompressionQuality:compressionQuality + actions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) { + [uiImage drawInRect:CGRectMake(0, 0, scaledSize.width, scaledSize.height)]; + }]; + } +} + +- (nullable NSData *)scaledImageWithData:(NSData *)imageData + uti:(UTType *)uti + scalingFactor:(CGFloat)scalingFactor + compressionQuality:(CGFloat)compressionQuality + error:(NSError **)error +{ + NSNumber *orientation = nil; +#if !TARGET_OS_TV + if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationPortrait) { + orientation = @(UIImageOrientationUp); + } else if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationPortraitUpsideDown) { + orientation = @(UIImageOrientationDown); + } else if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationLandscapeLeft) { + orientation = @(UIImageOrientationRight); + } else if (FBConfiguration.screenshotOrientation == UIInterfaceOrientationLandscapeRight) { + orientation = @(UIImageOrientationLeft); + } +#endif + NSData *resultData = [self.class fixedImageDataWithImageData:imageData + scalingFactor:scalingFactor + uti:uti + compressionQuality:compressionQuality + fixOrientation:YES + desiredOrientation:orientation]; + return resultData ?: imageData; +} + +@end diff --git a/WebDriverAgentLib/Utilities/FBImageUtils.h b/WebDriverAgentLib/Utilities/FBImageUtils.h index 96ea15a6b..15a04f6fe 100644 --- a/WebDriverAgentLib/Utilities/FBImageUtils.h +++ b/WebDriverAgentLib/Utilities/FBImageUtils.h @@ -17,4 +17,10 @@ BOOL FBIsPngImage(NSData *imageData); /*! Converts the given image data to a PNG representation if necessary */ NSData *_Nullable FBToPngData(NSData *imageData); +/*! Returns YES if the data contains a JPG image */ +BOOL FBIsJpegImage(NSData *imageData); + +/*! Converts the given image data to a JPG representation if necessary */ +NSData *_Nullable FBToJpegData(NSData *imageData, CGFloat compressionQuality); + NS_ASSUME_NONNULL_END diff --git a/WebDriverAgentLib/Utilities/FBImageUtils.m b/WebDriverAgentLib/Utilities/FBImageUtils.m index 5983ddc30..b1d2f9b5b 100644 --- a/WebDriverAgentLib/Utilities/FBImageUtils.m +++ b/WebDriverAgentLib/Utilities/FBImageUtils.m @@ -12,8 +12,11 @@ #import "FBMacros.h" #import "FBConfiguration.h" +// https://en.wikipedia.org/wiki/List_of_file_signatures static uint8_t PNG_MAGIC[] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }; static const NSUInteger PNG_MAGIC_LEN = 8; +static uint8_t JPG_MAGIC[] = { 0xff, 0xd8, 0xff }; +static const NSUInteger JPG_MAGIC_LEN = 3; BOOL FBIsPngImage(NSData *imageData) { @@ -45,3 +48,34 @@ BOOL FBIsPngImage(NSData *imageData) UIImage *image = [UIImage imageWithData:imageData]; return nil == image ? nil : (NSData *)UIImagePNGRepresentation(image); } + +BOOL FBIsJpegImage(NSData *imageData) +{ + if (nil == imageData || [imageData length] < JPG_MAGIC_LEN) { + return NO; + } + + static NSData* jpgMagicStartData = nil; + static dispatch_once_t onceJpgToken; + dispatch_once(&onceJpgToken, ^{ + jpgMagicStartData = [NSData dataWithBytesNoCopy:(void*)JPG_MAGIC length:JPG_MAGIC_LEN freeWhenDone:NO]; + }); + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wassign-enum" + NSRange range = [imageData rangeOfData:jpgMagicStartData options:kNilOptions range:NSMakeRange(0, JPG_MAGIC_LEN)]; +#pragma clang diagnostic pop + return range.location != NSNotFound; +} + +NSData *FBToJpegData(NSData *imageData, CGFloat compressionQuality) { + if (nil == imageData || [imageData length] < JPG_MAGIC_LEN) { + return nil; + } + if (FBIsJpegImage(imageData)) { + return imageData; + } + + UIImage *image = [UIImage imageWithData:imageData]; + return nil == image ? nil : (NSData *)UIImageJPEGRepresentation(image, compressionQuality); +} diff --git a/WebDriverAgentLib/Utilities/FBMjpegServer.m b/WebDriverAgentLib/Utilities/FBMjpegServer.m index 51fa48687..a0970e256 100644 --- a/WebDriverAgentLib/Utilities/FBMjpegServer.m +++ b/WebDriverAgentLib/Utilities/FBMjpegServer.m @@ -17,7 +17,8 @@ #import "FBConfiguration.h" #import "FBLogger.h" #import "FBScreenshot.h" -#import "FBImageIOScaler.h" +#import "FBImageProcessor.h" +#import "FBImageUtils.h" #import "XCUIScreen.h" static const NSUInteger MAX_FPS = 60; @@ -31,7 +32,7 @@ @interface FBMjpegServer() @property (nonatomic, readonly) dispatch_queue_t backgroundQueue; @property (nonatomic, readonly) NSMutableArray *listeningClients; -@property (nonatomic, readonly) FBImageIOScaler *imageScaler; +@property (nonatomic, readonly) FBImageProcessor *imageProcessor; @property (nonatomic, readonly) long long mainScreenID; @end @@ -48,7 +49,7 @@ - (instancetype)init dispatch_async(_backgroundQueue, ^{ [self streamScreenshot]; }); - _imageScaler = [[FBImageIOScaler alloc] init]; + _imageProcessor = [[FBImageProcessor alloc] init]; _mainScreenID = [XCUIScreen.mainScreen displayID]; } return self; @@ -82,15 +83,11 @@ - (void)streamScreenshot } } - CGFloat scalingFactor = [FBConfiguration mjpegScalingFactor] / 100.0f; - BOOL usesScaling = fabs(FBMaxScalingFactor - scalingFactor) > DBL_EPSILON; - CGFloat compressionQuality = FBConfiguration.mjpegServerScreenshotQuality / 100.0f; - // If scaling is applied we perform another JPEG compression after scaling - // To get the desired compressionQuality we need to do a lossless compression here - CGFloat screenshotCompressionQuality = usesScaling ? FBMaxCompressionQuality : compressionQuality; NSError *error; + CGFloat compressionQuality = MAX(FBMinCompressionQuality, + MIN(FBMaxCompressionQuality, FBConfiguration.mjpegServerScreenshotQuality / 100.0)); NSData *screenshotData = [FBScreenshot takeInOriginalResolutionWithScreenID:self.mainScreenID - compressionQuality:screenshotCompressionQuality + compressionQuality:compressionQuality uti:UTTypeJPEG timeout:FRAME_TIMEOUT error:&error]; @@ -100,16 +97,12 @@ - (void)streamScreenshot return; } - if (usesScaling) { - [self.imageScaler submitImage:screenshotData - scalingFactor:scalingFactor - compressionQuality:compressionQuality - completionHandler:^(NSData * _Nonnull scaled) { - [self sendScreenshot:scaled]; - }]; - } else { - [self sendScreenshot:screenshotData]; - } + CGFloat scalingFactor = FBConfiguration.mjpegScalingFactor / 100.0; + [self.imageProcessor submitImageData:screenshotData + scalingFactor:scalingFactor + completionHandler:^(NSData * _Nonnull scaled) { + [self sendScreenshot:scaled]; + }]; [self scheduleNextScreenshotWithInterval:timerInterval timeStarted:timeStarted]; } diff --git a/WebDriverAgentLib/Utilities/FBScreenshot.h b/WebDriverAgentLib/Utilities/FBScreenshot.h index 036a5e1cb..74e6b5886 100644 --- a/WebDriverAgentLib/Utilities/FBScreenshot.h +++ b/WebDriverAgentLib/Utilities/FBScreenshot.h @@ -24,19 +24,6 @@ NS_ASSUME_NONNULL_BEGIN + (nullable NSData *)takeInOriginalResolutionWithQuality:(NSUInteger)quality error:(NSError **)error; -/** - Retrieves non-scaled screenshot of the particular screen rectangle - - @param quality The number in range 0-3, where 0 is PNG (lossless), 3 is HEIC (lossless), 1- low quality JPEG and 2 - high quality JPEG - @param rect The bounding rectange for the screenshot. The value is expected be non-scaled one. - CGRectNull could be used to take a screenshot of the full screen. - @param error If there is an error, upon return contains an NSError object that describes the problem. - @return Device screenshot as PNG-encoded data or nil in case of failure - */ -+ (nullable NSData *)takeInOriginalResolutionWithQuality:(NSUInteger)quality - rect:(CGRect)rect - error:(NSError **)error; - /** Retrieves non-scaled screenshot of the whole screen diff --git a/WebDriverAgentLib/Utilities/FBScreenshot.m b/WebDriverAgentLib/Utilities/FBScreenshot.m index 8cea6530d..3d9716dea 100644 --- a/WebDriverAgentLib/Utilities/FBScreenshot.m +++ b/WebDriverAgentLib/Utilities/FBScreenshot.m @@ -13,7 +13,7 @@ #import "FBConfiguration.h" #import "FBErrorBuilder.h" -#import "FBImageIOScaler.h" +#import "FBImageProcessor.h" #import "FBLogger.h" #import "FBMacros.h" #import "FBXCodeCompatibility.h" @@ -59,30 +59,19 @@ + (UTType *)imageUtiWithQuality:(NSUInteger)quality } + (NSData *)takeInOriginalResolutionWithQuality:(NSUInteger)quality - rect:(CGRect)rect error:(NSError **)error { XCUIScreen *mainScreen = XCUIScreen.mainScreen; return [self.class takeWithScreenID:mainScreen.displayID scale:SCREENSHOT_SCALE compressionQuality:[self.class compressionQualityWithQuality:quality] - rect:rect sourceUTI:[self.class imageUtiWithQuality:quality] error:error]; } -+ (NSData *)takeInOriginalResolutionWithQuality:(NSUInteger)quality - error:(NSError **)error -{ - return [self.class takeInOriginalResolutionWithQuality:quality - rect:CGRectNull - error:error]; -} - + (NSData *)takeWithScreenID:(long long)screenID scale:(CGFloat)scale compressionQuality:(CGFloat)compressionQuality - rect:(CGRect)rect sourceUTI:(UTType *)uti error:(NSError **)error { @@ -94,9 +83,8 @@ + (NSData *)takeWithScreenID:(long long)screenID if (nil == screenshotData) { return nil; } - return [[[FBImageIOScaler alloc] init] scaledImageWithImage:screenshotData + return [[[FBImageProcessor alloc] init] scaledImageWithData:screenshotData uti:UTTypePNG - rect:rect scalingFactor:1.0 / scale compressionQuality:FBMaxCompressionQuality error:error]; diff --git a/WebDriverAgentLib/Utilities/FBSettings.h b/WebDriverAgentLib/Utilities/FBSettings.h index 8235cb337..dd82d740c 100644 --- a/WebDriverAgentLib/Utilities/FBSettings.h +++ b/WebDriverAgentLib/Utilities/FBSettings.h @@ -17,6 +17,7 @@ extern NSString* const FB_SETTING_USE_COMPACT_RESPONSES; extern NSString* const FB_SETTING_ELEMENT_RESPONSE_ATTRIBUTES; extern NSString* const FB_SETTING_MJPEG_SERVER_SCREENSHOT_QUALITY; extern NSString* const FB_SETTING_MJPEG_SERVER_FRAMERATE; +extern NSString* const FB_SETTING_MJPEG_FIX_ORIENTATION; extern NSString* const FB_SETTING_MJPEG_SCALING_FACTOR; extern NSString* const FB_SETTING_SCREENSHOT_QUALITY; extern NSString* const FB_SETTING_KEYBOARD_AUTOCORRECTION; diff --git a/WebDriverAgentLib/Utilities/FBSettings.m b/WebDriverAgentLib/Utilities/FBSettings.m index 26bae07e0..6b12a4cd4 100644 --- a/WebDriverAgentLib/Utilities/FBSettings.m +++ b/WebDriverAgentLib/Utilities/FBSettings.m @@ -14,6 +14,7 @@ NSString* const FB_SETTING_MJPEG_SERVER_SCREENSHOT_QUALITY = @"mjpegServerScreenshotQuality"; NSString* const FB_SETTING_MJPEG_SERVER_FRAMERATE = @"mjpegServerFramerate"; NSString* const FB_SETTING_MJPEG_SCALING_FACTOR = @"mjpegScalingFactor"; +NSString* const FB_SETTING_MJPEG_FIX_ORIENTATION = @"mjpegFixOrientation"; NSString* const FB_SETTING_SCREENSHOT_QUALITY = @"screenshotQuality"; NSString* const FB_SETTING_KEYBOARD_AUTOCORRECTION = @"keyboardAutocorrection"; NSString* const FB_SETTING_KEYBOARD_PREDICTION = @"keyboardPrediction"; diff --git a/WebDriverAgentTests/IntegrationTests/FBImageIOScalerTests.m b/WebDriverAgentTests/IntegrationTests/FBImageProcessorTests.m similarity index 59% rename from WebDriverAgentTests/IntegrationTests/FBImageIOScalerTests.m rename to WebDriverAgentTests/IntegrationTests/FBImageProcessorTests.m index 0c2f75b62..28fa9d7ee 100644 --- a/WebDriverAgentTests/IntegrationTests/FBImageIOScalerTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBImageProcessorTests.m @@ -9,62 +9,62 @@ #import -#import "FBImageIOScaler.h" +#import "FBImageProcessor.h" #import "FBIntegrationTestCase.h" -@interface FBImageIOScalerTests : FBIntegrationTestCase +@interface FBImageProcessorTests : FBIntegrationTestCase @property (nonatomic) NSData *originalImage; @property (nonatomic) CGSize originalSize; @end -@implementation FBImageIOScalerTests +@implementation FBImageProcessorTests - (void)setUp { XCUIApplication *app = [[XCUIApplication alloc] init]; [app launch]; XCUIScreenshot *screenshot = app.screenshot; self.originalImage = UIImageJPEGRepresentation(screenshot.image, 1.0); - self.originalSize = [FBImageIOScalerTests scaledSizeFromImage:screenshot.image]; + self.originalSize = [FBImageProcessorTests scaledSizeFromImage:screenshot.image]; } - (void)testScaling { CGFloat halfScale = 0.5; - CGSize expectedHalfScaleSize = [FBImageIOScalerTests sizeFromSize:self.originalSize scalingFactor:0.5]; + CGSize expectedHalfScaleSize = [FBImageProcessorTests sizeFromSize:self.originalSize scalingFactor:0.5]; [self scaleImageWithFactor:halfScale expectedSize:expectedHalfScaleSize]; - // 1 is the smalles scaling factor we accept + // 0 is the smalles scaling factor we accept CGFloat minScale = 0.0; - CGSize expectedMinScaleSize = [FBImageIOScalerTests sizeFromSize:self.originalSize scalingFactor:0.01]; + CGSize expectedMinScaleSize = [FBImageProcessorTests sizeFromSize:self.originalSize scalingFactor:0.01]; [self scaleImageWithFactor:minScale expectedSize:expectedMinScaleSize]; // For scaling factors above 100 we don't perform any scaling and just return the unmodified image - CGFloat unscaled = 2.0; - [self scaleImageWithFactor:unscaled + [self scaleImageWithFactor:1.0 + expectedSize:self.originalSize]; + [self scaleImageWithFactor:2.0 expectedSize:self.originalSize]; } - (void)scaleImageWithFactor:(CGFloat)scalingFactor expectedSize:(CGSize)excpectedSize { - FBImageIOScaler *scaler = [[FBImageIOScaler alloc] init]; + FBImageProcessor *scaler = [[FBImageProcessor alloc] init]; id expScaled = [self expectationWithDescription:@"Receive scaled image"]; - [scaler submitImage:self.originalImage - scalingFactor:scalingFactor - compressionQuality:1.0 - completionHandler:^(NSData *scaled) { - UIImage *scaledImage = [UIImage imageWithData:scaled]; - CGSize scaledSize = [FBImageIOScalerTests scaledSizeFromImage:scaledImage]; - - XCTAssertEqualWithAccuracy(scaledSize.width, excpectedSize.width, 1.0); - XCTAssertEqualWithAccuracy(scaledSize.height, excpectedSize.height, 1.0); - - [expScaled fulfill]; - }]; + [scaler submitImageData:self.originalImage + scalingFactor:scalingFactor + completionHandler:^(NSData *scaled) { + UIImage *scaledImage = [UIImage imageWithData:scaled]; + CGSize scaledSize = [FBImageProcessorTests scaledSizeFromImage:scaledImage]; + + XCTAssertEqualWithAccuracy(scaledSize.width, excpectedSize.width, 1.0); + XCTAssertEqualWithAccuracy(scaledSize.height, excpectedSize.height, 1.0); + + [expScaled fulfill]; + }]; [self waitForExpectations:@[expScaled] timeout:0.5]; diff --git a/WebDriverAgentTests/IntegrationTests/XCUIDeviceHelperTests.m b/WebDriverAgentTests/IntegrationTests/XCUIDeviceHelperTests.m index 52a910311..ca79b2fa4 100644 --- a/WebDriverAgentTests/IntegrationTests/XCUIDeviceHelperTests.m +++ b/WebDriverAgentTests/IntegrationTests/XCUIDeviceHelperTests.m @@ -78,14 +78,12 @@ - (void)testLandscapeScreenshot XCTAssertTrue(screenshot.size.width > screenshot.size.height); XCUIScreen *mainScreen = XCUIScreen.mainScreen; - // TODO: This screenshot rotation was not landscape in an iOS 16 beta simulator. UIImage *screenshotExact = ((XCUIScreenshot *)mainScreen.screenshot).image; - XCTAssertEqualWithAccuracy(screenshotExact.size.height * mainScreen.scale, - screenshot.size.height, - FLT_EPSILON); - XCTAssertEqualWithAccuracy(screenshotExact.size.width * mainScreen.scale, - screenshot.size.width, - FLT_EPSILON); + CGSize realMainScreenSize = screenshotExact.size.height > screenshot.size.width + ? CGSizeMake(screenshotExact.size.height * mainScreen.scale, screenshotExact.size.width * mainScreen.scale) + : CGSizeMake(screenshotExact.size.width * mainScreen.scale, screenshotExact.size.height * mainScreen.scale); + XCTAssertEqualWithAccuracy(realMainScreenSize.height, screenshot.size.height, FLT_EPSILON); + XCTAssertEqualWithAccuracy(realMainScreenSize.width, screenshot.size.width, FLT_EPSILON); } - (void)testWifiAddress From b4704dafc4567e1f0dc8675facfc48a195aae4bf Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Thu, 16 Nov 2023 22:15:35 +0100 Subject: [PATCH 57/71] fix: Content-Type of the MJPEG server --- WebDriverAgentLib/Utilities/FBMjpegServer.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebDriverAgentLib/Utilities/FBMjpegServer.m b/WebDriverAgentLib/Utilities/FBMjpegServer.m index a0970e256..14a734c94 100644 --- a/WebDriverAgentLib/Utilities/FBMjpegServer.m +++ b/WebDriverAgentLib/Utilities/FBMjpegServer.m @@ -108,7 +108,7 @@ - (void)streamScreenshot } - (void)sendScreenshot:(NSData *)screenshotData { - NSString *chunkHeader = [NSString stringWithFormat:@"--BoundaryString\r\nContent-type: image/jpg\r\nContent-Length: %@\r\n\r\n", @(screenshotData.length)]; + NSString *chunkHeader = [NSString stringWithFormat:@"--BoundaryString\r\nContent-type: image/jpeg\r\nContent-Length: %@\r\n\r\n", @(screenshotData.length)]; NSMutableData *chunk = [[chunkHeader dataUsingEncoding:NSUTF8StringEncoding] mutableCopy]; [chunk appendData:screenshotData]; [chunk appendData:(id)[@"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; From d0dbbb87de7cce3d3687bda3bd53807af14dd795 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 16 Nov 2023 21:20:34 +0000 Subject: [PATCH 58/71] chore(release): 5.15.1 [skip ci] ## [5.15.1](https://github.com/appium/WebDriverAgent/compare/v5.15.0...v5.15.1) (2023-11-16) ### Bug Fixes * Content-Type of the MJPEG server ([b4704da](https://github.com/appium/WebDriverAgent/commit/b4704dafc4567e1f0dc8675facfc48a195aae4bf)) ### Code Refactoring * Optimize screenshots preprocessing ([#812](https://github.com/appium/WebDriverAgent/issues/812)) ([0b41757](https://github.com/appium/WebDriverAgent/commit/0b41757c0d21004afab32860b4e510d4bc426018)) --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 539251658..cf1bd97e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## [5.15.1](https://github.com/appium/WebDriverAgent/compare/v5.15.0...v5.15.1) (2023-11-16) + + +### Bug Fixes + +* Content-Type of the MJPEG server ([b4704da](https://github.com/appium/WebDriverAgent/commit/b4704dafc4567e1f0dc8675facfc48a195aae4bf)) + + +### Code Refactoring + +* Optimize screenshots preprocessing ([#812](https://github.com/appium/WebDriverAgent/issues/812)) ([0b41757](https://github.com/appium/WebDriverAgent/commit/0b41757c0d21004afab32860b4e510d4bc426018)) + ## [5.15.0](https://github.com/appium/WebDriverAgent/compare/v5.14.0...v5.15.0) (2023-11-16) diff --git a/package.json b/package.json index d5568caef..ea8a6b721 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.15.0", + "version": "5.15.1", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 08388fd602ee9d588a8780e8d141d748813782ed Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 23 Nov 2023 01:30:47 -0800 Subject: [PATCH 59/71] chore: a dummy commit to check a package release From 014d04df956e47fef67938b089511e80d344f007 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 23 Nov 2023 02:22:36 -0800 Subject: [PATCH 60/71] fix: fix run test ci (#814) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ea8a6b721..30e48bd49 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "semantic-release": "^22.0.5", "sinon": "^17.0.0", "ts-node": "^10.9.1", - "typescript": "^5.1.6" + "typescript": "~5.2" }, "dependencies": { "@appium/base-driver": "^9.0.0", From 8c76380bc22e84c76b5429b7db2c29e9c024dba5 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 23 Nov 2023 10:28:49 +0000 Subject: [PATCH 61/71] chore(release): 5.15.2 [skip ci] ## [5.15.2](https://github.com/appium/WebDriverAgent/compare/v5.15.1...v5.15.2) (2023-11-23) ### Bug Fixes * fix run test ci ([#814](https://github.com/appium/WebDriverAgent/issues/814)) ([014d04d](https://github.com/appium/WebDriverAgent/commit/014d04df956e47fef67938b089511e80d344f007)) ### Miscellaneous Chores * a dummy commit to check a package release ([08388fd](https://github.com/appium/WebDriverAgent/commit/08388fd602ee9d588a8780e8d141d748813782ed)) --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf1bd97e8..87c1177aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## [5.15.2](https://github.com/appium/WebDriverAgent/compare/v5.15.1...v5.15.2) (2023-11-23) + + +### Bug Fixes + +* fix run test ci ([#814](https://github.com/appium/WebDriverAgent/issues/814)) ([014d04d](https://github.com/appium/WebDriverAgent/commit/014d04df956e47fef67938b089511e80d344f007)) + + +### Miscellaneous Chores + +* a dummy commit to check a package release ([08388fd](https://github.com/appium/WebDriverAgent/commit/08388fd602ee9d588a8780e8d141d748813782ed)) + ## [5.15.1](https://github.com/appium/WebDriverAgent/compare/v5.15.0...v5.15.1) (2023-11-16) diff --git a/package.json b/package.json index 30e48bd49..ac2e671fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.15.1", + "version": "5.15.2", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 2d7fc0370b30e5e3adc9a13002fa95f607c4c160 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Fri, 24 Nov 2023 18:55:16 +0100 Subject: [PATCH 62/71] chore: Make xcodebuild error message more helpful (#816) --- lib/utils.js | 9 +++++- lib/xcodebuild.js | 72 +++++++++++++---------------------------------- 2 files changed, 28 insertions(+), 53 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 1474d929f..f52ec6fe0 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -265,12 +265,19 @@ function getXctestrunFileName (deviceInfo, version) { : `WebDriverAgentRunner_iphone${deviceInfo.isRealDevice ? `os${version}-arm64` : `simulator${version}-x86_64`}.xctestrun`; } +/** + * Ensures the process is killed after the timeout + * + * @param {string} name + * @param {import('teen_process').SubProcess} proc + * @returns {Promise} + */ async function killProcess (name, proc) { if (!proc || !proc.isRunning) { return; } - log.info(`Shutting down '${name}' process (pid '${proc.proc.pid}')`); + log.info(`Shutting down '${name}' process (pid '${proc.proc?.pid}')`); log.info(`Sending 'SIGTERM'...`); try { diff --git a/lib/xcodebuild.js b/lib/xcodebuild.js index 8194d1984..bdd484db2 100644 --- a/lib/xcodebuild.js +++ b/lib/xcodebuild.js @@ -1,17 +1,17 @@ import { retryInterval } from 'asyncbox'; import { SubProcess, exec } from 'teen_process'; -import { fs, logger, timing } from '@appium/support'; +import { logger, timing } from '@appium/support'; import defaultLogger from './logger'; import B from 'bluebird'; import { setRealDeviceSecurity, setXctestrunFile, updateProjectFile, resetProjectFile, killProcess, - getWDAUpgradeTimestamp, isTvOS } from './utils'; + getWDAUpgradeTimestamp, isTvOS +} from './utils'; import _ from 'lodash'; import path from 'path'; import { EOL } from 'os'; import { WDA_RUNNER_BUNDLE_ID } from './constants'; -import readline from 'node:readline'; const DEFAULT_SIGNING_ID = 'iPhone Developer'; @@ -34,6 +34,9 @@ const xcodeLog = logger.getLogger('Xcode'); class XcodeBuild { + /** @type {SubProcess} */ + xcodebuild; + /** * @param {string} xcodeVersion * @param {any} device @@ -85,10 +88,6 @@ class XcodeBuild { this.resultBundlePath = args.resultBundlePath; this.resultBundleVersion = args.resultBundleVersion; - /** @type {string} */ - this._logLocation = ''; - /** @type {string[]} */ - this._wdaErrorMessage = []; this._didBuildFail = false; this._didProcessExit = false; } @@ -168,8 +167,6 @@ class XcodeBuild { this.usePrebuiltWDA = true; await this.start(true); - this.xcodebuild = null; - if (this.prebuildDelay > 0) { // pause a moment await B.delay(this.prebuildDelay); @@ -286,7 +283,6 @@ class XcodeBuild { if (upgradeTimestamp) { env.UPGRADE_TIMESTAMP = upgradeTimestamp; } - this._logLocation = ''; this._didBuildFail = false; const xcodebuild = new SubProcess(cmd, args, { cwd: this.bootstrapPath, @@ -302,14 +298,6 @@ class XcodeBuild { this.log.debug(`${logMsg}. To change this, use 'showXcodeLog' desired capability`); xcodebuild.on('output', (stdout, stderr) => { let out = stdout || stderr; - // we want to pull out the log file that is created, and highlight it - // for diagnostic purposes - if (out.includes('Writing diagnostic log for test session to')) { - // pull out the first line that begins with the path separator - // which *should* be the line indicating the log file generated - this._logLocation = _.first(_.remove(out.trim().split('\n'), (v) => v.startsWith(path.sep))) ?? ''; - xcodeLog.debug(`Log file location for xcodebuild test: ${this._logLocation || 'unknown'}`); - } // if we have an error we want to output the logs // otherwise the failure is inscrutible @@ -326,9 +314,6 @@ class XcodeBuild { if (logXcodeOutput && !ignoreError) { for (const line of out.split(EOL)) { xcodeLog.error(line); - if (line) { - this._wdaErrorMessage.push(line); - } } } }); @@ -338,43 +323,27 @@ class XcodeBuild { async start (buildOnly = false) { this.xcodebuild = await this.createSubProcess(buildOnly); - // Store xcodebuild message - this._wdaErrorMessage = []; // wrap the start procedure in a promise so that we can catch, and report, // any startup errors that are thrown as events return await new B((resolve, reject) => { - // @ts-ignore xcodebuild must be present here - this.xcodebuild.once('exit', async (code, signal) => { + this.xcodebuild.once('exit', (code, signal) => { xcodeLog.error(`xcodebuild exited with code '${code}' and signal '${signal}'`); - this.xcodebuild?.removeAllListeners(); - const xcodeErrorMessage = this._wdaErrorMessage.join('\n'); - this._wdaErrorMessage = []; - // print out the xcodebuild file if users have asked for it - if (this.showXcodeLog && this._logLocation) { - xcodeLog.error(`Contents of xcodebuild log file '${this._logLocation}':`); - try { - const logFile = readline.createInterface({ - input: fs.createReadStream(this._logLocation), - terminal: false - }); - logFile.on('line', (line) => { - xcodeLog.error(line); - }); - await new B((_resolve) => { - logFile.once('close', () => { - logFile.removeAllListeners(); - _resolve(); - }); - }); - } catch (err) { - xcodeLog.error(`Unable to access xcodebuild log file: '${err.message}'`); - } - } + this.xcodebuild.removeAllListeners(); this.didProcessExit = true; if (this._didBuildFail || (!signal && code !== 0)) { - return reject(new Error(`xcodebuild failed with code ${code}\n` + - `xcodebuild error message:\n${xcodeErrorMessage}`)); + let errorMessage = `xcodebuild failed with code ${code}.` + + ` This usually indicates an issue with the local Xcode setup or WebDriverAgent` + + ` project configuration or the driver-to-platform version mismatch.`; + if (!this.showXcodeLog) { + errorMessage += ` Consider setting 'showXcodeLog' capability to true in` + + ` order to check the Appium server log for build-related error messages.`; + } else if (this.realDevice) { + errorMessage += ` Consider checking the WebDriverAgent configuration guide` + + ` for real iOS devices at` + + ` https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md.`; + } + return reject(new Error(errorMessage)); } // in the case of just building, the process will exit and that is our finish if (buildOnly) { @@ -385,7 +354,6 @@ class XcodeBuild { return (async () => { try { const timer = new timing.Timer().start(); - // @ts-ignore this.xcodebuild must be defined await this.xcodebuild.start(true); if (!buildOnly) { let status = await this.waitForStart(timer); From 0267f49da7c8f2637c5d6e936ae3f90b6fd934a6 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 24 Nov 2023 18:04:50 +0000 Subject: [PATCH 63/71] chore(release): 5.15.3 [skip ci] ## [5.15.3](https://github.com/appium/WebDriverAgent/compare/v5.15.2...v5.15.3) (2023-11-24) ### Miscellaneous Chores * Make xcodebuild error message more helpful ([#816](https://github.com/appium/WebDriverAgent/issues/816)) ([2d7fc03](https://github.com/appium/WebDriverAgent/commit/2d7fc0370b30e5e3adc9a13002fa95f607c4c160)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87c1177aa..324828e67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.15.3](https://github.com/appium/WebDriverAgent/compare/v5.15.2...v5.15.3) (2023-11-24) + + +### Miscellaneous Chores + +* Make xcodebuild error message more helpful ([#816](https://github.com/appium/WebDriverAgent/issues/816)) ([2d7fc03](https://github.com/appium/WebDriverAgent/commit/2d7fc0370b30e5e3adc9a13002fa95f607c4c160)) + ## [5.15.2](https://github.com/appium/WebDriverAgent/compare/v5.15.1...v5.15.2) (2023-11-23) diff --git a/package.json b/package.json index ac2e671fb..bb4b9740f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.15.2", + "version": "5.15.3", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 357a2cbca106daf42bc892b251802bfa00895598 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 7 Dec 2023 09:15:39 -0800 Subject: [PATCH 64/71] fix: set appearance in iOS 17+ (#818) * fix: set appearance in iOS 17+ * only xcode 15+ * set proper clang version * simplify * fix Xcode warning --- WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m index 5f138f381..b0b008348 100644 --- a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m @@ -339,6 +339,16 @@ - (BOOL)fb_setAppearance:(FBUIInterfaceAppearance)appearance error:(NSError **)e [invocation invoke]; return YES; } + +#if __clang_major__ >= 15 || (__clang_major__ >= 14 && __clang_minor__ >= 0 && __clang_patchlevel__ >= 3) + // Xcode 14.3.1 can build these values. + // For iOS 17+ + if ([self respondsToSelector:NSSelectorFromString(@"appearance")]) { + self.appearance = (XCUIDeviceAppearance) appearance; + return YES; + } +#endif + return [[[FBErrorBuilder builder] withDescriptionFormat:@"Current Xcode SDK does not support appearance changing"] buildError:error]; From 4ac009e616e7b0888c58989e1fe5a925835678fb Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 7 Dec 2023 17:22:07 +0000 Subject: [PATCH 65/71] chore(release): 5.15.4 [skip ci] ## [5.15.4](https://github.com/appium/WebDriverAgent/compare/v5.15.3...v5.15.4) (2023-12-07) ### Bug Fixes * set appearance in iOS 17+ ([#818](https://github.com/appium/WebDriverAgent/issues/818)) ([357a2cb](https://github.com/appium/WebDriverAgent/commit/357a2cbca106daf42bc892b251802bfa00895598)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 324828e67..98a0f22d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.15.4](https://github.com/appium/WebDriverAgent/compare/v5.15.3...v5.15.4) (2023-12-07) + + +### Bug Fixes + +* set appearance in iOS 17+ ([#818](https://github.com/appium/WebDriverAgent/issues/818)) ([357a2cb](https://github.com/appium/WebDriverAgent/commit/357a2cbca106daf42bc892b251802bfa00895598)) + ## [5.15.3](https://github.com/appium/WebDriverAgent/compare/v5.15.2...v5.15.3) (2023-11-24) diff --git a/package.json b/package.json index bb4b9740f..73702b7f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.15.3", + "version": "5.15.4", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 296c19b96210b6d8660099a2b6c7f30797144bc0 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 9 Dec 2023 08:46:25 -0800 Subject: [PATCH 66/71] ci: tune trigger of .azure-pipelines.yml --- .azure-pipelines.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 864c786f0..a324a9b7d 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -16,6 +16,15 @@ variables: MAX_IPAD_DEVICE_NAME: iPad Pro (11-inch) (3rd generation) DEFAULT_NODE_VERSION: "18.x" +trigger: + batch: true + branches: + include: [master] + +pr: + autoCancel: true + branches: + include: [master] pool: vmImage: "$(MAX_VM_IMAGE)" From de124e1bb02a5897da7b1b99cb6fbfc5569ab6bd Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 9 Dec 2023 23:11:05 -0800 Subject: [PATCH 67/71] ci: use ruby 3 (#821) * ci: use ruby 3 * set output type to not use result bundle * try no multi_scan * adjust params * ci: make build fail when test fails --- Fastlane/Fastfile | 28 +++------------------------- Fastlane/Pluginfile | 2 -- Gemfile | 4 +--- azure-templates/bootstrap_steps.yml | 2 +- 4 files changed, 5 insertions(+), 31 deletions(-) diff --git a/Fastlane/Fastfile b/Fastlane/Fastfile index 39bb9f491..41fd63669 100644 --- a/Fastlane/Fastfile +++ b/Fastlane/Fastfile @@ -1,34 +1,12 @@ XC_PROJECT = File.absolute_path('../WebDriverAgent.xcodeproj') -RETRIES = 3 lane :test do - test_run_block = lambda do |testrun_info| - failed_test_count = testrun_info[:failed].size - - if failed_test_count > 0 - UI.important("Failed tests count: #{failed_test_count}") - - try_attempt = testrun_info[:try_count] - if try_attempt < RETRIES - UI.header("Re-running failing tests (attempt #{try_attempt} of #{RETRIES})") - reset_simulator_contents - end - end - end - # https://docs.fastlane.tools/actions/scan/ - result = multi_scan( + run_tests( project: XC_PROJECT, - try_count: RETRIES, - fail_build: false, + fail_build: true, scheme: ENV['SCHEME'], sdk: ENV['SDK'], destination: ENV['DEST'], - testrun_completed_block: test_run_block ) - unless result[:failed_testcount].zero? - msg = "There are #{result[:failed_testcount]} legitimate failing tests" - UI.message(msg) - raise msg - end -end \ No newline at end of file +end diff --git a/Fastlane/Pluginfile b/Fastlane/Pluginfile index dc2f2aa91..273a6b6f4 100644 --- a/Fastlane/Pluginfile +++ b/Fastlane/Pluginfile @@ -1,5 +1,3 @@ # Autogenerated by fastlane # # Ensure this file is checked in to source control! - -gem 'fastlane-plugin-test_center', '3.15.3' diff --git a/Gemfile b/Gemfile index f8456a949..90c93561d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,3 @@ source "https://rubygems.org" -gem "fastlane", '2.162.0' -plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') -eval_gemfile(plugins_path) if File.exist?(plugins_path) +gem "fastlane", '2.217.0' diff --git a/azure-templates/bootstrap_steps.yml b/azure-templates/bootstrap_steps.yml index 83847eb74..6c96e9ead 100644 --- a/azure-templates/bootstrap_steps.yml +++ b/azure-templates/bootstrap_steps.yml @@ -3,5 +3,5 @@ steps: - script: mkdir -p ./Resources/WebDriverAgent.bundle - task: UseRubyVersion@0 inputs: - versionSpec: '<3.0' + versionSpec: '3' addToPath: true From 89e233d8aef5a19491785fee0823fd8eddbd5fcc Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Tue, 12 Dec 2023 19:26:14 -0800 Subject: [PATCH 68/71] chore: use appearance for get as well if available (#825) --- WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m index b0b008348..959ae2831 100644 --- a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m @@ -356,6 +356,14 @@ - (BOOL)fb_setAppearance:(FBUIInterfaceAppearance)appearance error:(NSError **)e - (NSNumber *)fb_getAppearance { +#if __clang_major__ >= 15 || (__clang_major__ >= 14 && __clang_minor__ >= 0 && __clang_patchlevel__ >= 3) + // Xcode 14.3.1 can build these values. + // For iOS 17+ + if ([self respondsToSelector:NSSelectorFromString(@"appearance")]) { + return [NSNumber numberWithLongLong:[self appearance]]; + } +#endif + return [self respondsToSelector:@selector(appearanceMode)] ? [NSNumber numberWithLongLong:[self appearanceMode]] : nil; From 3e506a9ac244ea9afedef9f63e600a3bb90bfd38 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 13 Dec 2023 03:33:01 +0000 Subject: [PATCH 69/71] chore(release): 5.15.5 [skip ci] ## [5.15.5](https://github.com/appium/WebDriverAgent/compare/v5.15.4...v5.15.5) (2023-12-13) ### Miscellaneous Chores * use appearance for get as well if available ([#825](https://github.com/appium/WebDriverAgent/issues/825)) ([89e233d](https://github.com/appium/WebDriverAgent/commit/89e233d8aef5a19491785fee0823fd8eddbd5fcc)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98a0f22d0..e4eb6d86a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.15.5](https://github.com/appium/WebDriverAgent/compare/v5.15.4...v5.15.5) (2023-12-13) + + +### Miscellaneous Chores + +* use appearance for get as well if available ([#825](https://github.com/appium/WebDriverAgent/issues/825)) ([89e233d](https://github.com/appium/WebDriverAgent/commit/89e233d8aef5a19491785fee0823fd8eddbd5fcc)) + ## [5.15.4](https://github.com/appium/WebDriverAgent/compare/v5.15.3...v5.15.4) (2023-12-07) diff --git a/package.json b/package.json index 73702b7f8..e5927c1fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-webdriveragent", - "version": "5.15.4", + "version": "5.15.5", "description": "Package bundling WebDriverAgent", "main": "./build/index.js", "scripts": { From 3480bd4667fdfffbd2771519862c37f53aef1e70 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 14 Dec 2023 19:01:21 -0800 Subject: [PATCH 70/71] ci: teak tests (#824) * ci: teak tests * ci: skip one test to reduce flakiness * ci: skip some tests for ipad * use UIDevice * ci: skip long press * use number_of_retries to add -test-iterations and -retry-tests-on-failure for xcodebuild --- Fastlane/Fastfile | 1 + Fastlane/Pluginfile | 3 --- .../IntegrationTests/FBAlertTests.m | 3 +++ .../FBAppiumTouchActionsIntegrationTests.m | 3 +++ .../IntegrationTests/FBElementSwipingTests.m | 6 ++++++ .../IntegrationTests/FBKeyboardTests.m | 3 +++ WebDriverAgentTests/IntegrationTests/FBTapTest.m | 15 ++++++++++----- .../FBW3CTouchActionsIntegrationTests.m | 3 +++ 8 files changed, 29 insertions(+), 8 deletions(-) delete mode 100644 Fastlane/Pluginfile diff --git a/Fastlane/Fastfile b/Fastlane/Fastfile index 41fd63669..6e657a74e 100644 --- a/Fastlane/Fastfile +++ b/Fastlane/Fastfile @@ -8,5 +8,6 @@ lane :test do scheme: ENV['SCHEME'], sdk: ENV['SDK'], destination: ENV['DEST'], + number_of_retries: 3 ) end diff --git a/Fastlane/Pluginfile b/Fastlane/Pluginfile deleted file mode 100644 index 273a6b6f4..000000000 --- a/Fastlane/Pluginfile +++ /dev/null @@ -1,3 +0,0 @@ -# Autogenerated by fastlane -# -# Ensure this file is checked in to source control! diff --git a/WebDriverAgentTests/IntegrationTests/FBAlertTests.m b/WebDriverAgentTests/IntegrationTests/FBAlertTests.m index 57c48e492..3729c4d54 100644 --- a/WebDriverAgentTests/IntegrationTests/FBAlertTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBAlertTests.m @@ -154,8 +154,11 @@ - (void)testNotificationAlert XCTAssertTrue([alert.text containsString:@"Notifications may include"]); } +// It worked locally but CI did not. - (void)testCameraRollAlert { + XCTSkip(@"The alert depends on the permission condition. Azure CI env might have an issue to handle permission."); + FBAlert *alert = [FBAlert alertWithApplication:self.testedApplication]; XCTAssertNil(alert.text); diff --git a/WebDriverAgentTests/IntegrationTests/FBAppiumTouchActionsIntegrationTests.m b/WebDriverAgentTests/IntegrationTests/FBAppiumTouchActionsIntegrationTests.m index d48b3da77..51525e435 100644 --- a/WebDriverAgentTests/IntegrationTests/FBAppiumTouchActionsIntegrationTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBAppiumTouchActionsIntegrationTests.m @@ -244,6 +244,9 @@ - (void)testPress - (void)testLongPress { + if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { + XCTSkip(@"Failed on Azure Pipeline. Local run succeeded."); + } UIDeviceOrientation orientation = UIDeviceOrientationLandscapeLeft; [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientation]; CGRect elementFrame = self.testedApplication.buttons[FBShowAlertButtonName].frame; diff --git a/WebDriverAgentTests/IntegrationTests/FBElementSwipingTests.m b/WebDriverAgentTests/IntegrationTests/FBElementSwipingTests.m index caf5d9020..0a9d2f5c4 100644 --- a/WebDriverAgentTests/IntegrationTests/FBElementSwipingTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBElementSwipingTests.m @@ -67,6 +67,9 @@ - (void)testSwipeDown - (void)testSwipeDownWithVelocity { + if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { + XCTSkip(@"Failed on Azure Pipeline. Local run succeeded."); + } [self.scrollView fb_swipeWithDirection:@"up" velocity:@2500]; FBAssertInvisibleCell(@"0"); [self.scrollView fb_swipeWithDirection:@"down" velocity:@2500]; @@ -113,6 +116,9 @@ - (void)testSwipeDown - (void)testSwipeDownWithVelocity { + if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { + XCTSkip(@"Failed on Azure Pipeline. Local run succeeded."); + } [self.testedApplication fb_swipeWithDirection:@"up" velocity:@2500]; FBAssertInvisibleCell(@"0"); [self.testedApplication fb_swipeWithDirection:@"down" velocity:@2500]; diff --git a/WebDriverAgentTests/IntegrationTests/FBKeyboardTests.m b/WebDriverAgentTests/IntegrationTests/FBKeyboardTests.m index 3da52e370..beca0c791 100644 --- a/WebDriverAgentTests/IntegrationTests/FBKeyboardTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBKeyboardTests.m @@ -29,6 +29,9 @@ - (void)setUp - (void)testTextTyping { + if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { + XCTSkip(@"Failed on Azure Pipeline. Local run succeeded."); + } NSString *text = @"Happy typing"; XCUIElement *textField = self.testedApplication.textFields[@"aIdentifier"]; [textField tap]; diff --git a/WebDriverAgentTests/IntegrationTests/FBTapTest.m b/WebDriverAgentTests/IntegrationTests/FBTapTest.m index 9dce4084c..5b79711fc 100644 --- a/WebDriverAgentTests/IntegrationTests/FBTapTest.m +++ b/WebDriverAgentTests/IntegrationTests/FBTapTest.m @@ -33,12 +33,10 @@ - (void)verifyTapWithOrientation:(UIDeviceOrientation)orientation - (void)setUp { + // Launch the app everytime to ensure the orientation for each test. [super setUp]; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [self launchApplication]; - [self goToAlertsPage]; - }); + [self launchApplication]; + [self goToAlertsPage]; [self clearAlert]; } @@ -61,11 +59,15 @@ - (void)testTapInLandscapeLeft - (void)testTapInLandscapeRight { + [self verifyTapWithOrientation:UIDeviceOrientationLandscapeRight]; } - (void)testTapInPortraitUpsideDown { + if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { + XCTSkip(@"Failed on Azure Pipeline. Local run succeeded."); + } [self verifyTapWithOrientation:UIDeviceOrientationPortraitUpsideDown]; } @@ -94,6 +96,9 @@ - (void)testTapCoordinatesInLandscapeRight - (void)testTapCoordinatesInPortraitUpsideDown { + if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { + XCTSkip(@"Failed on Azure Pipeline. Local run succeeded."); + } [self verifyTapByCoordinatesWithOrientation:UIDeviceOrientationPortraitUpsideDown]; } diff --git a/WebDriverAgentTests/IntegrationTests/FBW3CTouchActionsIntegrationTests.m b/WebDriverAgentTests/IntegrationTests/FBW3CTouchActionsIntegrationTests.m index 8549d3016..598cc66c9 100644 --- a/WebDriverAgentTests/IntegrationTests/FBW3CTouchActionsIntegrationTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBW3CTouchActionsIntegrationTests.m @@ -338,6 +338,9 @@ - (void)testLongPressWithCombinedPause - (void)testLongPress { + if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { + XCTSkip(@"Failed on Azure Pipeline. Local run succeeded."); + } UIDeviceOrientation orientation = UIDeviceOrientationLandscapeLeft; [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientation]; CGRect elementFrame = self.testedApplication.buttons[FBShowAlertButtonName].frame; From 766be59ef31753f4029c57c7a13cc01b1312cb9e Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 17 Dec 2023 07:59:54 -0800 Subject: [PATCH 71/71] ci: tune testCameraRollAlert for CI env (#828) --- WebDriverAgentTests/IntegrationTests/FBAlertTests.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/WebDriverAgentTests/IntegrationTests/FBAlertTests.m b/WebDriverAgentTests/IntegrationTests/FBAlertTests.m index 3729c4d54..a7cf04418 100644 --- a/WebDriverAgentTests/IntegrationTests/FBAlertTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBAlertTests.m @@ -154,21 +154,22 @@ - (void)testNotificationAlert XCTAssertTrue([alert.text containsString:@"Notifications may include"]); } -// It worked locally but CI did not. +// This test case depends on the local app permission state. - (void)testCameraRollAlert { - XCTSkip(@"The alert depends on the permission condition. Azure CI env might have an issue to handle permission."); - FBAlert *alert = [FBAlert alertWithApplication:self.testedApplication]; XCTAssertNil(alert.text); [self.testedApplication.buttons[@"Create Camera Roll Alert"] tap]; FBAssertWaitTillBecomesTrue(alert.isPresent); - XCTAssertTrue([alert.text containsString:@"Would Like to Access Your Photos"]); + // "Would Like to Access Your Photos" or "Would Like to Access Your Photo Library" displayes on the alert button. + XCTAssertTrue([alert.text containsString:@"Would Like to Access Your Photo"]); // iOS 15 has different UI flow if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"15.0")) { [[FBAlert alertWithApplication:self.testedApplication] dismissWithError:nil]; + // CI env could take longer time to show up the button, thus it needs to wait a bit. + XCTAssertTrue([self.testedApplication.buttons[@"Cancel"] waitForExistenceWithTimeout:30.0]); [self.testedApplication.buttons[@"Cancel"] tap]; } }