-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Testing] Implement PressEnter Appium action in Catalyst (#25854)
* Implement PressEnter Appium action in Catalyst * Fix merge error
- Loading branch information
1 parent
72af857
commit d160357
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/TestUtils/src/UITest.Appium/Actions/AppiumCatalystVirtualKeyboardActions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Appium.Windows; | ||
using OpenQA.Selenium.Interactions; | ||
using UITest.Core; | ||
|
||
namespace UITest.Appium | ||
{ | ||
public class AppiumCatalystVirtualKeyboardActions : AppiumVirtualKeyboardActions | ||
{ | ||
readonly AppiumApp _appiumApp; | ||
|
||
public AppiumCatalystVirtualKeyboardActions(AppiumApp appiumApp) | ||
: base(appiumApp) | ||
{ | ||
_appiumApp = appiumApp; | ||
} | ||
|
||
protected override CommandResponse PressEnter(IDictionary<string, object> parameters) | ||
{ | ||
try | ||
{ | ||
// https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc | ||
string[] keys = ["XCUIKeyboardKeyEnter"]; // Enter Key | ||
|
||
_appiumApp.Driver.ExecuteScript("macos: keys", new Dictionary<string, object> | ||
{ | ||
{ "keys", keys }, | ||
}); | ||
} | ||
catch (InvalidElementStateException) | ||
{ | ||
return CommandResponse.FailedEmptyResponse; | ||
} | ||
|
||
return CommandResponse.SuccessEmptyResponse; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters