// [TestMethod] public void VerifyRatingItemFallback() { // This test is actually performed in the test app itself, so go look at RatingControlPage.xaml.cs for the meat of it. using (var setup = new TestSetupHelper("RatingControl Tests")) // This literally clicks the button corresponding to the test page. { if (!PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone1)) { Log.Warning("Test is disabled on RS1 due to scrolling unreliability"); return; } Log.Comment("Retrieve PointerOverPlaceholderFallbackRating rating control as generic UIElement"); UIObject popRating = FindElement.ById("PointerOverPlaceholderFallbackRating"); Verify.IsNotNull(popRating, "Verifying that we found a UIElement called PointerOverPlaceholderFallbackRating"); InputHelper.ScrollToElement(popRating); popRating.Tap(); // Since on phone it's touch, I do a tap to trigger that. popRating.Click(); Wait.ForIdle(); Log.Comment("Retrieve PointerOverFallbackRating rating control as generic UIElement"); UIObject pointerOver = FindElement.ById("PointerOverFallbackRating"); Verify.IsNotNull(pointerOver, "Verifying that we found a UIElement called PointerOverFallbackRating"); InputHelper.ScrollToElement(pointerOver); pointerOver.Click(); pointerOver.Tap(); Wait.ForIdle(); TextBlock textBlock = new TextBlock(FindElement.ById("UnsetFallbackTextBlock")); Verify.AreEqual("+", textBlock.DocumentText, "Verify Unset glyph falls back onto Glyph"); TextBlock textBlock2 = new TextBlock(FindElement.ById("PlaceholderFallbackTextBlock")); Verify.AreEqual("+", textBlock2.DocumentText, "Verify Placeholder glyph falls back onto Glyph"); TextBlock textBlock3 = new TextBlock(FindElement.ById("DisabledFallbackTextBlock")); Verify.AreEqual("+", textBlock3.DocumentText, "Verify Disabled glyph falls back onto Glyph"); ElementCache.Clear(); TextBlock textBlock4 = new TextBlock(FindElement.ById("PointerOverPlaceholderFallbackTextBlock")); Verify.AreEqual("+", textBlock4.DocumentText, "Verify PointerOverPlaceholder glyph falls back onto Placeholder"); TextBlock textBlock5 = new TextBlock(FindElement.ById("PointerOverFallbackTextBlock")); Verify.AreEqual("+", textBlock5.DocumentText, "Verify PointerOver glyph falls back onto Glyph"); TextBlock textBlock6 = new TextBlock(FindElement.ById("NoFallbackTextBlock")); Verify.AreEqual("+", textBlock6.DocumentText, "Verify a glyph didn't fall back if it wasn't meant to"); // Image: Log.Comment("Retrieve PointerOverPlaceholderImageFallbackRating rating control as generic UIElement"); popRating = FindElement.ById("PointerOverPlaceholderImageFallbackRating"); Verify.IsNotNull(popRating, "Verifying that we found a UIElement called PointerOverPlaceholderImageFallbackRating"); InputHelper.ScrollToElement(popRating); Wait.ForIdle(); popRating.Tap(); // Since on phone it's touch, I do a tap to trigger that. popRating.Click(); Wait.ForIdle(); Log.Comment("Retrieve PointerOverImageFallbackRating rating control as generic UIElement"); pointerOver = FindElement.ById("PointerOverImageFallbackRating"); Verify.IsNotNull(pointerOver, "Verifying that we found a UIElement called PointerOverImageFallbackRating"); pointerOver.Tap(); pointerOver.Click(); Wait.ForIdle(); textBlock = new TextBlock(FindElement.ById("UnsetImageFallbackTextBlock")); Verify.AreEqual("+", textBlock.DocumentText, "Verify Unset image falls back onto Image"); textBlock2 = new TextBlock(FindElement.ById("PlaceholderImageFallbackTextBlock")); Verify.AreEqual("+", textBlock2.DocumentText, "Verify Placeholder image falls back onto Image"); textBlock3 = new TextBlock(FindElement.ById("DisabledImageFallbackTextBlock")); Verify.AreEqual("+", textBlock3.DocumentText, "Verify Disabled image falls back onto Image"); ElementCache.Clear(); textBlock4 = new TextBlock(FindElement.ById("PointerOverPlaceholderImageFallbackTextBlock")); Verify.AreEqual("+", textBlock4.DocumentText, "Verify PointerOverPlaceholder image falls back onto PlaceholderImage"); textBlock5 = new TextBlock(FindElement.ById("PointerOverImageFallbackTextBlock")); Verify.AreEqual("+", textBlock5.DocumentText, "Verify PointerOver image falls back onto Image"); } }
public void OneTimeSetUp() { helper = new TestSetupHelper(WebApiConfig.Register, false); }
public void SpecifiedPlacement() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); ScrollTargetIntoView(); ScrollBy(10); SetHeroContent(HeroContentOptions.NoContent); var targetRect = GetTargetBounds(); // All positions are valid UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true); SetPreferredPlacement(PlacementOptions.Top); VerifyPlacement("Top"); SetPreferredPlacement(PlacementOptions.Bottom); VerifyPlacement("Bottom"); SetPreferredPlacement(PlacementOptions.Left); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.Right); VerifyPlacement("Right"); SetPreferredPlacement(PlacementOptions.TopRight); VerifyPlacement("TopRight"); SetPreferredPlacement(PlacementOptions.TopLeft); VerifyPlacement("TopLeft"); SetPreferredPlacement(PlacementOptions.BottomRight); VerifyPlacement("BottomRight"); SetPreferredPlacement(PlacementOptions.BottomLeft); VerifyPlacement("BottomLeft"); SetPreferredPlacement(PlacementOptions.LeftTop); VerifyPlacement("LeftTop"); SetPreferredPlacement(PlacementOptions.LeftBottom); VerifyPlacement("LeftBottom"); SetPreferredPlacement(PlacementOptions.RightTop); VerifyPlacement("RightTop"); SetPreferredPlacement(PlacementOptions.RightBottom); VerifyPlacement("RightBottom"); SetPreferredPlacement(PlacementOptions.Center); VerifyPlacement("Center"); // Eliminate left of the target UseTestBounds(targetRect.W - 120, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true); SetPreferredPlacement(PlacementOptions.Top); VerifyPlacement("Top"); SetPreferredPlacement(PlacementOptions.Bottom); VerifyPlacement("Bottom"); SetPreferredPlacement(PlacementOptions.Left); VerifyPlacement("Right"); SetPreferredPlacement(PlacementOptions.Right); VerifyPlacement("Right"); SetPreferredPlacement(PlacementOptions.TopRight); VerifyPlacement("TopRight"); SetPreferredPlacement(PlacementOptions.TopLeft); VerifyPlacement("Top"); SetPreferredPlacement(PlacementOptions.BottomRight); VerifyPlacement("BottomRight"); SetPreferredPlacement(PlacementOptions.BottomLeft); VerifyPlacement("Bottom"); SetPreferredPlacement(PlacementOptions.LeftTop); VerifyPlacement("Right"); SetPreferredPlacement(PlacementOptions.LeftBottom); VerifyPlacement("Right"); SetPreferredPlacement(PlacementOptions.RightTop); VerifyPlacement("RightTop"); SetPreferredPlacement(PlacementOptions.RightBottom); VerifyPlacement("RightBottom"); SetPreferredPlacement(PlacementOptions.Center); VerifyPlacement("Center"); // Eliminate top of the target UseTestBounds(targetRect.W - 500, targetRect.X - 1, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true); SetPreferredPlacement(PlacementOptions.Top); VerifyPlacement("Bottom"); SetPreferredPlacement(PlacementOptions.Bottom); VerifyPlacement("Bottom"); SetPreferredPlacement(PlacementOptions.Left); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.Right); VerifyPlacement("Right"); SetPreferredPlacement(PlacementOptions.TopRight); VerifyPlacement("Bottom"); SetPreferredPlacement(PlacementOptions.TopLeft); VerifyPlacement("Bottom"); SetPreferredPlacement(PlacementOptions.BottomRight); VerifyPlacement("BottomRight"); SetPreferredPlacement(PlacementOptions.BottomLeft); VerifyPlacement("BottomLeft"); SetPreferredPlacement(PlacementOptions.LeftTop); VerifyPlacement("LeftTop"); SetPreferredPlacement(PlacementOptions.LeftBottom); VerifyPlacement("LeftBottom"); SetPreferredPlacement(PlacementOptions.RightTop); VerifyPlacement("RightTop"); SetPreferredPlacement(PlacementOptions.RightBottom); VerifyPlacement("RightBottom"); SetPreferredPlacement(PlacementOptions.Center); VerifyPlacement("Center"); // Eliminate right of the target UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 500, targetRect.Z + 1000, targetRect, true); SetPreferredPlacement(PlacementOptions.Top); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.Bottom); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.Left); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.Right); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.TopRight); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.TopLeft); VerifyPlacement("TopLeft"); SetPreferredPlacement(PlacementOptions.BottomRight); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.BottomLeft); VerifyPlacement("BottomLeft"); SetPreferredPlacement(PlacementOptions.LeftTop); VerifyPlacement("LeftTop"); SetPreferredPlacement(PlacementOptions.LeftBottom); VerifyPlacement("LeftBottom"); SetPreferredPlacement(PlacementOptions.RightTop); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.RightBottom); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.Center); VerifyPlacement("Left"); // Eliminate bottom of target UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 501, targetRect, true); SetPreferredPlacement(PlacementOptions.Top); VerifyPlacement("Top"); SetPreferredPlacement(PlacementOptions.Bottom); VerifyPlacement("Top"); SetPreferredPlacement(PlacementOptions.Left); VerifyPlacement("Left"); SetPreferredPlacement(PlacementOptions.Right); VerifyPlacement("Right"); SetPreferredPlacement(PlacementOptions.TopRight); VerifyPlacement("TopRight"); SetPreferredPlacement(PlacementOptions.TopLeft); VerifyPlacement("TopLeft"); SetPreferredPlacement(PlacementOptions.BottomRight); VerifyPlacement("Top"); SetPreferredPlacement(PlacementOptions.BottomLeft); VerifyPlacement("Top"); SetPreferredPlacement(PlacementOptions.LeftTop); VerifyPlacement("LeftTop"); SetPreferredPlacement(PlacementOptions.LeftBottom); VerifyPlacement("LeftBottom"); SetPreferredPlacement(PlacementOptions.RightTop); VerifyPlacement("RightTop"); SetPreferredPlacement(PlacementOptions.RightBottom); VerifyPlacement("RightBottom"); SetPreferredPlacement(PlacementOptions.Center); VerifyPlacement("Center"); } } }
public void VerifyCorrectVisualStateWhenChangingPaneDisplayMode() { // We expect this mapping: // Top, and LeftMinimal -> VisualState Minimal // LeftCompact -> VisualState Compact // Left -> VisualState Expanded using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" })) { var panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox")); var getActiveVisualStateButton = new Button(FindElement.ByName("GetActiveVisualState")); var invokeResult = new Edit(FindElement.ById("TestResult")); var isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); Log.Comment("Set PaneDisplayMode to Top"); panelDisplayModeComboBox.SelectItemByName("Top"); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { getActiveVisualStateButton.Click(); waiter.Wait(); } Verify.IsTrue(invokeResult.Value.Contains("Minimal")); Log.Comment("Set PaneDisplayMode to Left"); panelDisplayModeComboBox.SelectItemByName("Left"); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { getActiveVisualStateButton.Click(); waiter.Wait(); } Verify.IsTrue(invokeResult.Value.Contains("Expanded")); Log.Comment("Set PaneDisplayMode to Top"); panelDisplayModeComboBox.SelectItemByName("Top"); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { getActiveVisualStateButton.Click(); waiter.Wait(); } Verify.IsTrue(invokeResult.Value.Contains("Minimal")); Log.Comment("Set PaneDisplayMode to LeftCompact"); panelDisplayModeComboBox.SelectItemByName("LeftCompact"); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { getActiveVisualStateButton.Click(); waiter.Wait(); } Verify.IsTrue(invokeResult.Value.Contains("Compact")); Log.Comment("Set PaneDisplayMode to LeftMinimal"); panelDisplayModeComboBox.SelectItemByName("LeftMinimal"); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { getActiveVisualStateButton.Click(); waiter.Wait(); } Verify.IsTrue(invokeResult.Value.Contains("Minimal")); Log.Comment("Verify Pane is closed automatically when PaneDisplayMode is Minimal"); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False when PaneDisplayMode is Minimal"); Log.Comment("Set DisplayMode to Left"); panelDisplayModeComboBox.SelectItemByName("Left"); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { getActiveVisualStateButton.Click(); waiter.Wait(); } Verify.IsTrue(invokeResult.Value.Contains("Expanded")); Log.Comment("Verify Pane is opened automatically when PaneDisplayMode is changed from Minimal to Left"); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True when PaneDisplayMode is changed from Minimal to Left"); } }
public void UpdateMinMaxTest() { using (var setup = new TestSetupHelper("ProgressBar Tests")) { Log.Comment("Updating Minimum and Maximum value of ProgressBar"); RangeValueSpinner progressBar = FindElement.ByName <RangeValueSpinner>("TestProgressBar"); double oldMinimumInputText = progressBar.Minimum; double oldMaximumInputText = progressBar.Maximum; Edit minimumInput = FindElement.ByName <Edit>("MinimumInput"); Edit maximumInput = FindElement.ByName <Edit>("MaximumInput"); minimumInput.SetValue("10"); maximumInput.SetValue("15"); Button updateMinMaxButton = FindElement.ByName <Button>("UpdateMinMaxButton"); updateMinMaxButton.InvokeAndWait(); double newMinimumInputText = progressBar.Minimum; double newMaximumInputText = progressBar.Maximum; Verify.AreNotSame(oldMinimumInputText, newMinimumInputText, "Minimum updated"); Verify.AreNotSame(oldMaximumInputText, newMaximumInputText, "Maximum updated"); // Below edge cases are handled by Rangebase Log.Comment("Updating Minimum and Maximum when Maximum < Minimum"); maximumInput.SetValue("5"); updateMinMaxButton.InvokeAndWait(); Verify.AreEqual(progressBar.Minimum, progressBar.Maximum, "Maximum updates to equal Minimum"); Log.Comment("Updating Minimum and Maximum when Minimum > Value"); minimumInput.SetValue("15"); updateMinMaxButton.InvokeAndWait(); Verify.AreEqual(progressBar.Value, progressBar.Minimum, "Value updates to equal Minimum"); Verify.AreEqual(progressBar.Maximum, progressBar.Minimum, "Maximum also updates to equal Minimum"); Log.Comment("Updating Minimum and Maximum to be a decimal number"); minimumInput.SetValue("0.1"); maximumInput.SetValue("1.1"); updateMinMaxButton.InvokeAndWait(); double oldValue = progressBar.Value; Button changeValueButton = FindElement.ByName <Button>("ChangeValueButton"); changeValueButton.InvokeAndWait(); double newValue = progressBar.Value; double diff = Math.Abs(oldValue - newValue); Verify.IsGreaterThan(diff, Convert.ToDouble(0), "Value of ProgressBar increments properly within range with decimal Minimum and Maximum"); } }
public void DisabledItemsAtTopOfColumnKeyboardTest() { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone3)) { Log.Warning("This test requires RS3+ keyboarding behavior"); return; } using (var setup = new TestSetupHelper("RadioButtons Tests")) { elements = new RadioButtonsTestPageElements(); SetItemType(RadioButtonsSourceType.RadioButton); SetNumberOfColumns(3); foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation))) { SetSource(location); SetNumberOfItems(10); InsertDisabledRadioButton(5); InsertDisabledRadioButton(5); InsertDisabledRadioButton(5); TapOnItem(0); VerifySelectedFocusedIndex(0); KeyboardHelper.PressKey(Key.Right); VerifySelectedFocusedIndex(9); TapOnItem(1); VerifySelectedFocusedIndex(1); KeyboardHelper.PressKey(Key.Right); VerifySelectedFocusedIndex(10); TapOnItem(2); VerifySelectedFocusedIndex(2); KeyboardHelper.PressKey(Key.Right); VerifySelectedFocusedIndex(11); TapOnItem(3); VerifySelectedFocusedIndex(3); KeyboardHelper.PressKey(Key.Right); VerifySelectedFocusedIndex(8); TapOnItem(4); VerifySelectedFocusedIndex(4); KeyboardHelper.PressKey(Key.Right); VerifySelectedFocusedIndex(8); TapOnItem(6); VerifySelectedFocusedIndex(9); KeyboardHelper.PressKey(Key.Left); VerifySelectedFocusedIndex(0); TapOnItem(7); VerifySelectedFocusedIndex(10); KeyboardHelper.PressKey(Key.Left); VerifySelectedFocusedIndex(1); TapOnItem(8); VerifySelectedFocusedIndex(11); KeyboardHelper.PressKey(Key.Left); VerifySelectedFocusedIndex(2); TapOnItem(9); VerifySelectedFocusedIndex(12); KeyboardHelper.PressKey(Key.Left); VerifySelectedFocusedIndex(8); ElementCache.Clear(); } } }
public void PaneDisplayModeLeftLeftCompactLeftMinimalTest() { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" })) { var displayModeTextBox = new TextBlock(FindElement.ByName("DisplayModeTextBox")); var panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox")); // Tests with PaneDisplayMode=Left/LeftCompact/LeftMinimal. // This disables all adaptive layout behavior. Log.Comment("Test PaneDisplayMode=Left"); panelDisplayModeComboBox.SelectItemByName("Left"); Wait.ForIdle(); Log.Comment("DisplayMode should be 'Expanded' regardless of size"); SetNavViewWidth(ControlWidth.Narrow); Wait.ForIdle(); Verify.AreEqual(expanded, displayModeTextBox.DocumentText); SetNavViewWidth(ControlWidth.Medium); Wait.ForIdle(); Verify.AreEqual(expanded, displayModeTextBox.DocumentText); SetNavViewWidth(ControlWidth.Wide); Wait.ForIdle(); Verify.AreEqual(expanded, displayModeTextBox.DocumentText); Log.Comment("Test PaneDisplayMode=LeftCompact"); panelDisplayModeComboBox.SelectItemByName("LeftCompact"); Wait.ForIdle(); Log.Comment("DisplayMode should be 'Compact' regardless of size"); SetNavViewWidth(ControlWidth.Narrow); Wait.ForIdle(); Verify.AreEqual(compact, displayModeTextBox.DocumentText); SetNavViewWidth(ControlWidth.Medium); Wait.ForIdle(); Verify.AreEqual(compact, displayModeTextBox.DocumentText); SetNavViewWidth(ControlWidth.Wide); Wait.ForIdle(); Verify.AreEqual(compact, displayModeTextBox.DocumentText); Log.Comment("Test PaneDisplayMode=LeftMinimal"); panelDisplayModeComboBox.SelectItemByName("LeftMinimal"); Wait.ForIdle(); Log.Comment("DisplayMode should be 'Minimal' regardless of size"); SetNavViewWidth(ControlWidth.Narrow); Wait.ForIdle(); Verify.AreEqual(minimal, displayModeTextBox.DocumentText); SetNavViewWidth(ControlWidth.Medium); Wait.ForIdle(); Verify.AreEqual(minimal, displayModeTextBox.DocumentText); SetNavViewWidth(ControlWidth.Wide); Wait.ForIdle(); Verify.AreEqual(minimal, displayModeTextBox.DocumentText); } }
public void OneTimeSetUp() { helper = new TestSetupHelper(WebApiConfig.Register, false); ConfigurationManager.AppSettings["Ldap_ConnectionString"] = "ldapHost:ldap1.uni-jena.de;ldapPort:636;ldapBaseDn:ou=users,dc=uni-jena,dc=de;ldapSecure:true;ldapAuthUid:uid;ldapProtocolVersion:3"; }
public void AutoPlacement() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); ScrollTargetIntoView(); ScrollBy(10); var targetRect = GetTargetBounds(); UseTestWindowBounds(targetRect.W - 329, targetRect.X - 340, targetRect.Y + 656, targetRect.Z + 680); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("Top")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 329, targetRect.X - 336, targetRect.Y + 656, targetRect.Z + 680); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("Bottom")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 329, targetRect.X - 318, targetRect.Y + 658, targetRect.Z + 640); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("RightEdgeAlignedTop")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 329, targetRect.X - 100, targetRect.Y + 658, targetRect.Z + 403); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("RightEdgeAlignedBottom")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 329, targetRect.X - 100, targetRect.Y + 643, targetRect.Z + 403); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("LeftEdgeAlignedBottom")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 329, targetRect.X - 300, targetRect.Y + 643, targetRect.Z + 603); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("LeftEdgeAlignedTop")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 328, targetRect.X - 340, targetRect.Y + 348, targetRect.Z + 608); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("TopEdgeAlignedLeft")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 20, targetRect.X - 340, targetRect.Y + 348, targetRect.Z + 608); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("TopEdgeAlignedRight")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 328, targetRect.X - 100, targetRect.Y + 348, targetRect.Z + 444); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("BottomEdgeAlignedLeft")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 20, targetRect.X - 100, targetRect.Y + 348, targetRect.Z + 444); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("BottomEdgeAlignedRight")); CloseTeachingTipProgrammatically(); // Remove the bleeding content; SetBleedingContent(BleedingContentOptions.NoContent); UseTestWindowBounds(targetRect.W - 329, targetRect.X - 100, targetRect.Y + 349, targetRect.Z + 20); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("Left")); CloseTeachingTipProgrammatically(); UseTestWindowBounds(targetRect.W - 20, targetRect.X - 100, targetRect.Y + 349, targetRect.Z + 20); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("Right")); CloseTeachingTipProgrammatically(); } }
public void VerifyUniformGridLayoutScrolling() { using (var setup = new TestSetupHelper("ItemsRepeater Tests")) { // Open page FindElement.ByName("UniformGridLayoutDemo").Click(); // Set ScrollViewer HorizontalScrollBarVisibility to Disabled. Log.Comment("Retrieving CmbScrollViewerHorizontalScrollBarVisibility"); UIObject CmbScrollViewerHorizontalScrollBarVisibilityUIObject = FindElement.ByName("CmbScrollViewerHorizontalScrollBarVisibility"); ComboBox CmbScrollViewerHorizontalScrollBarVisibility = new ComboBox(CmbScrollViewerHorizontalScrollBarVisibilityUIObject); Verify.IsNotNull(CmbScrollViewerHorizontalScrollBarVisibility, "Verifying that CmbScrollViewerHorizontalScrollBarVisibility ComboBox was found"); Log.Comment("Changing ScrollViewer HorizontalScrollBarVisibility to Disabled"); CmbScrollViewerHorizontalScrollBarVisibility.SelectItemByName("Disabled"); Log.Comment("Selection is now {0}", CmbScrollViewerHorizontalScrollBarVisibility.Selection[0].Name); // Set ScrollViewer MaxWidth to 500. Log.Comment("Retrieving ScrollViewerMaxWidth"); UIObject ScrollViewerMaxWidthUIObject = FindElement.ByName("ScrollViewerMaxWidth"); Edit ScrollViewerMaxWidthTextBox = new Edit(ScrollViewerMaxWidthUIObject); Verify.IsNotNull(ScrollViewerMaxWidthTextBox, "Verifying that ScrollViewerMaxWidth Edit was found"); ScrollViewerMaxWidthTextBox.SetValue("500"); Wait.ForIdle(); Log.Comment("ScrollViewerMaxWidth: " + ScrollViewerMaxWidthTextBox.Value); Log.Comment("Retrieving SetScrollViewerMaxWidth"); UIObject SetScrollViewerMaxWidthUIObject = FindElement.ByName("SetScrollViewerMaxWidth"); Button SetScrollViewerMaxWidthButton = new Button(SetScrollViewerMaxWidthUIObject); Verify.IsNotNull(SetScrollViewerMaxWidthUIObject, "Verifying that SetScrollViewerMaxWidth Button was found"); Log.Comment("Updating ScrollViewerMaxWidth"); SetScrollViewerMaxWidthButton.Invoke(); Wait.ForIdle(); // Set UniformGridLayout ItemsStretch to Fill. Log.Comment("Retrieving CmbUniformGridLayoutItemsStretch"); UIObject CmbUniformGridLayoutItemsStretchUIObject = FindElement.ByName("CmbUniformGridLayoutItemsStretch"); ComboBox CmbUniformGridLayoutItemsStretch = new ComboBox(CmbUniformGridLayoutItemsStretchUIObject); Verify.IsNotNull(CmbUniformGridLayoutItemsStretch, "Verifying that CmbUniformGridLayoutItemsStretch ComboBox was found"); Log.Comment("Changing UniformGridLayout ItemsStretch to Fill"); CmbUniformGridLayoutItemsStretch.SelectItemByName("Fill"); Log.Comment("Selection is now {0}", CmbUniformGridLayoutItemsStretch.Selection[0].Name); // Set UniformGridLayout MinColumnSpacing to 50. Log.Comment("Retrieving UniformGridLayoutMinColumnSpacing"); UIObject UniformGridLayoutMinColumnSpacingUIObject = FindElement.ByName("UniformGridLayoutMinColumnSpacing"); Edit UniformGridLayoutMinColumnSpacingTextBox = new Edit(UniformGridLayoutMinColumnSpacingUIObject); Verify.IsNotNull(UniformGridLayoutMinColumnSpacingTextBox, "Verifying that UniformGridLayoutMinColumnSpacing Edit was found"); UniformGridLayoutMinColumnSpacingTextBox.SetValue("50"); Wait.ForIdle(); Log.Comment("UniformGridLayoutMinColumnSpacing: " + UniformGridLayoutMinColumnSpacingTextBox.Value); Log.Comment("Retrieving SetUniformGridLayoutMinColumnSpacing"); UIObject SetUniformGridLayoutMinColumnSpacingUIObject = FindElement.ByName("SetUniformGridLayoutMinColumnSpacing"); Button SetUniformGridLayoutMinColumnSpacingButton = new Button(SetUniformGridLayoutMinColumnSpacingUIObject); Verify.IsNotNull(SetUniformGridLayoutMinColumnSpacingUIObject, "Verifying that SetUniformGridLayoutMinColumnSpacing Button was found"); Log.Comment("Updating UniformGridLayoutMinColumnSpacing"); SetUniformGridLayoutMinColumnSpacingButton.Invoke(); Wait.ForIdle(); // Set ScrollViewer VerticalOffset to 1000. Log.Comment("Retrieving ScrollViewerVerticalOffset"); UIObject ScrollViewerVerticalOffsetUIObject = FindElement.ByName("ScrollViewerVerticalOffset"); Edit ScrollViewerVerticalOffsetTextBox = new Edit(ScrollViewerVerticalOffsetUIObject); Verify.IsNotNull(ScrollViewerVerticalOffsetTextBox, "Verifying that ScrollViewerVerticalOffset Edit was found"); ScrollViewerVerticalOffsetTextBox.SetValue("1000"); Wait.ForIdle(); Log.Comment("ScrollViewerVerticalOffset: " + ScrollViewerVerticalOffsetTextBox.Value); Log.Comment("Retrieving SetScrollViewerVerticalOffset"); UIObject SetScrollViewerVerticalOffsetUIObject = FindElement.ByName("SetScrollViewerVerticalOffset"); Button SetScrollViewerVerticalOffsetButton = new Button(SetScrollViewerVerticalOffsetUIObject); Verify.IsNotNull(SetScrollViewerVerticalOffsetUIObject, "Verifying that SetScrollViewerVerticalOffset Button was found"); Log.Comment("Scrolling to ScrollViewer VerticalOffset 1000 by invoking SetScrollViewerVerticalOffset Button"); SetScrollViewerVerticalOffsetButton.Invoke(); Wait.ForIdle(); Log.Comment("Retrieving GetScrollViewerVerticalOffset"); UIObject GetScrollViewerVerticalOffsetUIObject = FindElement.ByName("GetScrollViewerVerticalOffset"); Button GetScrollViewerVerticalOffsetButton = new Button(GetScrollViewerVerticalOffsetUIObject); Verify.IsNotNull(GetScrollViewerVerticalOffsetUIObject, "Verifying that GetScrollViewerVerticalOffset Button was found"); Log.Comment("Retrieving ScrollViewer VerticalOffset by invoking GetScrollViewerVerticalOffset Button"); GetScrollViewerVerticalOffsetButton.Invoke(); Wait.ForIdle(); Log.Comment("ScrollViewerVerticalOffset: " + ScrollViewerVerticalOffsetTextBox.Value); Verify.AreEqual("1000", ScrollViewerVerticalOffsetTextBox.Value, "Verifying that final ScrollViewer VerticalOffset is requested 1000."); } }
// Regression Test for Bug 11144540:Acrylic noise surface is lost after workstation sleep/resume //[TestMethod] //[TestProperty("Platform", "Desktop")] // Disabled due to: Bug 19996114: Unstable test: InteractionTests.AcrylicBrushTests.HideAndShowWindow public void HideAndShowWindow() { if (!OnRS2OrGreater()) { return; } using (IDisposable page1 = new TestSetupHelper("Acrylic Tests"), page2 = new TestSetupHelper("navigateToBasicAcrylic")) { { ChooseFromComboBox("TestNameComboBox", "HideAndShowWindow"); if (PlatformConfiguration.IsDevice(DeviceType.Phone)) { Log.Warning("Test is disabled on phone."); return; } Button runTestButton; var result = new Edit(FindElement.ById("TestResult")); using (var waiter = new ValueChangedEventWaiter(result)) { runTestButton = new Button(FindElement.ById("RunTestButton")); runTestButton.Invoke(); LogBrushSate(); waiter.Wait(); } if (result.Value.Equals("HideAndShowWindow: Skipped")) { Log.Error("Error: FallbackBrush in use - expecting effect brush"); return; } else if (TestEnvironment.Application.ApplicationFrameWindow == null) { Log.Comment("Skipping test: No ApplicationFrameWindow (likely unsupported platform)"); return; } else { Thread waiterThread = new Thread(HideAndShowWindow_WaiterThreadProc); waiterThread.Name = " HideAndShowWindow_WaiterThread"; waiterThread.Start(); Window window = new Window(TestEnvironment.Application.ApplicationFrameWindow); WindowVisualState initialVisualState = window.WindowVisualState; Verify.AreNotEqual(initialVisualState, WindowVisualState.Minimized); // Minimize the app, which will also trigger it to supsend. Wait for Suspending event from app. Log.Comment("Minimizing the window..."); window.SetWindowVisualState(WindowVisualState.Minimized); HideAndShowWindow_GotWindowHiddenEvent.WaitOne(); // Restore the app. Wait for VisibilityChanged -> Visible event from app. Log.Comment("Restoring the window..."); window.SetWindowVisualState(initialVisualState); HideAndShowWindow_GotWindowVisibleEvent.WaitOne(); // Trigger test to validate that noise has been recreated (see Bug 11144540) using (var waiter = new ValueChangedEventWaiter(result)) { runTestButton.Invoke(); waiter.Wait(); } // Read off validation result and complete the test Verify.AreEqual(result.Value, "HideAndShowWindow: Passed"); Wait.ForIdle(); } } } }
public class PartyTypeManagerTests { private TestSetupHelper helper = null; [OneTimeSetUp] public void OneTimeSetUp() { helper = new TestSetupHelper(WebApiConfig.Register, false); }
public void UpDownEnabledTest() { using (var setup = new TestSetupHelper("NumberBox Tests")) { RangeValueSpinner numBox = FindElement.ByName <RangeValueSpinner>("TestNumberBox"); ComboBox spinModeComboBox = FindElement.ByName <ComboBox>("SpinModeComboBox"); spinModeComboBox.SelectItemByName("Inline"); Wait.ForIdle(); Button upButton = FindButton(numBox, "Increase"); Button downButton = FindButton(numBox, "Decrease"); Check("MinCheckBox"); Check("MaxCheckBox"); Log.Comment("Verify that spin buttons are disabled if value is NaN."); Wait.ForIdle(); Verify.IsFalse(upButton.IsEnabled); Verify.IsFalse(downButton.IsEnabled); Log.Comment("Verify that when Value is at Minimum, the down spin button is disabled."); numBox.SetValue(0); Wait.ForIdle(); Verify.IsTrue(upButton.IsEnabled); Verify.IsFalse(downButton.IsEnabled); Log.Comment("Verify that when Value is at Maximum, the up spin button is disabled."); numBox.SetValue(100); Wait.ForIdle(); Verify.IsFalse(upButton.IsEnabled); Verify.IsTrue(downButton.IsEnabled); Log.Comment("Verify that when wrapping is enabled, spin buttons are enabled."); Check("WrapCheckBox"); Verify.IsTrue(upButton.IsEnabled); Verify.IsTrue(downButton.IsEnabled); Uncheck("WrapCheckBox"); Log.Comment("Verify that when Maximum is updated the up button is updated also."); RangeValueSpinner maxBox = FindElement.ByName <RangeValueSpinner>("MaxNumberBox"); maxBox.SetValue(200); Wait.ForIdle(); Verify.IsTrue(upButton.IsEnabled); Verify.IsTrue(downButton.IsEnabled); ComboBox validationComboBox = FindElement.ByName <ComboBox>("ValidationComboBox"); validationComboBox.SelectItemByName("Disabled"); Wait.ForIdle(); Log.Comment("Verify that when validation is off, spin buttons are enabled"); numBox.SetValue(0); Wait.ForIdle(); Verify.IsTrue(upButton.IsEnabled); Verify.IsTrue(downButton.IsEnabled); Log.Comment("...except in the NaN case"); numBox.SetValue(double.NaN); Wait.ForIdle(); Verify.IsFalse(upButton.IsEnabled); Verify.IsFalse(downButton.IsEnabled); } }
public void BasicExpressionTest() { using (var setup = new TestSetupHelper("NumberBox Tests")) { RangeValueSpinner numBox = FindElement.ByName <RangeValueSpinner>("TestNumberBox"); numBox.SetValue(0); Log.Comment("Verify that expressions don't work if AcceptsExpression is false"); EnterText(numBox, "5 + 3"); Verify.AreEqual(0, numBox.Value); Check("ExpressionCheckBox"); int numErrors = 0; const double resetValue = 1234; Dictionary <string, double> expressions = new Dictionary <string, double> { // Valid expressions. None of these should evaluate to the reset value. { "5", 5 }, { "-358", -358 }, { "12.34", 12.34 }, { "5 + 3", 8 }, { "12345 + 67 + 890", 13302 }, { "000 + 0011", 11 }, { "5 - 3 + 2", 4 }, { "3 + 2 - 5", 0 }, { "9 - 2 * 6 / 4", 6 }, { "9 - -7", 16 }, { "9-3*2", 3 }, // no spaces { " 10 * 6 ", 60 }, // extra spaces { "10 /( 2 + 3 )", 2 }, { "5 * -40", -200 }, { "(1 - 4) / (2 + 1)", -1 }, { "3 * ((4 + 8) / 2)", 18 }, { "23 * ((0 - 48) / 8)", -138 }, { "((74-71)*2)^3", 216 }, { "2 - 2 ^ 3", -6 }, { "2 ^ 2 ^ 2 / 2 + 9", 17 }, { "5 ^ -2", 0.04 }, { "5.09 + 14.333", 19.423 }, { "2.5 * 0.35", 0.875 }, { "-2 - 5", -7 }, // begins with negative number { "(10)", 10 }, // number in parens { "(-9)", -9 }, // negative number in parens { "0^0", 1 }, // who knew? // These should not parse, which means they will reset back to the previous value. { "5x + 3y", resetValue }, // invalid chars { "5 + (3", resetValue }, // mismatched parens { "9 + (2 + 3))", resetValue }, { "(2 + 3)(1 + 5)", resetValue }, // missing operator { "9 + + 7", resetValue }, // extra operators { "9 - * 7", resetValue }, { "9 - - 7", resetValue }, { "+9", resetValue }, { "1 / 0", resetValue }, // divide by zero // These don't currently work, but maybe should. { "-(3 + 5)", resetValue }, // negative sign in front of parens -- should be -8 }; foreach (KeyValuePair <string, double> pair in expressions) { numBox.SetValue(resetValue); Wait.ForIdle(); EnterText(numBox, pair.Key); string output = "Expression '" + pair.Key + "' - expected: " + pair.Value + ", actual: " + numBox.Value; if (Math.Abs(pair.Value - numBox.Value) > 0.00001) { numErrors++; Log.Warning(output); } else { Log.Comment(output); } } Verify.AreEqual(0, numErrors); } }
public void KeyboardTest() { using (var setup = new TestSetupHelper("TabView Tests")) { Log.Comment("Set focus inside the TabView"); UIObject tabContent = FindElement.ByName("FirstTabContent"); tabContent.SetFocus(); TabItem firstTab = FindElement.ByName <TabItem>("FirstTab"); TabItem secondTab = FindElement.ByName <TabItem>("SecondTab"); TabItem lastTab = FindElement.ByName <TabItem>("LastTab"); Button addButton = FindElement.ById <Button>("AddButton"); Verify.IsTrue(firstTab.IsSelected, "First Tab should be selected initially"); Button firstTabButton = FindElement.ByName <Button>("FirstTabButton"); Verify.IsTrue(firstTabButton.HasKeyboardFocus, "Focus should start in the First Tab"); // Ctrl+Tab to the second tab: KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control); Verify.IsTrue(secondTab.IsSelected, "Ctrl+Tab should move selection to Second Tab"); Button secondTabButton = FindElement.ByName <Button>("SecondTabButton"); Verify.IsTrue(secondTabButton.HasKeyboardFocus, "Focus should move to the content of the Second Tab"); // Ctrl+Shift+Tab to the first tab: KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control | ModifierKey.Shift); Verify.IsTrue(firstTab.IsSelected, "Ctrl+Shift+Tab should move selection to First Tab"); Verify.IsTrue(firstTabButton.HasKeyboardFocus, "Focus should move to the content of the First Tab"); // Ctrl+Shift+Tab to the last tab: KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control | ModifierKey.Shift); Verify.IsTrue(lastTab.IsSelected, "Ctrl+Shift+Tab should move selection to Last Tab"); Verify.IsTrue(lastTab.HasKeyboardFocus, "Focus should move to the last tab (since it has no focusable content)"); // Ctrl+Tab to the first tab: KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control); Verify.IsTrue(firstTab.IsSelected, "Ctrl+Tab should move selection to First Tab"); Verify.IsTrue(firstTab.HasKeyboardFocus, "Focus should move to the first tab"); KeyboardHelper.PressKey(Key.Up); Verify.IsTrue(firstTab.HasKeyboardFocus, "Up key should not move focus"); KeyboardHelper.PressKey(Key.Down); Verify.IsTrue(firstTab.HasKeyboardFocus, "Down key should not move focus"); KeyboardHelper.PressKey(Key.Right); Verify.IsTrue(secondTab.HasKeyboardFocus, "Right Key should move focus to the second tab"); KeyboardHelper.PressKey(Key.Left); Verify.IsTrue(firstTab.HasKeyboardFocus, "Left Key should move focus to the first tab"); addButton.SetFocus(); Verify.IsTrue(addButton.HasKeyboardFocus, "AddButton should have keyboard focus"); KeyboardHelper.PressKey(Key.Left); Verify.IsTrue(lastTab.HasKeyboardFocus, "Left Key from AddButton should move focus to last tab"); KeyboardHelper.PressKey(Key.Right); Verify.IsTrue(addButton.HasKeyboardFocus, "Right Key from Last Tab should move focus to Add Button"); firstTab.SetFocus(); // Ctrl+f4 to close the tab: Log.Comment("Verify that pressing ctrl-f4 closes the tab"); KeyboardHelper.PressKey(Key.F4, ModifierKey.Control); Wait.ForIdle(); VerifyElement.NotFound("FirstTab", FindBy.Name); // Move focus to the second tab content secondTabButton.SetFocus(); Wait.ForIdle(); } }
public void SpecifiedPlacement() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); ScrollTargetIntoView(); ScrollBy(10); SetPlacement(PlacementOptions.Top); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("Top")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.Bottom); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("Bottom")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.Left); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("Left")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.Right); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("Right")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.TopEdgeAlignedRight); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("TopEdgeAlignedRight")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.TopEdgeAlignedLeft); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("TopEdgeAlignedLeft")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.BottomEdgeAlignedRight); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("BottomEdgeAlignedRight")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.BottomEdgeAlignedLeft); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("BottomEdgeAlignedLeft")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.LeftEdgeAlignedTop); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("LeftEdgeAlignedTop")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.LeftEdgeAlignedBottom); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("LeftEdgeAlignedBottom")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.RightEdgeAlignedTop); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("RightEdgeAlignedTop")); CloseTeachingTipProgrammatically(); SetPlacement(PlacementOptions.RightEdgeAlignedBottom); OpenTeachingTip(); Verify.IsTrue(GetEffectivePlacement().Equals("RightEdgeAlignedBottom")); CloseTeachingTipProgrammatically(); } }
public void DisabledItemsKeyboardTest() { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone3)) { Log.Warning("This test requires RS3+ keyboarding behavior"); return; } using (var setup = new TestSetupHelper("RadioButtons Tests")) { elements = new RadioButtonsTestPageElements(); SetItemType(RadioButtonsSourceType.RadioButton); SetNumberOfColumns(3); foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation))) { SetSource(location); SetNumberOfItems(10); InsertDisabledRadioButton(10); TapOnItem(7); VerifySelectedFocusedIndex(7); KeyboardHelper.PressKey(Key.Right); VerifySelectedFocusedIndex(9); KeyboardHelper.PressKey(Key.Left); VerifySelectedFocusedIndex(5); KeyboardHelper.PressKey(Key.Down); VerifySelectedFocusedIndex(6); KeyboardHelper.PressKey(Key.Right); VerifySelectedFocusedIndex(9); //There is a known bug here where pressing down or right will put focus //On the first item because RadioButton handles the event. //RadioButtons doesn't catch this because it only catches when the //Last item is focused, but that item is disabled here... //Bug #1654 //KeyboardHelper.PressKey(Key.Down); //VerifySelectedFocusedIndex(9); //KeyboardHelper.PressKey(Key.Right); //VerifySelectedFocusedIndex(9); InsertDisabledRadioButton(6); InsertDisabledRadioButton(6); TapOnItem(1); VerifySelectedFocusedIndex(1); KeyboardHelper.PressKey(Key.Right); VerifySelectedFocusedIndex(10); TapOnItem(2); VerifySelectedFocusedIndex(2); KeyboardHelper.PressKey(Key.Right); VerifySelectedFocusedIndex(11); TapOnItem(5); KeyboardHelper.PressKey(Key.Up); VerifySelectedFocusedIndex(4); KeyboardHelper.PressKey(Key.Down); VerifySelectedFocusedIndex(5); KeyboardHelper.PressKey(Key.Down); VerifySelectedFocusedIndex(8); TapOnItem(8); VerifySelectedFocusedIndex(10); KeyboardHelper.PressKey(Key.Left); VerifySelectedFocusedIndex(1); TapOnItem(9); VerifySelectedFocusedIndex(11); KeyboardHelper.PressKey(Key.Left); VerifySelectedFocusedIndex(2); ElementCache.Clear(); } } }
public void TopNavigationSelectionTest() { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" })) { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2)) { Log.Warning("Skipping: only works in RS2 and above"); return; } Button resetResultButton = new Button(FindElement.ById("ResetResult")); UIObject home = FindElement.ByName("Home"); UIObject apps = FindElement.ById("AppsItem"); UIObject suppressSelection = FindElement.ByName("SuppressSelection"); var invokeResult = new Edit(FindElement.ById("ItemInvokedResult")); var selectResult = new Edit(FindElement.ById("SelectionChangedResult")); var invokeRecommendedTransition = new Edit(FindElement.ById("InvokeRecommendedTransition")); var selectionChangeRecommendedTransition = new Edit(FindElement.ById("SelectionChangeRecommendedTransition")); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { apps.Click(); waiter.Wait(); } // First time selection raise ItemInvoke and SelectionChange events Verify.AreEqual(invokeResult.Value, "Apps"); Verify.AreEqual(selectResult.Value, "Apps"); Verify.AreEqual(invokeRecommendedTransition.Value, "Default"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, "Default"); resetResultButton.Click(); Wait.ForIdle(); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { apps.Click(); waiter.Wait(); } // Click it again, only raise ItemInvoke event Verify.AreEqual(invokeResult.Value, "Apps"); Verify.AreEqual(selectResult.Value, ""); Verify.AreEqual(invokeRecommendedTransition.Value, "Default"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, ""); resetResultButton.Click(); Wait.ForIdle(); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { suppressSelection.Click(); waiter.Wait(); } // Only click for suppress items Verify.AreEqual(invokeResult.Value, "SuppressSelection"); Verify.AreEqual(selectResult.Value, ""); Verify.AreEqual(invokeRecommendedTransition.Value, "Default"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, ""); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { home.Click(); waiter.Wait(); } // Click home again, it raise two events. transition from right to left Verify.AreEqual(invokeResult.Value, "Home"); Verify.AreEqual(selectResult.Value, "Home"); // Only RS5 or above supports SlideNavigationTransitionInfo if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5)) { Verify.AreEqual(invokeRecommendedTransition.Value, "FromLeft"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, "FromLeft"); } resetResultButton.Click(); Wait.ForIdle(); // click apps again. transition from left to right using (var waiter = new ValueChangedEventWaiter(invokeResult)) { apps.Click(); waiter.Wait(); } Verify.AreEqual(invokeResult.Value, "Apps"); Verify.AreEqual(selectResult.Value, "Apps"); // Only RS5 or above supports SlideNavigationTransitionInfo if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5)) { Verify.AreEqual(invokeRecommendedTransition.Value, "FromRight"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, "FromRight"); } } }
public void PaneTabNavigationTest() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2)) { Log.Warning("Skipping: Correct pane tab navigation only works in RS2 and above"); return; } SetNavViewWidth(ControlWidth.Wide); Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton")); UIObject firstItem = FindElement.ByName("Home"); UIObject settingsItem = FindElement.ByName("Settings"); UIObject nextTabTarget = FindElement.ByName("WidthComboBox"); CheckBox autoSuggestCheckBox = new CheckBox(FindElement.ByName("AutoSuggestCheckbox")); autoSuggestCheckBox.Uncheck(); Wait.ForIdle(); Log.Comment("Verify that in Expanded mode, tab navigation can leave the pane"); firstItem.SetFocus(); Wait.ForIdle(); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Wait.RetryUntilEvalFuncSuccessOrTimeout( () => { return(togglePaneButton.HasKeyboardFocus); }, retryTimoutByMilliseconds: 3000 ); Log.Comment("Verify pressing shift-tab from the first menu item goes to the toggle button"); Verify.IsTrue(togglePaneButton.HasKeyboardFocus); settingsItem.SetFocus(); Wait.ForIdle(); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Log.Comment("Verify pressing tab from settings goes to the first tab stop in the content area"); Verify.IsTrue(nextTabTarget.HasKeyboardFocus); SetNavViewWidth(ControlWidth.Medium); CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); isPaneOpenCheckBox.Check(); Wait.ForIdle(); Log.Comment("Verify that in an overlay mode, tab navigation cannot leave the pane while the pane is open"); firstItem.SetFocus(); Wait.ForIdle(); KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift, 1); Wait.ForIdle(); Log.Comment("Verify pressing shift-tab from the first menu item goes to settings"); Verify.IsTrue(settingsItem.HasKeyboardFocus); settingsItem.SetFocus(); Wait.ForIdle(); KeyboardHelper.PressKey(Key.Tab); Wait.ForIdle(); Log.Comment("Verify pressing tab from settings goes to the first menu item"); Verify.IsTrue(firstItem.HasKeyboardFocus); } } }
public void TopPaddingTest() { // We cannot restrict the inner framesize for this test because it interacts with the titlebar area. using (var setup = new TestSetupHelper(testNames: new[] { "NavigationView Tests", "Top NavigationView Store Test" }, shouldRestrictInnerFrameSize: false)) { var moveContentUnderTitleBarButton = new Button(FindElement.ById("MoveContentUnderTopnavTitleBar")); var flipIsTitleBarAutoPaddingEnabledButton = new Button(FindElement.ById("FlipIsTitleBarAutoPaddingEnabledButton")); var getTopPaddingHeightButton = new Button(FindElement.ById("GetTopPaddingHeightButton")); var fullScreenButton = new Button(FindElement.ById("FullScreenInvokerButton")); var navViewIsTitleBarAutoPaddingEnabledId = "NavViewIsTitleBarAutoPaddingEnabled"; var topPaddingRenderedValueId = "TopPaddingRenderedValue"; UIObject navViewIsTitleBarAutoPaddingEnabled = null; UIObject topNavTopPadding = null; // Checking top padding is added for regular Desktop Log.Comment("Setting TitleBar.ExtendViewIntoTitleBar to True"); moveContentUnderTitleBarButton.Click(); Wait.ForIdle(); Log.Comment("Accessing TopPadding Height"); getTopPaddingHeightButton.Click(); Wait.ForIdle(); navViewIsTitleBarAutoPaddingEnabled = TryFindElement.ById(navViewIsTitleBarAutoPaddingEnabledId); Verify.IsNotNull(navViewIsTitleBarAutoPaddingEnabled); Log.Comment($"NavView.IsTitleBarAutoPaddingEnabled: {navViewIsTitleBarAutoPaddingEnabled.GetText()}"); Verify.AreEqual("True", navViewIsTitleBarAutoPaddingEnabled.GetText()); topNavTopPadding = TryFindElement.ById(topPaddingRenderedValueId); Verify.IsNotNull(topNavTopPadding); Log.Comment($"TopPadding Height: {topNavTopPadding.GetText()}"); if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5)) { Verify.AreEqual("32", topNavTopPadding.GetText()); } else { // To detect if it's in tabbed sets, CoreApplicationViewTitleBar.IsVisible can be used to check in MUXControlsTestApp // Not all branches enabled tabbed shell, also not all default setting with tabbed shell enabled // We skip the test if tabbedshell is disabled. if (TryFindElement.ById("TitleBarIsVisible").GetText().Equals("True")) { Log.Comment("Tabbed Shell is disabled or not enabled for this application, skip Verify"); } else { Verify.AreEqual("0", topNavTopPadding.GetText()); } } Log.Comment("Setting IsTitleBarAutoPaddingEnabled to False"); flipIsTitleBarAutoPaddingEnabledButton.Click(); Wait.ForIdle(); Log.Comment($"NavView.IsTitleBarAutoPaddingEnabled: {navViewIsTitleBarAutoPaddingEnabled.GetText()}"); Verify.AreEqual("False", navViewIsTitleBarAutoPaddingEnabled.GetText()); Log.Comment("Accessing TopPadding Height"); getTopPaddingHeightButton.Click(); Wait.ForIdle(); Log.Comment($"TopPadding Height: {topNavTopPadding.GetText()}"); Verify.AreEqual("0", topNavTopPadding.GetText()); Log.Comment("Setting IsTitleBarAutoPaddingEnabled to True"); flipIsTitleBarAutoPaddingEnabledButton.Click(); Wait.ForIdle(); Log.Comment($"NavView.IsTitleBarAutoPaddingEnabled: {navViewIsTitleBarAutoPaddingEnabled.GetText()}"); Verify.AreEqual("True", navViewIsTitleBarAutoPaddingEnabled.GetText()); // Checking top padding is NOT added for fullscreen Desktop Log.Comment("Setting TitleBar.ExtendViewIntoTitleBar to False"); moveContentUnderTitleBarButton.Click(); Wait.ForIdle(); fullScreenButton.Click(); Wait.ForIdle(); Log.Comment("Setting TitleBar.ExtendViewIntoTitleBar to True"); moveContentUnderTitleBarButton.Click(); Wait.ForIdle(); Log.Comment("Accessing TopPadding Height"); getTopPaddingHeightButton.Click(); Wait.ForIdle(); Log.Comment($"TopPadding Height: {topNavTopPadding.GetText()}"); Verify.AreEqual("0", topNavTopPadding.GetText()); // Reverting changes to leave app in original state Log.Comment("Setting TitleBar.ExtendViewIntoTitleBar to False"); moveContentUnderTitleBarButton.Click(); Wait.ForIdle(); fullScreenButton.Click(); Wait.ForIdle(); } }
public void VerifyCorrectVisualStateWhenClosingPaneInLeftDisplayMode() { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" })) { // Test for explicit pane close // make sure the NavigationView is in left mode with pane expanded Log.Comment("Change display mode to left expanded"); var panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox")); panelDisplayModeComboBox.SelectItemByName("Left"); Wait.ForIdle(); TextBlock displayModeTextBox = new TextBlock(FindElement.ByName("DisplayModeTextBox")); Verify.AreEqual(expanded, displayModeTextBox.DocumentText); Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton")); // manually close pane Log.Comment("Close NavView pane explicitly"); togglePaneButton.Invoke(); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); Log.Comment("Get NavView Active VisualStates"); var getNavViewActiveVisualStatesButton = new Button(FindElement.ByName("GetNavViewActiveVisualStates")); getNavViewActiveVisualStatesButton.Invoke(); Wait.ForIdle(); // check visual state var visualStateName = "ListSizeCompact"; var result = new TextBlock(FindElement.ByName("NavViewActiveVisualStatesResult")); Verify.IsTrue(result.GetText().Contains(visualStateName), "active VisualStates doesn't include " + visualStateName); // Test for light dismiss pane close Log.Comment("Change display mode to left compact"); panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox")); panelDisplayModeComboBox.SelectItemByName("LeftCompact"); Wait.ForIdle(); displayModeTextBox = new TextBlock(FindElement.ByName("DisplayModeTextBox")); Verify.AreEqual(compact, displayModeTextBox.DocumentText); // expand pane Log.Comment("Expand NavView pane"); togglePaneButton.Invoke(); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Opened); // light dismiss pane Log.Comment("Light dismiss NavView pane"); getNavViewActiveVisualStatesButton.Click(); // NOTE: Must be Click because this is verifying that the mouse light dismiss behavior closes the nav view Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); Log.Comment("Get NavView Active VisualStates"); getNavViewActiveVisualStatesButton.Invoke(); Wait.ForIdle(); // check visual state result = new TextBlock(FindElement.ByName("NavViewActiveVisualStatesResult")); Verify.IsTrue(result.GetText().Contains(visualStateName), "active VisualStates doesn't include " + visualStateName); } }
public void ScrollWhileUsingExpressionAnimationSources() { Log.Comment("Selecting Scroller tests"); using (var setup = new TestSetupHelper("Scroller Tests")) { SetOutputDebugStringLevel("Verbose"); Log.Comment("Navigating to ScrollerExpressionAnimationSourcesPage"); UIObject navigateToExpressionAnimationSourcesUIObject = FindElement.ByName("navigateToExpressionAnimationSources"); Verify.IsNotNull(navigateToExpressionAnimationSourcesUIObject, "Verifying that navigateToExpressionAnimationSources Button was found"); Button navigateToExpressionAnimationSourcesButton = new Button(navigateToExpressionAnimationSourcesUIObject); navigateToExpressionAnimationSourcesButton.Invoke(); Wait.ForIdle(); SetLoggingLevel(isPrivateLoggingEnabled: true); Log.Comment("Retrieving Scroller"); Scroller scrollerUIObject = new Scroller(FindElement.ByName("scroller")); Verify.IsNotNull(scrollerUIObject, "Verifying that Scroller was found"); Verify.IsTrue(scrollerUIObject.HorizontallyScrollable, "Verifying HorizontallyScrollable is true"); Verify.IsTrue(scrollerUIObject.HorizontalViewSize > 0.0, "Verifying HorizontalViewSize is positive"); Verify.AreEqual(scrollerUIObject.HorizontalScrollPercent, 0.0, "Verifying HorizontalScrollPercent is zero"); Log.Comment("Waiting for final layout"); WaitForEditValue(editName: "txtLayoutCompleted", editValue: "Yes"); Edit textBox = new Edit(FindElement.ById("txtViewport")); Log.Comment("Viewport: " + textBox.Value); textBox = new Edit(FindElement.ById("txtExtent")); Log.Comment("Extent: " + textBox.Value); textBox = new Edit(FindElement.ById("txtBarVisualWidth")); Log.Comment("Scrolling Scroller horizontally and vertically"); scrollerUIObject.SetScrollPercent(10.0, 20.0); Log.Comment("Waiting for HorizontalScrollPercent={0} to change", scrollerUIObject.HorizontalScrollPercent); Wait.ForScrollChanged(scrollerUIObject, ScrollProperty.HorizontalScrollPercent); Log.Comment("Final HorizontalScrollPercent={0}", scrollerUIObject.HorizontalScrollPercent); Log.Comment("Final VerticalScrollPercent={0}", scrollerUIObject.VerticalScrollPercent); if (Math.Abs(scrollerUIObject.HorizontalScrollPercent - 10.0) >= 0.0001 || Math.Abs(scrollerUIObject.VerticalScrollPercent - 20.0) >= 0.0001) { LogAndClearTraces(); } SetLoggingLevel(isPrivateLoggingEnabled: false); Verify.IsTrue(scrollerUIObject.HorizontallyScrollable, "Verifying HorizontallyScrollable is true"); Verify.IsTrue(scrollerUIObject.HorizontalViewSize > 0.0, "Verifying HorizontalViewSize is positive"); Verify.IsLessThan(Math.Abs(scrollerUIObject.HorizontalScrollPercent - 10.0), 0.0001, "Verifying HorizontalScrollPercent is close to 10.0"); Verify.IsTrue(scrollerUIObject.VerticallyScrollable, "Verifying VerticallyScrollable is true"); Verify.IsTrue(scrollerUIObject.VerticalViewSize > 0.0, "Verifying VerticalViewSize is positive"); Verify.IsLessThan(Math.Abs(scrollerUIObject.VerticalScrollPercent - 20.0), 0.0001, "Verifying VerticalScrollPercent is close to 20.0"); Log.Comment("Returning to the main Scroller test page"); TestSetupHelper.GoBack(); // Output-debug-string-level "None" is automatically restored when landing back on the Scroller test page. } }
public void VerifyLightDismissDoesntSendDuplicateEvents() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone3)) { Log.Warning("Test is disabled on RS2 and older due to lack of SplitView events"); return; } CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); SetNavViewWidth(ControlWidth.Medium); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); PaneOpenCloseTestCaseRetry(3, () => { // recover from the exception if needed if (isPaneOpenCheckBox.ToggleState != ToggleState.Off) { using (var waiter = isPaneOpenCheckBox.GetToggledWaiter()) { isPaneOpenCheckBox.Toggle(); waiter.Wait(); } WaitAndAssertPaneStatus(PaneOpenStatus.Closed); } Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False"); Log.Comment("Reset the event count"); new Button(FindElement.ById("ClosingEventCountResetButton")).Invoke(); Wait.ForIdle(); Log.Comment("Open the pane"); using (var waiter = isPaneOpenCheckBox.GetToggledWaiter()) { isPaneOpenCheckBox.Toggle(); waiter.Wait(); } WaitAndAssertPaneStatus(PaneOpenStatus.Opened); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); var closingCounts = new Edit(FindElement.ByName("ClosingEventCountTextBlock")); var expectedString = "1-1"; // trigger a light dismiss KeyboardHelper.PressKey(Key.Left, ModifierKey.Alt); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False"); Verify.AreEqual(expectedString, closingCounts.GetText()); }); } } }
public void ExerciseScrollBar2APIs() { Log.Comment("Selecting ScrollBar2 tests"); using (var setup = new TestSetupHelper("ScrollBar2 Tests")) { Log.Comment("Navigating to ScrollBar2DynamicPage"); UIObject navigateToDynamicUIObject = FindElement.ByName("navigateToDynamic"); Verify.IsNotNull(navigateToDynamicUIObject, "Verifying that navigateToDynamic Button was found"); Button navigateToDynamicButton = new Button(navigateToDynamicUIObject); navigateToDynamicButton.Invoke(); Wait.ForIdle(); Log.Comment("Retrieving cmbIndicatorMode"); ComboBox cmbIndicatorMode = new ComboBox(FindElement.ByName("cmbIndicatorMode")); Verify.IsNotNull(cmbIndicatorMode, "Verifying that cmbIndicatorMode was found"); Log.Comment("Changing IndicatorMode to MouseIndicator"); cmbIndicatorMode.SelectItemByName("MouseIndicator"); Log.Comment("Selection is now {0}", cmbIndicatorMode.Selection[0].Name); Log.Comment("Retrieving btnSetIndicatorMode"); UIObject btnSetIndicatorModeUIObject = FindElement.ByName("btnSetIndicatorMode"); Verify.IsNotNull(btnSetIndicatorModeUIObject, "Verifying that btnSetIndicatorMode Button was found"); Button btnSetIndicatorMode = new Button(btnSetIndicatorModeUIObject); Log.Comment("Tapping btnSetIndicatorMode"); InputHelper.Tap(btnSetIndicatorMode); Log.Comment("Retrieving cmbScrollMode"); ComboBox cmbScrollMode = new ComboBox(FindElement.ByName("cmbScrollMode")); Verify.IsNotNull(cmbScrollMode, "Verifying that cmbScrollMode was found"); Log.Comment("Changing ScrollMode to Enabled"); cmbScrollMode.SelectItemByName("Enabled"); Log.Comment("Selection is now {0}", cmbScrollMode.Selection[0].Name); Log.Comment("Retrieving btnSetScrollMode"); UIObject btnSetScrollModeUIObject = FindElement.ByName("btnSetScrollMode"); Verify.IsNotNull(btnSetScrollModeUIObject, "Verifying that btnSetScrollMode Button was found"); Button btnSetScrollMode = new Button(btnSetScrollModeUIObject); Log.Comment("Tapping btnSetScrollMode"); InputHelper.Tap(btnSetScrollMode); Log.Comment("Retrieving cmbStyle"); ComboBox cmbStyle = new ComboBox(FindElement.ByName("cmbStyle")); Verify.IsNotNull(cmbStyle, "Verifying that cmbStyle was found"); Log.Comment("Changing Style to Hair"); cmbStyle.SelectItemByName("Hair"); Log.Comment("Selection is now {0}", cmbStyle.Selection[0].Name); Log.Comment("Retrieving btnSetStyle"); UIObject btnSetStyleUIObject = FindElement.ByName("btnSetStyle"); Verify.IsNotNull(btnSetStyleUIObject, "Verifying that btnSetStyle Button was found"); Button btnSetStyle = new Button(btnSetStyleUIObject); Log.Comment("Tapping btnSetStyle"); InputHelper.Tap(btnSetStyle); Log.Comment("Retrieving cmbOrientation"); ComboBox cmbOrientation = new ComboBox(FindElement.ByName("cmbOrientation")); Verify.IsNotNull(cmbOrientation, "Verifying that cmbOrientation was found"); Log.Comment("Changing Orientation to Horizontal"); cmbOrientation.SelectItemByName("Horizontal"); Log.Comment("Selection is now {0}", cmbOrientation.Selection[0].Name); Log.Comment("Retrieving btnSetOrientation"); UIObject btnSetOrientationUIObject = FindElement.ByName("btnSetOrientation"); Verify.IsNotNull(btnSetOrientationUIObject, "Verifying that btnSetOrientation Button was found"); Button btnSetOrientation = new Button(btnSetOrientationUIObject); Log.Comment("Tapping btnSetOrientation"); InputHelper.Tap(btnSetOrientation); Log.Comment("Retrieving btnSetValues"); UIObject btnSetValuesUIObject = FindElement.ByName("btnSetValues"); Verify.IsNotNull(btnSetValuesUIObject, "Verifying that btnSetValues Button was found"); Button btnSetValues = new Button(btnSetValuesUIObject); Log.Comment("Tapping btnSetValues"); InputHelper.Tap(btnSetValues); Log.Comment("Retrieving cmbIsEnabled"); ComboBox cmbIsEnabled = new ComboBox(FindElement.ByName("cmbIsEnabled")); Verify.IsNotNull(cmbIsEnabled, "Verifying that cmbIsEnabled was found"); Log.Comment("Changing IsEnabled to False"); cmbIsEnabled.SelectItemByName("False"); Log.Comment("Selection is now {0}", cmbIsEnabled.Selection[0].Name); Log.Comment("Retrieving btnSetIsEnabled"); UIObject btnSetIsEnabledUIObject = FindElement.ByName("btnSetIsEnabled"); Verify.IsNotNull(btnSetIsEnabledUIObject, "Verifying that btnSetIsEnabled Button was found"); Button btnSetIsEnabled = new Button(btnSetIsEnabledUIObject); Log.Comment("Tapping btnSetIsEnabled"); InputHelper.Tap(btnSetIsEnabled); Log.Comment("Changing IndicatorMode to TouchIndicator"); cmbIndicatorMode.SelectItemByName("TouchIndicator"); Log.Comment("Selection is now {0}", cmbIndicatorMode.Selection[0].Name); Log.Comment("Tapping btnSetIndicatorMode"); InputHelper.Tap(btnSetIndicatorMode); Wait.ForIdle(); Log.Comment("Returning to the main ScrollBar2 test page"); TestSetupHelper.GoBack(); } }
protected void VerifyBackAndCloseButtonsVisibility(bool inLeftMinimalPanelDisplayMode) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" })) { var displayModeTextBox = new TextBlock(FindElement.ByName("DisplayModeTextBox")); var panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox")); var isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); Verify.AreEqual(expanded, displayModeTextBox.DocumentText, "Original DisplayMode expected to be Expanded"); if (inLeftMinimalPanelDisplayMode) { Log.Comment("Set PaneDisplayMode to LeftMinimal"); panelDisplayModeComboBox.SelectItemByName("LeftMinimal"); Wait.ForIdle(); Log.Comment("Verify Pane is closed automatically when PaneDisplayMode becomes LeftMinimal"); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False when PaneDisplayMode becomes LeftMinimal"); } else { Log.Comment("Set PaneDisplayMode to Auto"); panelDisplayModeComboBox.SelectItemByName("Auto"); Wait.ForIdle(); Log.Comment("Verify Pane remains open when PaneDisplayMode becomes Auto"); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to remain True when PaneDisplayMode becomes Auto"); Log.Comment("Verify back button is visible when pane is open in Expanded DisplayMode"); VerifyElement.Found("NavigationViewBackButton", FindBy.Id); Log.Comment("Verify close button is not visible when pane is open in Expanded DisplayMode"); VerifyElement.NotFound("NavigationViewCloseButton", FindBy.Id); Log.Comment("Decrease the width of the control from Wide to Narrow and force pane closure"); SetNavViewWidth(ControlWidth.Narrow); Wait.ForIdle(); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False after decreasing width"); Verify.AreEqual(minimal, displayModeTextBox.DocumentText); } Log.Comment("Verify toggle-pane button is visible when pane is closed"); VerifyElement.Found("TogglePaneButton", FindBy.Id); Log.Comment("Verify back button is visible when pane is closed"); VerifyElement.Found("NavigationViewBackButton", FindBy.Id); Log.Comment("Verify close button is not visible when pane is closed"); VerifyElement.NotFound("NavigationViewCloseButton", FindBy.Id); Log.Comment("Open the pane"); isPaneOpenCheckBox.Check(); Wait.ForIdle(); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); Log.Comment("Verify toggle-pane button is visible when pane is open"); VerifyElement.Found("TogglePaneButton", FindBy.Id); Log.Comment("Verify back button is not visible when pane is open"); VerifyElement.NotFound("NavigationViewBackButton", FindBy.Id); Log.Comment("Verify close button is visible when pane is open"); VerifyElement.Found("NavigationViewCloseButton", FindBy.Id); Button closeButton = new Button(FindElement.ById("NavigationViewCloseButton")); Verify.IsNotNull(closeButton); Verify.IsTrue(closeButton.IsEnabled, "Close button is expected to be enabled"); CheckBox backButtonVisibilityCheckbox = new CheckBox(FindElement.ByName("BackButtonVisibilityCheckbox")); backButtonVisibilityCheckbox.Uncheck(); Wait.ForIdle(); Log.Comment("Verify back button is not visible when pane is open"); VerifyElement.NotFound("NavigationViewBackButton", FindBy.Id); Log.Comment("Verify close button is no longer visible when pane is open"); VerifyElement.NotFound("NavigationViewCloseButton", FindBy.Id); } }
public void FocusComingFromAnotherRepeaterTest() { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone4)) { Log.Warning("This test requires TrySetNewFocusedElement from RS4"); return; } using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtonsFocus Test" })) { var elements = new RadioButtonsFocusTestPageElements(); // Select items SelectByIndex(1, false); SelectByIndex(2, true); // Verify selection VerifySelectedIndex(1, false); VerifySelectedIndex(2, true); VerifyRadioButtonsHasFocus(true, false); // Move focus to second RadioButtons control by pressing TAB KeyboardHelper.PressKey(Key.Tab); // Verify that // - the first RadioButtons control no longer has focus and // - the third radio button of the second RadioButtons control now has focus VerifyRadioButtonsHasFocus(false, false); VerifySelectedFocusedIndex(2, true); // Move focus to the first RadioButtons control by pressing TAB again KeyboardHelper.PressKey(Key.Tab); // Verify that the second radio button is still selected and now has focus VerifySelectedFocusedIndex(1, false); void SelectByIndex(int index, bool checkRadioButtons2) { if (checkRadioButtons2) { elements.GetIndexToSelectTextBox2().SetValue(index.ToString()); elements.GetSelectByIndexButton2().Click(); } else { elements.GetIndexToSelectTextBox1().SetValue(index.ToString()); elements.GetSelectByIndexButton1().Click(); } } void VerifySelectedIndex(int index, bool checkRadioButtons2) { if (checkRadioButtons2) { Verify.AreEqual(index, Int32.Parse(elements.GetSelectedIndexTextBlock2().DocumentText), $"RadioButton with index {index} should have been selected."); } else { Verify.AreEqual(index, Int32.Parse(elements.GetSelectedIndexTextBlock1().DocumentText), $"RadioButton with index {index} should have been selected."); } } void VerifyRadioButtonsHasFocus(bool hasFocus, bool checkRadioButtons2) { if (checkRadioButtons2) { Verify.AreEqual(hasFocus, elements.GetRadioButtons2HasFocusCheckBox().ToggleState == ToggleState.On); } else { Verify.AreEqual(hasFocus, elements.GetRadioButtons1HasFocusCheckBox().ToggleState == ToggleState.On); } } void VerifyFocusedIndex(int index, bool checkRadioButtons2) { if (checkRadioButtons2) { Verify.AreEqual(index, Int32.Parse(elements.GetFocusedIndexTextBlock2().DocumentText), $"RadioButton with index {index} should have focus."); } else { Verify.AreEqual(index, Int32.Parse(elements.GetFocusedIndexTextBlock1().DocumentText), $"RadioButton with index {index} should have focus."); } } void VerifySelectedFocusedIndex(int index, bool checkRadioButtons2) { VerifySelectedIndex(index, checkRadioButtons2); VerifyFocusedIndex(index, checkRadioButtons2); } } }
public void Initialize() { TestSetupHelper.CopyProj4(); }
public void TabSizeAndScrollButtonsTest() { using (var setup = new TestSetupHelper("TabView Tests")) { UIObject smallerTab = FindElement.ByName("SecondTab"); UIObject largerTab = FindElement.ByName("LongHeaderTab"); FindElement.ByName <Button>("SetTabViewWidth").InvokeAndWait(); Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should not be visible"); Log.Comment("Equal size tabs should all be the same size."); int diff = Math.Abs(largerTab.BoundingRectangle.Width - smallerTab.BoundingRectangle.Width); Verify.IsLessThanOrEqual(diff, 1); Log.Comment("Changing tab width mode to SizeToContent."); ComboBox tabWidthComboBox = FindElement.ByName <ComboBox>("TabWidthComboBox"); tabWidthComboBox.SelectItemByName("SizeToContent"); Wait.ForIdle(); Log.Comment("Tab with larger content should be wider."); Verify.IsGreaterThan(largerTab.BoundingRectangle.Width, smallerTab.BoundingRectangle.Width); // With largerTab now rendering wider, the scroll buttons should appear: Verify.IsTrue(AreScrollButtonsVisible(), "Scroll buttons should appear"); // Scroll all the way to the left and verify decrease/increase button visual state FindElement.ByName <Button>("ScrollTabViewToTheLeft").InvokeAndWait(); Wait.ForIdle(); Verify.IsFalse(IsScrollDecreaseButtonEnabled(), "Scroll decrease button should be disabled"); Verify.IsTrue(IsScrollIncreaseButtonEnabled(), "Scroll increase button should be enabled"); // Scroll to the middle position and verify decrease/increase button visual state FindElement.ByName <Button>("ScrollTabViewToTheMiddle").InvokeAndWait(); Wait.ForIdle(); Verify.IsTrue(IsScrollDecreaseButtonEnabled(), "Scroll decrease button should be enabled"); Verify.IsTrue(IsScrollIncreaseButtonEnabled(), "Scroll increase button should be enabled"); // Scroll all the way to the right and verify decrease/increase button visual state FindElement.ByName <Button>("ScrollTabViewToTheRight").InvokeAndWait(); Wait.ForIdle(); Verify.IsTrue(IsScrollDecreaseButtonEnabled(), "Scroll decrease button should be enabled"); Verify.IsFalse(IsScrollIncreaseButtonEnabled(), "Scroll increase button should be disabled"); // Close a tab to make room. The scroll buttons should disappear: Log.Comment("Closing a tab:"); Button closeButton = FindCloseButton(FindElement.ByName("LongHeaderTab")); closeButton.MovePointer(0, 0); closeButton.InvokeAndWait(); VerifyElement.NotFound("LongHeaderTab", FindBy.Name); Log.Comment("Scroll buttons should disappear"); // Leaving tabstrip with this so the tabs update their width FindElement.ByName <Button>("IsClosableCheckBox").MovePointer(0, 0); Wait.ForIdle(); Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should disappear"); // Make sure the scroll buttons can show up in 'Equal' sizing mode. Log.Comment("Changing tab width mode to Equal"); tabWidthComboBox.SelectItemByName("Equal"); Wait.ForIdle(); Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should not be visible"); var addButton = FindElement.ByName <Button>("Add New Tab"); Verify.IsNotNull(addButton, "addButton should be available"); Log.Comment("Adding a tab"); addButton.InvokeAndWait(); Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should not be visible"); Log.Comment("Adding another tab"); addButton.InvokeAndWait(); Verify.IsTrue(AreScrollButtonsVisible(), "Scroll buttons should appear"); } }
public void CloseReasonIsAccurate() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); ScrollTargetIntoView(); OpenTeachingTip(); CloseTeachingTipProgrammatically(); var message0 = GetTeachingTipDebugMessage(0); var message1 = GetTeachingTipDebugMessage(1); Verify.IsTrue(message0.ToString().Contains("Closing")); Verify.IsTrue(message0.ToString().Contains("Programmatic")); Verify.IsTrue(message1.ToString().Contains("Closed")); Verify.IsTrue(message1.ToString().Contains("Programmatic")); SetHeroContent(HeroContentOptions.NoContent); OpenTeachingTip(); PressXCloseButton(); var message2 = GetTeachingTipDebugMessage(2); var message3 = GetTeachingTipDebugMessage(3); var message4 = GetTeachingTipDebugMessage(4); Verify.IsTrue(message2.ToString().Contains("Close Button Clicked")); Verify.IsTrue(message3.ToString().Contains("Closing")); Verify.IsTrue(message3.ToString().Contains("CloseButton")); Verify.IsTrue(message4.ToString().Contains("Closed")); Verify.IsTrue(message4.ToString().Contains("CloseButton")); EnableLightDismiss(true); OpenTeachingTip(); CloseTeachingTipProgrammatically(); var message5 = GetTeachingTipDebugMessage(5); var message6 = GetTeachingTipDebugMessage(6); Verify.IsTrue(message5.ToString().Contains("Closing")); Verify.IsTrue(message5.ToString().Contains("Programmatic")); Verify.IsTrue(message6.ToString().Contains("Closed")); Verify.IsTrue(message6.ToString().Contains("Programmatic")); OpenTeachingTip(); CloseTeachingTipByLightDismiss(); var message7 = GetTeachingTipDebugMessage(7); var message8 = GetTeachingTipDebugMessage(8); Verify.IsTrue(message7.ToString().Contains("Closing")); Verify.IsTrue(message7.ToString().Contains("LightDismiss")); Verify.IsTrue(message8.ToString().Contains("Closed")); Verify.IsTrue(message8.ToString().Contains("LightDismiss")); SetCloseButtonContent(CloseButtonContentOptions.ShortText); OpenTeachingTip(); PressTipCloseButton(); var message9 = GetTeachingTipDebugMessage(9); var message10 = GetTeachingTipDebugMessage(10); var message11 = GetTeachingTipDebugMessage(11); Verify.IsTrue(message9.ToString().Contains("Close Button Clicked")); Verify.IsTrue(message10.ToString().Contains("Closing")); Verify.IsTrue(message10.ToString().Contains("CloseButton")); Verify.IsTrue(message11.ToString().Contains("Closed")); Verify.IsTrue(message11.ToString().Contains("CloseButton")); ClearTeachingTipDebugMessages(); } } }
public void BasicInteractionTest() { using (var setup = new TestSetupHelper("RatingControl Tests")) // This literally clicks the button corresponding to the test page. { Log.Comment("Retrieve rating control as generic UIElement"); UIObject ratingUIObject = FindElement.ByName("TestRatingControl"); Verify.IsNotNull(ratingUIObject, "Verifying that we found a UIElement called TestRatingControl"); Log.Comment("Retrieve the text block as a TextBlock"); TextBlock textBlock = new TextBlock(FindElement.ByName("TestTextBlockControl")); Log.Comment("Verify a tap on the third star sets Rating to 3"); InputHelper.Tap(ratingUIObject, 60, RATING_ITEM_HEIGHT / 2); Verify.AreEqual("3", textBlock.DocumentText); Log.Comment("Verify a tap on the third star sets Rating to 2.5 (placeholder value)"); InputHelper.Tap(ratingUIObject, 60, RATING_ITEM_HEIGHT / 2); Verify.AreEqual("!2.5", textBlock.DocumentText); Button phButton = new Button(FindElement.ByName("PHButton")); InputHelper.Tap(phButton); Log.Comment("Verify a tap on the first star sets Rating to 1"); InputHelper.Tap(ratingUIObject, 12, RATING_ITEM_HEIGHT / 2); Verify.AreEqual("1", textBlock.DocumentText); Log.Comment("Verify a swipe off the left sets Rating to NOTHING"); InputHelper.Pan(ratingUIObject, 200, Direction.West); Verify.AreEqual("!", textBlock.DocumentText); Log.Comment("Verify a right key on an unset Rating, sets rating to 1"); KeyboardHelper.PressKey(ratingUIObject, Key.Right); Verify.AreEqual("1", textBlock.DocumentText); Log.Comment("Verify a left key on an RTL rating increases the rating."); Button rtlbutton = new Button(FindElement.ByName("RTLButton")); rtlbutton.Invoke(); Wait.ForIdle(); KeyboardHelper.PressKey(ratingUIObject, Key.Left); Verify.AreEqual("2", textBlock.DocumentText); Log.Comment("Verify home/end keys in RTL"); KeyboardHelper.PressKey(ratingUIObject, Key.Home); Verify.AreEqual("!", textBlock.DocumentText); KeyboardHelper.PressKey(ratingUIObject, Key.End); Verify.AreEqual("5", textBlock.DocumentText); Log.Comment("Verify up down keys in RTL"); KeyboardHelper.PressKey(ratingUIObject, Key.Down); Verify.AreEqual("4", textBlock.DocumentText); KeyboardHelper.PressKey(ratingUIObject, Key.Up); Verify.AreEqual("5", textBlock.DocumentText); rtlbutton.Invoke(); Wait.ForIdle(); Log.Comment("Verify home/end keys in LTR"); KeyboardHelper.PressKey(ratingUIObject, Key.Home); Verify.AreEqual("!", textBlock.DocumentText); KeyboardHelper.PressKey(ratingUIObject, Key.End); Verify.AreEqual("5", textBlock.DocumentText); Log.Comment("Verify up down keys in LTR"); KeyboardHelper.PressKey(ratingUIObject, Key.Down); Verify.AreEqual("4", textBlock.DocumentText); KeyboardHelper.PressKey(ratingUIObject, Key.Up); Verify.AreEqual("5", textBlock.DocumentText); } }