@@ -7,14 +7,24 @@ namespace Avalonia.IntegrationTests.Appium
77 [ Collection ( "Default" ) ]
88 public class KeyboardTests : TestBase
99 {
10+ // These tests synthesize key input through W3C actions, which the mac2 driver bundled
11+ // with Appium 1 does not implement. On macOS they need Appium 2+ with a current mac2
12+ // driver, so the Appium 1 configuration only runs them on Windows via WinAppDriver.
13+ private const string RequiresW3CKeyActions =
14+ "The mac2 driver bundled with Appium 1 does not implement W3C key actions" ;
15+
1016 public KeyboardTests ( DefaultAppFixture fixture )
1117 : base ( fixture , "Keyboard" )
1218 {
1319 var reset = Session . FindElementByAccessibilityId ( "ResetKeyboard" ) ;
1420 reset . Click ( ) ;
1521 }
1622
23+ #if APPIUM1
24+ [ PlatformFact ( TestPlatforms . Windows , RequiresW3CKeyActions ) ]
25+ #else
1726 [ Fact ]
27+ #endif
1828 public void KeyBinding_Without_Modifier_Is_Raised_While_TextBox_Is_Focused ( )
1929 {
2030 var textBox = Session . FindElementByAccessibilityId ( "GestureTextBox" ) ;
@@ -26,7 +36,11 @@ public void KeyBinding_Without_Modifier_Is_Raised_While_TextBox_Is_Focused()
2636 Assert . Equal ( "Space" , lastKeyBinding . Text ) ;
2737 }
2838
39+ #if APPIUM1
40+ [ PlatformFact ( TestPlatforms . Windows , RequiresW3CKeyActions ) ]
41+ #else
2942 [ Fact ]
43+ #endif
3044 public void KeyBinding_On_Character_Key_Is_Raised_While_TextBox_Is_Focused ( )
3145 {
3246 var textBox = Session . FindElementByAccessibilityId ( "GestureTextBox" ) ;
@@ -38,7 +52,11 @@ public void KeyBinding_On_Character_Key_Is_Raised_While_TextBox_Is_Focused()
3852 Assert . Equal ( "A" , lastKeyBinding . Text ) ;
3953 }
4054
55+ #if APPIUM1
56+ [ PlatformFact ( TestPlatforms . Windows , RequiresW3CKeyActions ) ]
57+ #else
4158 [ Fact ]
59+ #endif
4260 public void KeyBinding_With_Modifier_Is_Raised_While_TextBox_Is_Focused ( )
4361 {
4462 var textBox = Session . FindElementByAccessibilityId ( "GestureTextBox" ) ;
@@ -54,7 +72,11 @@ public void KeyBinding_With_Modifier_Is_Raised_While_TextBox_Is_Focused()
5472 Assert . Equal ( "Ctrl+G" , lastKeyBinding . Text ) ;
5573 }
5674
75+ #if APPIUM1
76+ [ PlatformFact ( TestPlatforms . Windows , RequiresW3CKeyActions ) ]
77+ #else
5778 [ Fact ]
79+ #endif
5880 public void Handled_KeyBinding_Does_Not_Insert_Text ( )
5981 {
6082 var textBox = Session . FindElementByAccessibilityId ( "GestureTextBox" ) ;
@@ -68,7 +90,11 @@ public void Handled_KeyBinding_Does_Not_Insert_Text()
6890 Assert . Equal ( string . Empty , content . Text ) ;
6991 }
7092
93+ #if APPIUM1
94+ [ PlatformFact ( TestPlatforms . Windows , RequiresW3CKeyActions ) ]
95+ #else
7196 [ Fact ]
97+ #endif
7298 public void Unhandled_Key_Still_Produces_Text ( )
7399 {
74100 var textBox = Session . FindElementByAccessibilityId ( "KeyDownTextBox" ) ;
@@ -83,7 +109,11 @@ public void Unhandled_Key_Still_Produces_Text()
83109 Assert . Equal ( "[b]" , lastTextInput . Text ) ;
84110 }
85111
112+ #if APPIUM1
113+ [ PlatformFact ( TestPlatforms . Windows , RequiresW3CKeyActions ) ]
114+ #else
86115 [ Fact ]
116+ #endif
87117 public void Unhandled_Space_Produces_Exactly_One_KeyDown_And_Text ( )
88118 {
89119 var textBox = Session . FindElementByAccessibilityId ( "KeyDownTextBox" ) ;
0 commit comments