@@ -49,8 +49,8 @@ public static void ClassCleanup()
4949 [ TestMethod ]
5050 public void Touch_Click_OriginElement ( )
5151 {
52- var alarmPivotItem = session . FindElementByAccessibilityId ( "AlarmPivotItem" ) ;
53- var worldClockPivotItem = session . FindElementByAccessibilityId ( "WorldClockPivotItem" ) ;
52+ var alarmPivotItem = session . FindElementByAccessibilityId ( AlarmTabAutomationId ) ;
53+ var worldClockPivotItem = session . FindElementByAccessibilityId ( WorldClockTabAutomationId ) ;
5454 Assert . IsNotNull ( alarmPivotItem ) ;
5555 Assert . IsNotNull ( worldClockPivotItem ) ;
5656 Assert . IsTrue ( alarmPivotItem . Selected ) ;
@@ -83,8 +83,8 @@ public void Touch_Click_OriginElement()
8383 [ TestMethod ]
8484 public void Touch_Click_OriginPointer ( )
8585 {
86- WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( "AlarmPivotItem" ) ;
87- WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( "WorldClockPivotItem" ) ;
86+ WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( AlarmTabAutomationId ) ;
87+ WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( WorldClockTabAutomationId ) ;
8888 int relativeX = 0 ; // Initial x coordinate
8989 int relativeY = 0 ; // Initial y coordinate
9090 Assert . IsNotNull ( alarmPivotItem ) ;
@@ -123,8 +123,8 @@ public void Touch_Click_OriginPointer()
123123 [ TestMethod ]
124124 public void Touch_Click_OriginViewport ( )
125125 {
126- WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( "AlarmPivotItem" ) ;
127- WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( "WorldClockPivotItem" ) ;
126+ WindowsElement alarmPivotItem = session . FindElementByAccessibilityId ( AlarmTabAutomationId ) ;
127+ WindowsElement worldClockPivotItem = session . FindElementByAccessibilityId ( WorldClockTabAutomationId ) ;
128128 int x = worldClockPivotItem . Location . X ; // x coordinate of UI element relative to application window
129129 int y = worldClockPivotItem . Location . Y ; // y coordinate of UI element relative to application window
130130 Assert . IsNotNull ( alarmPivotItem ) ;
@@ -290,39 +290,47 @@ public void Touch_LongClick()
290290 [ TestMethod ]
291291 public void Touch_Scroll_Horizontal ( )
292292 {
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+ }
326334 }
327335
328336 [ TestMethod ]
0 commit comments