Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add forceTurnOnSoftwareKeyboard capability #1327

Merged
merged 11 commits into from Aug 16, 2021

Conversation

KazuCocoa
Copy link
Member

To make appium/WebDriverAgent#524 configurable via capabilities.
This Pr needs to bump WDA dependency after appium/WebDriverAgent#524 merge

README.md Outdated
@@ -166,7 +166,7 @@ Capability | Description
|`appium:orientation`|Start a test in a certain orientation|`LANDSCAPE` or `PORTRAIT`|
|`appium:scaleFactor`|Simulator scale factor. This is useful to have if the default resolution of simulated device is greater than the actual display resolution. So you can scale the simulator to see the whole device screen without scrolling.|Acceptable values for simulators running Xcode SDK 8 and older are: `'1.0', '0.75', '0.5', '0.33' and '0.25'`, where '1.0' means 100% scale. For simulators running Xcode SDK 9 and above the value could be any valid positive float number. The capability must be of a string type.|
|`appium:connectHardwareKeyboard`|Set this option to `true` in order to enable hardware keyboard in Simulator. The preference works only when Appium launches a simulator instance with this value. It is set to `false` by default, because this helps to workaround some XCTest bugs.|`true` or `false`|
|`appium:forceTurnOnSoftwareKeyboard`|Set this option to `true` in order to turn software keyboard on since Appium 1.22.0. This option helps to avoid `Keyboard is not present` error. It is set to `true` by default. Appium respect preset simulator software/hardware keyboard preference when this value is `false`. |`true` or `false`|
|`appium:forceTurnOnSoftwareKeyboard`|Set this option to `true` in order to turn software keyboard on since Appium 1.22.0. This option helps to avoid `Keyboard is not present` error. It is set to `true` by default. Appium respect preset simulator software/hardware keyboard preference when this value is `false`. This preference is prior rather than `connectHardwareKeyboard`. |`true` or `false`|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option has priority over ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also describe the point of having two capabilities (you could just copy appium/WebDriverAgent#524 (comment))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: will update here later

lib/driver.js Outdated
@@ -986,6 +986,7 @@ class XCUITestDriver extends BaseDriver {
shouldTerminateApp: this.opts.shouldTerminateApp ?? true,
forceAppLaunch: this.opts.forceAppLaunch ?? true,
useNativeCachingStrategy: this.opts.useNativeCachingStrategy ?? true,
forceTurnOnSoftwareKeyboard: this.opts.forceTurnOnSoftwareKeyboard ?? true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would the default still work as expected is connectHardwareKeyboard is set to true?

Copy link
Member Author

@KazuCocoa KazuCocoa Aug 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this caps works when creating a new session. the hardware keyboard is when preparing a simulator instance. This capability set the software keyboard when I tested on my local. (If I didn't missed some steps...)

@KazuCocoa KazuCocoa marked this pull request as ready for review August 15, 2021 22:27
README.md Outdated
@@ -165,7 +165,8 @@ Capability | Description
|----------|-----------|------|
|`appium:orientation`|Start a test in a certain orientation|`LANDSCAPE` or `PORTRAIT`|
|`appium:scaleFactor`|Simulator scale factor. This is useful to have if the default resolution of simulated device is greater than the actual display resolution. So you can scale the simulator to see the whole device screen without scrolling.|Acceptable values for simulators running Xcode SDK 8 and older are: `'1.0', '0.75', '0.5', '0.33' and '0.25'`, where '1.0' means 100% scale. For simulators running Xcode SDK 9 and above the value could be any valid positive float number. The capability must be of a string type.|
|`appium:connectHardwareKeyboard`|Set this option to `true` in order to enable hardware keyboard in Simulator. It is set to `false` by default, because this helps to workaround some XCTest bugs.|`true` or `false`|
|`appium:connectHardwareKeyboard`|Set this option to `true` in order to enable hardware keyboard in Simulator. The preference works only when Appium launches a simulator instance with this value. It is set to `false` by default, because this helps to workaround some XCTest bugs.|`true` or `false`|
|`appium:forceSimulatorSoftwareKeyboardPresence`|Set this option to `true` in order to turn software keyboard on and turn hardware keyboard off in Simulator since Appium 1.22.0. This option helps to avoid `Keyboard is not present` error. It is set to `true` by default. Appium respects preset simulator software/hardware keyboard preference when this value is `false`, so `connectHardwareKeyboard: false` and `forceSimulatorSoftwareKeyboardPresence: false` means Appium keeps preset simulator keyboard preference. This option has priority over `connectHardwareKeyboard`. |`true` or `false`|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..means for Appium to keep the current Simulator keyboard preferences

lib/driver.js Outdated
@@ -986,6 +986,7 @@ class XCUITestDriver extends BaseDriver {
shouldTerminateApp: this.opts.shouldTerminateApp ?? true,
forceAppLaunch: this.opts.forceAppLaunch ?? true,
useNativeCachingStrategy: this.opts.useNativeCachingStrategy ?? true,
forceSimulatorSoftwareKeyboardPresence: this.opts.forceSimulatorSoftwareKeyboardPresence ?? true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about

forceSimulatorSoftwareKeyboardPresence: this.opts.forceSimulatorSoftwareKeyboardPresence 
  ?? (this.opts.connectHardwareKeyboard === true ? false : true) ,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, no objection to it

…eKeyboard is true and no forceSimulatorSoftwareKeyboardPresence
README.md Outdated
@@ -165,7 +165,8 @@ Capability | Description
|----------|-----------|------|
|`appium:orientation`|Start a test in a certain orientation|`LANDSCAPE` or `PORTRAIT`|
|`appium:scaleFactor`|Simulator scale factor. This is useful to have if the default resolution of simulated device is greater than the actual display resolution. So you can scale the simulator to see the whole device screen without scrolling.|Acceptable values for simulators running Xcode SDK 8 and older are: `'1.0', '0.75', '0.5', '0.33' and '0.25'`, where '1.0' means 100% scale. For simulators running Xcode SDK 9 and above the value could be any valid positive float number. The capability must be of a string type.|
|`appium:connectHardwareKeyboard`|Set this option to `true` in order to enable hardware keyboard in Simulator. It is set to `false` by default, because this helps to workaround some XCTest bugs.|`true` or `false`|
|`appium:connectHardwareKeyboard`|Set this option to `true` in order to enable hardware keyboard in Simulator. The preference works only when Appium launches a simulator instance with this value. It is set to `false` by default, because this helps to workaround some XCTest bugs. `connectHardwareKeyboard: true` makes `forceSimulatorSoftwareKeyboardPresence: false` if no `forceSimulatorSoftwareKeyboardPresence` in the capability since Appium 1.22.0. |`true` or `false`|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... if no explicit value is set for forceSimulatorSoftwareKeyboardPresence capability ...

@KazuCocoa KazuCocoa merged commit 2a05efc into appium:master Aug 16, 2021
@KazuCocoa KazuCocoa deleted the add-force-turn-on-sftware-keyboard branch August 16, 2021 20:21
github-actions bot pushed a commit that referenced this pull request Aug 16, 2021
# [3.52.0](v3.51.1...v3.52.0) (2021-08-16)

### Features

* add forceTurnOnSoftwareKeyboard capability ([#1327](#1327)) ([2a05efc](2a05efc))
@github-actions
Copy link
Contributor

🎉 This PR is included in version 3.52.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants