public void CanSwitchShouldConstrainToRootBounds() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); ScrollTargetIntoView(); ScrollBy(10); OpenTeachingTip(); CloseTeachingTipProgrammatically(); SetShouldConstrainToRootBounds(false); OpenTeachingTip(); CloseTeachingTipProgrammatically(); SetShouldConstrainToRootBounds(true); OpenTeachingTip(); CloseTeachingTipProgrammatically(); OpenTeachingTip(); SetShouldConstrainToRootBounds(false); CloseTeachingTipProgrammatically(); OpenTeachingTip(); SetShouldConstrainToRootBounds(true); CloseTeachingTipProgrammatically(); OpenTeachingTip(); CloseTeachingTipProgrammatically(); } } }
public void TipsWhichDoNotFitDoNotOpen() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); ScrollTargetIntoView(); ScrollBy(10); UseTestWindowBounds(10, 10, 10, 10); elements.GetShowButton().Invoke(); var message1 = GetTeachingTipDebugMessage(1); Verify.IsTrue(message1.ToString().Contains("Closed")); Verify.IsTrue(message1.ToString().Contains("Programmatic")); UseTestScreenBounds(10, 10, 10, 10); SetShouldConstrainToRootBounds(false); elements.GetShowButton().Invoke(); VerifyPlacement("Top"); ClearTeachingTipDebugMessages(); } } }
public void CloseReasonIsAccurate() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); ScrollTargetIntoView(); OpenTeachingTip(); CloseTeachingTipProgrammatically(); var message0 = GetTeachingTipDebugMessage(0); Verify.IsTrue(message0.ToString().Contains("Programmatic")); SetBleedingContent(BleedingContentOptions.NoContent); OpenTeachingTip(); PressXCloseButton(); var message2 = GetTeachingTipDebugMessage(2); var message4 = GetTeachingTipDebugMessage(4); Verify.IsTrue(message2.ToString().Contains("Close Button Clicked")); Verify.IsTrue(message4.ToString().Contains("CloseButton")); EnableLightDismiss(true); OpenTeachingTip(); CloseTeachingTipProgrammatically(); var message6 = GetTeachingTipDebugMessage(6); Verify.IsTrue(message6.ToString().Contains("Programmatic")); OpenTeachingTip(); message2.Tap(); var message7 = GetTeachingTipDebugMessage(7); Verify.IsTrue(message7.ToString().Contains("LightDismiss")); } }
public void VerifyTheming() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); SetActionButtonContentTo("Small text"); ScrollTargetIntoView(); OpenTeachingTip(); var themingComboBox = elements.GetThemingComboBox(); themingComboBox.SelectItemByName("Default"); Verify.AreEqual("#FF000000", elements.GetEffectiveForegroundOfTeachingTipButtonTextBlock().GetText(), "Default button foreground should be black"); Verify.AreEqual("#FF000000", elements.GetEffectiveForegroundOfTeachingTipContentTextBlock().GetText(), "Default content foreground should be black"); // Change to Dark, make sure the font switches to light themingComboBox.SelectItemByName("Dark"); Verify.AreEqual("#FFFFFFFF", elements.GetEffectiveForegroundOfTeachingTipButtonTextBlock().GetText(), "Default button foreground should be white"); Verify.AreEqual("#FFFFFFFF", elements.GetEffectiveForegroundOfTeachingTipContentTextBlock().GetText(), "Default content foreground should be white"); // Change to Light, make sure the font switches to dark themingComboBox.SelectItemByName("Light"); Verify.AreEqual("#FF000000", elements.GetEffectiveForegroundOfTeachingTipButtonTextBlock().GetText(), "Default button foreground should be black"); Verify.AreEqual("#FF000000", elements.GetEffectiveForegroundOfTeachingTipContentTextBlock().GetText(), "Default content foreground should be black"); } } }
public void TipCanFollowTarget() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); ScrollTargetIntoView(); Wait.ForIdle(); OpenTeachingTip(); double initialTipVerticalOffset = GetTipVerticalOffset(); double initialScrollViewerVerticalOffset = GetScrollViewerVerticalOffset(); ScrollBy(10); WaitForOffsetUpdated(initialScrollViewerVerticalOffset + 10); Equals(GetTipVerticalOffset(), initialTipVerticalOffset); ScrollBy(-20); WaitForOffsetUpdated(initialScrollViewerVerticalOffset - 10); Wait.ForIdle(); Equals(GetTipVerticalOffset(), initialTipVerticalOffset); ScrollBy(10); WaitForOffsetUpdated(initialScrollViewerVerticalOffset); Equals(GetTipVerticalOffset(), initialTipVerticalOffset); SetTipFollowsTarget(true); ScrollBy(10); WaitForOffsetUpdated(initialScrollViewerVerticalOffset + 10); Verify.IsLessThan(GetTipVerticalOffset(), initialTipVerticalOffset); ScrollBy(-20); WaitForOffsetUpdated(initialScrollViewerVerticalOffset - 10); Wait.ForIdle(); Verify.IsGreaterThan(GetTipVerticalOffset(), initialTipVerticalOffset); ScrollBy(10); WaitForOffsetUpdated(initialScrollViewerVerticalOffset); Equals(GetTipVerticalOffset(), initialTipVerticalOffset); SetTipFollowsTarget(false); ScrollBy(10); WaitForOffsetUpdated(initialScrollViewerVerticalOffset + 10); Equals(GetTipVerticalOffset(), initialTipVerticalOffset); ScrollBy(-20); WaitForOffsetUpdated(initialScrollViewerVerticalOffset - 10); Wait.ForIdle(); Equals(GetTipVerticalOffset(), initialTipVerticalOffset); ScrollBy(10); WaitForOffsetUpdated(initialScrollViewerVerticalOffset); Equals(GetTipVerticalOffset(), initialTipVerticalOffset); } } }
//[TestMethod] TODO: Re-enable after fixing issue #643 public void F6PutsFocusOnCloseButton() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); ScrollTargetIntoView(); ScrollBy(10); OpenTeachingTip(); CloseOpenAndCloseWithJustKeyboardViaF6(); SetCloseButtonContent(CloseButtonContentOptions.ShortText); OpenTeachingTip(); CloseOpenAndCloseWithJustKeyboardViaF6(); OpenTeachingTip(); UseF6ToReturnToTestPageToCloseTip(); SetCloseButtonContent(CloseButtonContentOptions.NoText); } }
public void F6PutsFocusOnCloseButton() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); ScrollTargetIntoView(); ScrollBy(10); OpenTeachingTip(); CloseOpenAndCloseWithJustKeyboardViaF6(); SetCloseButtonContent(CloseButtonContentOptions.ShortText); OpenTeachingTip(); CloseOpenAndCloseWithJustKeyboardViaF6(); } } }
public void AutomationNameIsForwardedToPopup() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); ScrollTargetIntoView(); ScrollBy(10); OpenTeachingTip(); Verify.IsNotNull(FindElement.ByNameAndClassName(location == TipLocationOptions.VisualTree ? "TeachingTipInVisualTree" : "TeachingTipInResources", "Popup")); SetAutomationName(AutomationNameOptions.None); Verify.IsNotNull(FindElement.ByNameAndClassName("We've Added Auto Saving!", "Popup")); SetAutomationName(location == TipLocationOptions.VisualTree ? AutomationNameOptions.VisualTree : AutomationNameOptions.Resources); CloseTeachingTipProgrammatically(); } } }
//[TestMethod] TODO: Re-enable after fixing issue #643 public void VerifyTheming() { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone3)) { Log.Warning("TeachingTip theming doesn't work page-level before RS3, skipping test."); return; } using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); SetActionButtonContentTo("Small text"); ScrollTargetIntoView(); OpenTeachingTip(); var themingComboBox = elements.GetThemingComboBox(); themingComboBox.SelectItemByName("Default"); Verify.AreEqual("#FF000000", elements.GetEffectiveForegroundOfTeachingTipButtonTextBlock().GetText(), "Default button foreground should be black"); Verify.AreEqual("#FF000000", elements.GetEffectiveForegroundOfTeachingTipContentTextBlock().GetText(), "Default content foreground should be black"); // Change to Dark, make sure the font switches to light themingComboBox.SelectItemByName("Dark"); Verify.AreEqual("#FFFFFFFF", elements.GetEffectiveForegroundOfTeachingTipButtonTextBlock().GetText(), "Default button foreground should be white"); Verify.AreEqual("#FFFFFFFF", elements.GetEffectiveForegroundOfTeachingTipContentTextBlock().GetText(), "Default content foreground should be white"); // Change to Light, make sure the font switches to dark themingComboBox.SelectItemByName("Light"); Verify.AreEqual("#FF000000", elements.GetEffectiveForegroundOfTeachingTipButtonTextBlock().GetText(), "Default button foreground should be black"); Verify.AreEqual("#FF000000", elements.GetEffectiveForegroundOfTeachingTipContentTextBlock().GetText(), "Default content foreground should be black"); } } }
public void NoIconDoesNotCrash() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); ScrollTargetIntoView(); ScrollBy(10); SetIcon(IconOptions.NoIcon); OpenTeachingTip(); CloseTeachingTipProgrammatically(); SetIcon(IconOptions.People); OpenTeachingTip(); SetIcon(IconOptions.NoIcon); } } }
public void AutoPlacement() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); ScrollTargetIntoView(); ScrollBy(10); var targetRect = GetTargetBounds(); TestAutoPlacementForWindowOrScreenBounds(targetRect, true); SetShouldConstrainToRootBounds(false); TestAutoPlacementForWindowOrScreenBounds(targetRect, false, "Top"); SetReturnTopForOutOfWindowPlacement(false); TestAutoPlacementForWindowOrScreenBounds(targetRect, false); SetReturnTopForOutOfWindowPlacement(true); } } }
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 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 SpecifiedPlacement() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); 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 AutoPlacement() { using (var setup = new TestSetupHelper("TeachingTip Tests")) { elements = new TeachingTipTestPageElements(); foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions))) { SetTeachingTipLocation(location); 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(); } } }