public async Task TestGridSplitterDragHorizontalAsync() { var amount = 50; var tolerance = 10; var grid = FindElement.ByName("GridSplitterRoot"); var gridSplitter = FindElement.ById("GridSplitterHorizontal"); var box = FindElement.ByName("TopLeftBox"); Verify.IsNotNull(grid, "Can't find GridSplitterRoot"); Verify.IsNotNull(gridSplitter, "Can't find Horizontal GridSplitter"); Verify.IsNotNull(box, "Can't find box"); var width = box.BoundingRectangle.Width; ColumnDefinition columnDefinitionStart = (await VisualTreeHelper.FindElementPropertyAsync <List <ColumnDefinition> >("GridSplitterRoot", "ColumnDefinitions"))?.FirstOrDefault(); Verify.IsNotNull(columnDefinitionStart, "Couldn't retrieve Column Definition"); // Drag to the Left InputHelper.DragDistance(gridSplitter, amount, Direction.West, 1000); Wait.ForMilliseconds(1050); Wait.ForIdle(); ColumnDefinition columnDefinitionEnd = (await VisualTreeHelper.FindElementPropertyAsync <List <ColumnDefinition> >("GridSplitterRoot", "ColumnDefinitions"))?.FirstOrDefault(); Wait.ForIdle(); Verify.IsTrue(Math.Abs(columnDefinitionStart.ActualWidth - amount - columnDefinitionEnd.ActualWidth) <= tolerance, $"ColumnDefinition not in range expected {columnDefinitionStart.ActualWidth - amount} was {columnDefinitionEnd.ActualWidth}"); Verify.IsTrue(Math.Abs(width - amount - box.BoundingRectangle.Width) <= tolerance, $"Bounding box not in range expected {width - amount} was {box.BoundingRectangle.Width}."); }
public async Task TestGridSplitterDragVerticalAsync() { var amount = 50; var tolerance = 10; var grid = FindElement.ByName("GridSplitterRoot"); var gridSplitter = FindElement.ById("GridSplitterVertical"); Verify.IsNotNull(grid, "Can't find GridSplitterRoot"); Verify.IsNotNull(gridSplitter, "Can't find Vertical GridSplitter"); RowDefinition rowDefinitionStart = (await VisualTreeHelper.FindElementPropertyAsync <List <RowDefinition> >("GridSplitterRoot", "RowDefinitions"))?.FirstOrDefault(); Verify.IsNotNull(rowDefinitionStart, "Couldn't retrieve Row Definition"); // Drag to the Left InputHelper.DragDistance(gridSplitter, amount, Direction.North, 1000); Wait.ForMilliseconds(1050); Wait.ForIdle(); RowDefinition rowDefinitionEnd = (await VisualTreeHelper.FindElementPropertyAsync <List <RowDefinition> >("GridSplitterRoot", "RowDefinitions"))?.FirstOrDefault(); Wait.ForIdle(); Verify.IsTrue(Math.Abs(rowDefinitionStart.ActualHeight - amount - rowDefinitionEnd.ActualHeight) <= tolerance, $"RowDefinition not in range expected {rowDefinitionStart.ActualHeight - amount} was {rowDefinitionEnd.ActualHeight}"); }
public void DragOutsideTest() { using (var setup = new TestSetupHelper("TabView Tests")) { TextBlock dragOutsideTextBlock = FindElement.ByName <TextBlock>("TabDroppedOutsideTextBlock"); Verify.AreEqual(dragOutsideTextBlock.DocumentText, ""); Log.Comment("Drag tab out"); UIObject firstTab = TryFindElement.ByName("FirstTab"); InputHelper.DragDistance(firstTab, 50, Direction.South); Wait.ForIdle(); Log.Comment("Verify event fired"); Verify.AreEqual(dragOutsideTextBlock.DocumentText, "Home"); } }
public async Task TestGridSplitterDragHorizontalPastMaximumAsync() { var amount = 150; var gridSplitter = FindElement.ById("GridSplitterHorizontal"); Verify.IsNotNull(gridSplitter, "Can't find Horizontal GridSplitter"); // Drag to the Left InputHelper.DragDistance(gridSplitter, amount, Direction.East, 1000); Wait.ForMilliseconds(1050); Wait.ForIdle(); ColumnDefinition columnDefinitionEnd = (await VisualTreeHelper.FindElementPropertyAsync <List <ColumnDefinition> >("GridSplitterRoot", "ColumnDefinitions"))?.FirstOrDefault(); Wait.ForIdle(); Verify.AreEqual(columnDefinitionEnd.MaxWidth, columnDefinitionEnd.ActualWidth, "Column was not the maximum size expected."); }
public async Task TestGridSplitterDragVerticalPastMaximumAsync() { var amount = 150; var gridSplitter = FindElement.ById("GridSplitterVertical"); Verify.IsNotNull(gridSplitter, "Can't find Vertical GridSplitter"); // Drag to the Left InputHelper.DragDistance(gridSplitter, amount, Direction.South, 1000); Wait.ForMilliseconds(1050); Wait.ForIdle(); RowDefinition rowDefinitionEnd = (await VisualTreeHelper.FindElementPropertyAsync <List <RowDefinition> >("GridSplitterRoot", "RowDefinitions"))?.FirstOrDefault(); Wait.ForIdle(); Verify.AreEqual(rowDefinitionEnd.MaxHeight, rowDefinitionEnd.ActualHeight, "Row was not the maximum size expected."); }
public void BasicInteractionTest() { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5)) { Log.Warning("This test relies on touch input, the injection of which is only supported in RS5 and up. Test is disabled."); return; } using (var setup = new TestSetupHelper("PTR Tests")) // This literally clicks the button corresponding to the test page. { Wait.ForIdle(); Log.Comment("Retrieve the refresh container page button as generic UIElement"); UIObject refreshContainerButtonUIObject = FindElement.ByName("RefreshContainerPageButton"); Verify.IsNotNull(refreshContainerButtonUIObject, "Verifying that we found a UIElement called RefreshContainerPageButton"); Wait.ForIdle(); //Navigate to the right page InputHelper.Tap(refreshContainerButtonUIObject); Wait.ForIdle(); Log.Comment("Retrieve adapted list view as generic UIElement"); UIObject lvUIObject = FindElement.ByName("listView"); Verify.IsNotNull(lvUIObject, "Verifying that we found a UIElement called listView"); Wait.ForIdle(); Log.Comment("Retrieve list view item one as generic UIElement"); UIObject listViewItem1 = FindElement.ByName("listViewItem1"); Verify.IsNotNull(listViewItem1, "Verifying that we found a UIElement called listViewItem1"); Wait.ForIdle(); Log.Comment("Retrieve list view item two as generic UIElement"); UIObject listViewItem2 = FindElement.ByName("listViewItem2"); Verify.IsNotNull(listViewItem1, "Verifying that we found a UIElement called listViewItem2"); Wait.ForIdle(); Log.Comment("Retrieve list view item ten as generic UIElement"); UIObject listViewItem10 = FindElement.ByName("listViewItem10"); Verify.IsNotNull(listViewItem1, "Verifying that we found a UIElement called listViewItem10"); Wait.ForIdle(); Log.Comment("Retrieve list view item nine as generic UIElement"); UIObject listViewItem9 = FindElement.ByName("listViewItem9"); Verify.IsNotNull(listViewItem1, "Verifying that we found a UIElement called listViewItem9"); Wait.ForIdle(); Log.Comment("Retrieve refresh on container button as generic UIElement"); UIObject refreshOnContainerButtonUIObject = FindElement.ByName("RefreshOnContainerButton"); Verify.IsNotNull(refreshOnContainerButtonUIObject, "Verifying that we found a UIElement called RefreshOnContainerButton"); Wait.ForIdle(); Log.Comment("Retrieve refresh on visualizer button as generic UIElement"); UIObject refreshOnVisualizerButtonUIObject = FindElement.ByName("RefreshOnVisualizerButton"); Verify.IsNotNull(refreshOnVisualizerButtonUIObject, "Verifying that we found a UIElement called RefreshOnVisualizerButton"); Wait.ForIdle(); Log.Comment("Retrieve rotate refresh visualizer button as generic UIElement"); UIObject rotateButtonUIObject = FindElement.ByName("RotateButton"); Verify.IsNotNull(rotateButtonUIObject, "Verifying that we found a UIElement called RotateButton"); Wait.ForIdle(); Log.Comment("Retrieve the change alignment button as generic UIElement"); UIObject changeAlignmentUIObject = FindElement.ByName("ChangeAlignment"); Verify.IsNotNull(changeAlignmentUIObject, "Verifying that we found a UIElement called ChangeAlignment"); Wait.ForIdle(); Log.Comment("Retrieve refresh count text block as generic UIElement"); UIObject textboxUIObject = FindElement.ByName("RefreshCount"); Verify.IsNotNull(textboxUIObject, "Verifying that we found a UIElement called RefreshCount"); Edit textBox = new Edit(textboxUIObject); Wait.ForIdle(); Log.Comment("Retrieve AddOrRemoveRefreshDelay button as generic UIElement"); UIObject AddOrRemoveRefreshDelayButtonUIObject = FindElement.ByName("AddOrRemoveRefreshDelay"); Verify.IsNotNull(AddOrRemoveRefreshDelayButtonUIObject, "Verifying that we found a UIElement called AddOrRemoveRefreshDelay"); Wait.ForIdle(); InputHelper.Tap(AddOrRemoveRefreshDelayButtonUIObject); InputHelper.Tap(refreshOnContainerButtonUIObject); WaitForEditValue("RefreshCount", "1"); InputHelper.Tap(refreshOnVisualizerButtonUIObject); WaitForEditValue("RefreshCount", "2"); InputHelper.Tap(changeAlignmentUIObject); Wait.ForIdle(); InputHelper.DragDistance(listViewItem1, 450, Direction.South, 800); WaitForEditValue("RefreshCount", "3"); InputHelper.Tap(rotateButtonUIObject); InputHelper.Tap(changeAlignmentUIObject); Wait.ForIdle(); InputHelper.DragDistance(listViewItem2, 450, Direction.East, 800); WaitForEditValue("RefreshCount", "4"); //The SV won't be at the bottom of its content to start so we will enter the peeking //state and not perform a refresh InputHelper.Tap(rotateButtonUIObject); InputHelper.Tap(changeAlignmentUIObject); Wait.ForIdle(); InputHelper.DragDistance(lvUIObject, 750, Direction.North); Wait.ForIdle(); LogRefreshVisualizerStates(); Verify.AreEqual("4", textBox.Value); InputHelper.DragDistance(listViewItem10, 450, Direction.North, 800); WaitForEditValue("RefreshCount", "5"); InputHelper.Tap(rotateButtonUIObject); InputHelper.Tap(changeAlignmentUIObject); Wait.ForIdle(); InputHelper.DragDistance(listViewItem9, 450, Direction.West, 800); WaitForEditValue("RefreshCount", "6"); Log.Comment("Returning to the main PTR test page"); TestSetupHelper.GoBack(); } }
public void InteractionOnImageTestPrivate(bool withInfoProvider) { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5)) { Log.Warning("This test relies on touch input, the injection of which is only supported in RS5 and up. Test is disabled."); return; } using (var setup = new TestSetupHelper("PTR Tests")) // This literally clicks the button corresponding to the test page. { if (PlatformConfiguration.IsDevice(DeviceType.Phone)) { Log.Warning("MSFT: 12949886 - Test is disabled on phone due to reliability issues"); return; } Wait.ForIdle(); Log.Comment("Retrieve the refresh container on image page button as generic UIElement"); UIObject refreshContainerOnImageButtonUIObject = FindElement.ByName("RefreshContainerOnImagePageButton"); Verify.IsNotNull(refreshContainerOnImageButtonUIObject, "Verifying that we found a UIElement called RefreshContainerOnImagePageButton"); Wait.ForIdle(); //Navigate to the right page InputHelper.Tap(refreshContainerOnImageButtonUIObject); Wait.ForIdle(); UIObject adaptButtonUIObject = null; if (withInfoProvider) { Log.Comment("Retrieve the adapt button as generic UIElement"); adaptButtonUIObject = FindElement.ByName("AdaptButton"); Verify.IsNotNull(adaptButtonUIObject, "Verifying that we found a UIElement called AdaptButton"); Wait.ForIdle(); } Log.Comment("Retrieve adapted image as generic UIElement"); UIObject imageUIObject = FindElement.ByName("Image"); Verify.IsNotNull(imageUIObject, "Verifying that we found a UIElement called Image"); Wait.ForIdle(); Log.Comment("Retrieve refresh on container button as generic UIElement"); UIObject refreshOnContainerButtonUIObject = FindElement.ByName("RefreshOnContainerButton"); Verify.IsNotNull(refreshOnContainerButtonUIObject, "Verifying that we found a UIElement called RefreshOnContainerButton"); Wait.ForIdle(); Log.Comment("Retrieve refresh on visualizer button as generic UIElement"); UIObject refreshOnVisualizerButtonUIObject = FindElement.ByName("RefreshOnVisualizerButton"); Verify.IsNotNull(refreshOnVisualizerButtonUIObject, "Verifying that we found a UIElement called RefreshOnVisualizerButton"); Wait.ForIdle(); Log.Comment("Retrieve rotate refresh visualizer button as generic UIElement"); UIObject rotateButtonUIObject = FindElement.ByName("RotateButton"); Verify.IsNotNull(rotateButtonUIObject, "Verifying that we found a UIElement called RotateButton"); Wait.ForIdle(); Log.Comment("Retrieve the change alignment button as generic UIElement"); UIObject changeAlignmentUIObject = FindElement.ByName("ChangeAlignment"); Verify.IsNotNull(changeAlignmentUIObject, "Verifying that we found a UIElement called ChangeAlignment"); Wait.ForIdle(); Log.Comment("Retrieve AddOrRemoveRefreshDelay button as generic UIElement"); UIObject AddOrRemoveRefreshDelayButtonUIObject = FindElement.ByName("AddOrRemoveRefreshDelay"); Verify.IsNotNull(AddOrRemoveRefreshDelayButtonUIObject, "Verifying that we found a UIElement called AddOrRemoveRefreshDelay"); Wait.ForIdle(); Log.Comment("Retrieve ChangeRefreshRequested button as generic UIElement"); UIObject ChangeRefreshRequestedUIObject = FindElement.ByName("ChangeRefreshRequested"); Verify.IsNotNull(ChangeRefreshRequestedUIObject, "Verifying that we found a UIElement called ChangeRefreshRequested"); Wait.ForIdle(); if (withInfoProvider) { InputHelper.Tap(adaptButtonUIObject); Wait.ForIdle(); } InputHelper.Tap(AddOrRemoveRefreshDelayButtonUIObject); InputHelper.Tap(refreshOnContainerButtonUIObject); WaitForEditValue("RefreshCount", "1", logInteractionRatios: withInfoProvider); InputHelper.Tap(ChangeRefreshRequestedUIObject); InputHelper.Tap(refreshOnVisualizerButtonUIObject); WaitForEditValue("RefreshCount", "2", logInteractionRatios: withInfoProvider); InputHelper.Tap(ChangeRefreshRequestedUIObject); InputHelper.Tap(changeAlignmentUIObject); Wait.ForIdle(); InputHelper.DragDistance(imageUIObject, 450, Direction.South, 600); WaitForEditValue("RefreshCount", "3", logInteractionRatios: withInfoProvider); InputHelper.Tap(rotateButtonUIObject); InputHelper.Tap(changeAlignmentUIObject); Wait.ForIdle(); if (withInfoProvider) { InputHelper.Tap(adaptButtonUIObject); Wait.ForIdle(); } InputHelper.DragDistance(imageUIObject, 450, Direction.East, 600); WaitForEditValue("RefreshCount", "4", logInteractionRatios: withInfoProvider); InputHelper.Tap(rotateButtonUIObject); InputHelper.Tap(changeAlignmentUIObject); Wait.ForIdle(); if (withInfoProvider) { InputHelper.Tap(adaptButtonUIObject); Wait.ForIdle(); } InputHelper.DragDistance(imageUIObject, 450, Direction.North, 600); WaitForEditValue("RefreshCount", "5", logInteractionRatios: withInfoProvider); InputHelper.Tap(rotateButtonUIObject); InputHelper.Tap(changeAlignmentUIObject); Wait.ForIdle(); if (withInfoProvider) { InputHelper.Tap(adaptButtonUIObject); Wait.ForIdle(); } InputHelper.DragDistance(imageUIObject, 450, Direction.West, 600); WaitForEditValue("RefreshCount", "6", logInteractionRatios: withInfoProvider); Log.Comment("Returning to the main PTR test page"); TestSetupHelper.GoBack(); } }