@@ -49,8 +49,8 @@ public static void ClassCleanup()
49
49
[ TestMethod ]
50
50
public void Touch_Click_OriginElement ( )
51
51
{
52
- var alarmPivotItem = session . FindElementByAccessibilityId ( "AlarmPivotItem" ) ;
53
- var worldClockPivotItem = session . FindElementByAccessibilityId ( "WorldClockPivotItem" ) ;
52
+ var alarmPivotItem = session . FindElementByAccessibilityId ( AlarmTabAutomationId ) ;
53
+ var worldClockPivotItem = session . FindElementByAccessibilityId ( WorldClockTabAutomationId ) ;
54
54
Assert . IsNotNull ( alarmPivotItem ) ;
55
55
Assert . IsNotNull ( worldClockPivotItem ) ;
56
56
Assert . IsTrue ( alarmPivotItem . Selected ) ;
@@ -83,8 +83,8 @@ public void Touch_Click_OriginElement()
83
83
[ TestMethod ]
84
84
public void Touch_Click_OriginPointer ( )
85
85
{
86
- WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( "AlarmPivotItem" ) ;
87
- WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( "WorldClockPivotItem" ) ;
86
+ WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( AlarmTabAutomationId ) ;
87
+ WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( WorldClockTabAutomationId ) ;
88
88
int relativeX = 0 ; // Initial x coordinate
89
89
int relativeY = 0 ; // Initial y coordinate
90
90
Assert . IsNotNull ( alarmPivotItem ) ;
@@ -123,8 +123,8 @@ public void Touch_Click_OriginPointer()
123
123
[ TestMethod ]
124
124
public void Touch_Click_OriginViewport ( )
125
125
{
126
- WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( "AlarmPivotItem" ) ;
127
- WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( "WorldClockPivotItem" ) ;
126
+ WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( AlarmTabAutomationId ) ;
127
+ WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( WorldClockTabAutomationId ) ;
128
128
int x = worldClockPivotItem . Location . X ; // x coordinate of UI element relative to application window
129
129
int y = worldClockPivotItem . Location . Y ; // y coordinate of UI element relative to application window
130
130
Assert . IsNotNull ( alarmPivotItem ) ;
@@ -290,39 +290,47 @@ public void Touch_LongClick()
290
290
[ TestMethod ]
291
291
public void Touch_Scroll_Horizontal ( )
292
292
{
293
- WindowsElement homePagePivot = session . FindElementByAccessibilityId ( "HomePagePivot" ) ;
294
- WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( "AlarmPivotItem" ) ;
295
- WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( "WorldClockPivotItem" ) ;
296
- Assert . IsNotNull ( homePagePivot ) ;
297
- Assert . IsNotNull ( alarmPivotItem ) ;
298
- Assert . IsNotNull ( worldClockPivotItem ) ;
299
- Assert . IsTrue ( alarmPivotItem . Selected ) ;
300
- Assert . IsFalse ( worldClockPivotItem . Selected ) ;
301
-
302
- // Perform scroll left touch action to switch from Alarm to WorldClock tab
303
- PointerInputDevice touchDevice = new PointerInputDevice ( PointerKind . Touch ) ;
304
- ActionSequence sequence = new ActionSequence ( touchDevice , 0 ) ;
305
- sequence . AddAction ( touchDevice . CreatePointerMove ( homePagePivot , 0 , 0 , TimeSpan . Zero ) ) ;
306
- sequence . AddAction ( touchDevice . CreatePointerDown ( PointerButton . TouchContact ) ) ;
307
- sequence . AddAction ( touchDevice . CreatePointerMove ( homePagePivot , - session . Manage ( ) . Window . Size . Width / 2 , 0 , TimeSpan . FromSeconds ( .5 ) ) ) ;
308
- sequence . AddAction ( touchDevice . CreatePointerUp ( PointerButton . TouchContact ) ) ;
309
- session . PerformActions ( new List < ActionSequence > { sequence } ) ;
310
-
311
- Thread . Sleep ( TimeSpan . FromSeconds ( 1 ) ) ;
312
- Assert . IsFalse ( alarmPivotItem . Selected ) ;
313
- Assert . IsTrue ( worldClockPivotItem . Selected ) ;
314
-
315
- // Perform scroll right touch action to switch back from WorldClock to Alarm tab
316
- sequence = new ActionSequence ( touchDevice , 0 ) ;
317
- sequence . AddAction ( touchDevice . CreatePointerMove ( homePagePivot , 0 , 0 , TimeSpan . Zero ) ) ;
318
- sequence . AddAction ( touchDevice . CreatePointerDown ( PointerButton . TouchContact ) ) ;
319
- sequence . AddAction ( touchDevice . CreatePointerMove ( homePagePivot , session . Manage ( ) . Window . Size . Width / 2 , 0 , TimeSpan . FromSeconds ( .5 ) ) ) ;
320
- sequence . AddAction ( touchDevice . CreatePointerUp ( PointerButton . TouchContact ) ) ;
321
- session . PerformActions ( new List < ActionSequence > { sequence } ) ;
322
-
323
- Thread . Sleep ( TimeSpan . FromSeconds ( 1 ) ) ;
324
- Assert . IsTrue ( alarmPivotItem . Selected ) ;
325
- Assert . IsFalse ( worldClockPivotItem . Selected ) ;
293
+ // Different Alarm & Clock application version uses different UI elements
294
+ if ( AlarmTabClassName == "ListViewItem" )
295
+ {
296
+ // The latest Alarms & Clock application no longer has horizontal scroll UI elements
297
+ }
298
+ else
299
+ {
300
+ WindowsElement homePagePivot = session . FindElementByAccessibilityId ( "HomePagePivot" ) ;
301
+ WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( AlarmTabAutomationId ) ;
302
+ WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( WorldClockTabAutomationId ) ;
303
+ Assert . IsNotNull ( homePagePivot ) ;
304
+ Assert . IsNotNull ( alarmPivotItem ) ;
305
+ Assert . IsNotNull ( worldClockPivotItem ) ;
306
+ Assert . IsTrue ( alarmPivotItem . Selected ) ;
307
+ Assert . IsFalse ( worldClockPivotItem . Selected ) ;
308
+
309
+ // Perform scroll left touch action to switch from Alarm to WorldClock tab
310
+ PointerInputDevice touchDevice = new PointerInputDevice ( PointerKind . Touch ) ;
311
+ ActionSequence sequence = new ActionSequence ( touchDevice , 0 ) ;
312
+ sequence . AddAction ( touchDevice . CreatePointerMove ( homePagePivot , 0 , 0 , TimeSpan . Zero ) ) ;
313
+ sequence . AddAction ( touchDevice . CreatePointerDown ( PointerButton . TouchContact ) ) ;
314
+ sequence . AddAction ( touchDevice . CreatePointerMove ( homePagePivot , - session . Manage ( ) . Window . Size . Width / 2 , 0 , TimeSpan . FromSeconds ( .5 ) ) ) ;
315
+ sequence . AddAction ( touchDevice . CreatePointerUp ( PointerButton . TouchContact ) ) ;
316
+ session . PerformActions ( new List < ActionSequence > { sequence } ) ;
317
+
318
+ Thread . Sleep ( TimeSpan . FromSeconds ( 1 ) ) ;
319
+ Assert . IsFalse ( alarmPivotItem . Selected ) ;
320
+ Assert . IsTrue ( worldClockPivotItem . Selected ) ;
321
+
322
+ // Perform scroll right touch action to switch back from WorldClock to Alarm tab
323
+ sequence = new ActionSequence ( touchDevice , 0 ) ;
324
+ sequence . AddAction ( touchDevice . CreatePointerMove ( homePagePivot , 0 , 0 , TimeSpan . Zero ) ) ;
325
+ sequence . AddAction ( touchDevice . CreatePointerDown ( PointerButton . TouchContact ) ) ;
326
+ sequence . AddAction ( touchDevice . CreatePointerMove ( homePagePivot , session . Manage ( ) . Window . Size . Width / 2 , 0 , TimeSpan . FromSeconds ( .5 ) ) ) ;
327
+ sequence . AddAction ( touchDevice . CreatePointerUp ( PointerButton . TouchContact ) ) ;
328
+ session . PerformActions ( new List < ActionSequence > { sequence } ) ;
329
+
330
+ Thread . Sleep ( TimeSpan . FromSeconds ( 1 ) ) ;
331
+ Assert . IsTrue ( alarmPivotItem . Selected ) ;
332
+ Assert . IsFalse ( worldClockPivotItem . Selected ) ;
333
+ }
326
334
}
327
335
328
336
[ TestMethod ]
0 commit comments