public void DragBetweenTabViewsTest() { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5)) { // TODO 19727004: Re-enable this on versions below RS5 after fixing the bug where mouse click-and-drag doesn't work. 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("TabView Tests")) { UIObject firstTab = FindElement.ByName("FirstTab"); Verify.IsNotNull(firstTab); UIObject dropTarget = FindElement.ByName("TabInSecondTabView"); Verify.IsNotNull(dropTarget); Log.Comment("Home tab should be in the first tab view."); PressButtonAndVerifyText("GetFirstTabLocationButton", "FirstTabLocationTextBlock", "FirstTabView"); InputHelper.DragToTarget(firstTab, dropTarget); Wait.ForIdle(); ElementCache.Refresh(); Log.Comment("Home tab should now be in the second tab view."); PressButtonAndVerifyText("GetFirstTabLocationButton", "FirstTabLocationTextBlock", "SecondTabView"); Log.Comment("Home tab content should be visible."); UIObject tabContent = FindElement.ByName("FirstTabContent"); Verify.IsNotNull(tabContent); } }
public void ReorderItemsTest() { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5)) { // TODO 19727004: Re-enable this on versions below RS5 after fixing the bug where mouse click-and-drag doesn't work. 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("TabView Tests")) { Button tabItemsSourcePageButton = FindElement.ByName <Button>("TabViewTabItemsSourcePageButton"); tabItemsSourcePageButton.InvokeAndWait(); UIObject sourceTab = null; int attempts = 0; do { Wait.ForMilliseconds(100); ElementCache.Refresh(); sourceTab = FindElement.ByName("tabViewItem0"); attempts++; }while (sourceTab == null && attempts < 4); Verify.IsNotNull(sourceTab); UIObject dropTab = FindElement.ByName("tabViewItem2"); Verify.IsNotNull(dropTab); Log.Comment("Reordering tabs with drag-drop operation..."); InputHelper.DragToTarget(sourceTab, dropTab, -5); Wait.ForIdle(); ElementCache.Refresh(); Log.Comment("...reordering done. Expecting a TabView.TabItemsChanged event was raised with CollectionChange=ItemInserted and Index=1."); TextBlock tblIVectorChangedEventArgsCollectionChange = FindElement.ByName <TextBlock>("tblIVectorChangedEventArgsCollectionChange"); Verify.AreEqual("ItemInserted", tblIVectorChangedEventArgsCollectionChange.DocumentText); TextBlock tblIVectorChangedEventArgsIndex = FindElement.ByName <TextBlock>("tblIVectorChangedEventArgsIndex"); Verify.AreEqual("1", tblIVectorChangedEventArgsIndex.DocumentText); } }