public UIEventWaiter GetExpandedWaiter() { var changedEventWaiter = new PropertyChangedEventWaiter(root: UIObject, scope: Scope.Subtree, UIProperty.Get(name: "ExpandCollapse.ExpandCollapseState")); changedEventWaiter.AddFilter(callback: ExpandFilter); return(changedEventWaiter); }
public void ToggleTest() { using (var setup = new TestSetupHelper("SplitButton Tests")) { SplitButton splitButton = FindElement.ByName <SplitButton>("ToggleSplitButton"); TextBlock toggleStateTextBlock = FindElement.ByName <TextBlock>("ToggleStateTextBlock"); TextBlock toggleStateOnClickTextBlock = FindElement.ByName <TextBlock>("ToggleStateOnClickTextBlock"); Verify.AreEqual("Unchecked", toggleStateTextBlock.DocumentText); Verify.AreEqual("Unchecked", toggleStateOnClickTextBlock.DocumentText); Log.Comment("Click primary button to check button"); using (var toggleStateWaiter = new PropertyChangedEventWaiter(splitButton, Scope.Element, UIProperty.Get("Toggle.ToggleState"))) { ClickPrimaryButton(splitButton); Verify.IsTrue(toggleStateWaiter.TryWait(TimeSpan.FromSeconds(1)), "Waiting for the Toggle.ToggleState event should succeed"); } Verify.AreEqual("Checked", toggleStateTextBlock.DocumentText); Verify.AreEqual("Checked", toggleStateOnClickTextBlock.DocumentText); Log.Comment("Click primary button to uncheck button"); ClickPrimaryButton(splitButton); Verify.AreEqual("Unchecked", toggleStateTextBlock.DocumentText); Verify.AreEqual("Unchecked", toggleStateOnClickTextBlock.DocumentText); Log.Comment("Clicking secondary button should not change toggle state"); ClickSecondaryButton(splitButton); Verify.AreEqual("Unchecked", toggleStateTextBlock.DocumentText); Verify.AreEqual("Unchecked", toggleStateOnClickTextBlock.DocumentText); } }
public void AccessibilityTest() { using (var setup = new TestSetupHelper("AnimatedVisualPlayer Tests")) { var progressTextBox = FindElement.ByName <Edit>("ProgressTextBox"); var isPlayingTextBoxBeforePlaying = FindElement.ByName <Edit>("IsPlayingTextBoxBeforePlaying"); var isPlayingTextBoxBeingPlaying = FindElement.ByName <Edit>("IsPlayingTextBoxBeingPlaying"); var playButton = FindElement.ByName <Button>("PlayButton"); if (playButton != null && progressTextBox != null && isPlayingTextBoxBeforePlaying != null && isPlayingTextBoxBeingPlaying != null) { using (var progressTextBoxWaiter = new PropertyChangedEventWaiter(progressTextBox, UIProperty.Get("Value.Value"))) { playButton.Click(); Log.Comment("Waiting until AnimatedVisualPlayer playing ends."); progressTextBoxWaiter.Wait(); Log.Comment("EventWaiter of progressTextBox is raised."); Log.Comment("Value of isPlayingTextBoxBeforePlaying: \"{0}\".", isPlayingTextBoxBeforePlaying.Value); Verify.AreEqual(Constants.FalseText, isPlayingTextBoxBeforePlaying.Value); // // isPlayingTextBoxBeingPlaying value is supposed to be updated // inside the event handler function of Click for playButton in // the UI test. // Log.Comment("Value of isPlayingTextBoxBeingPlaying: \"{0}\".", isPlayingTextBoxBeingPlaying.Value); Verify.AreEqual(Constants.TrueText, isPlayingTextBoxBeingPlaying.Value); Log.Comment("Value of progressTextBox: \"{0}\".", progressTextBox.Value); Verify.AreEqual(Constants.PlayingEndedText, progressTextBox.Value); } } else { Verify.Fail("PlayButton or any other UIElement is not found."); } ToZeroKeyframeAnimationAccessibilityTest(); FromOneKeyframeAnimationAccessibilityTest(); ReverseNegativePlaybackRateAnimationAccessibilityTest(); ReversePositivePlaybackRateAnimationAccessibilityTest(); HittestingAccessibilityTest(); FallenBackTest(); } }
bool SetToggleState(ToggleState toggleState) { for (var index = 0; index < 3; ++index) { if (this._togglePattern.ToggleState == toggleState) { return(true); } if (index < 2) { using (var changedEventWaiter = new PropertyChangedEventWaiter(root: this, scope: Scope.Element, UIProperty.Get(name: "Toggle.ToggleState"))) { Toggle(); changedEventWaiter.TryWait(timeout: 500); } } } return(false); }
private void HittestingAccessibilityTest() { if (!IsRS5OrHigher()) { return; } var textBox = FindElement.ByName <Edit>("HittestingTextBox"); using (var textBoxWaiter = new PropertyChangedEventWaiter(textBox, UIProperty.Get("Value.Value"))) { TestEnvironment.Application.CoreWindow.Click(); Log.Comment("HittestingAccessibilityTest: Waiting until OnPointerMoved handler in UI test returns."); textBoxWaiter.Wait(); Log.Comment("HittestingAccessibilityTest: EventWaiter of HittestingAccessibilityTest is raised."); Log.Comment("HittestingAccessibilityTest: Value of textBox: \"{0}\".", textBox.Value); Verify.AreEqual(Constants.PointerMovedText, textBox.Value); } }
private void FallenBackTest() { var textBox = FindElement.ByName <Edit>("FallenBackTextBox"); var testButton = FindElement.ByName <Button>("FallenBackButton"); if (testButton != null && textBox != null) { using (var textBoxWaiter = new PropertyChangedEventWaiter(textBox, UIProperty.Get("Value.Value"))) { testButton.Click(); Log.Comment("FallenBackTest: textBoxWaiter: Waiting until fallenback screencapture and results checking."); textBoxWaiter.Wait(); Log.Comment("EventWaiter of FallenBackTextBox is raised."); Log.Comment("FallenBackTest: Value of textBox: \"{0}\".", textBox.Value); Verify.AreEqual(Constants.TrueText, textBox.Value); } } else { Verify.Fail("FallenBackTest: FallenBackButton or any other UIElement is not found."); } }
// Reverse forward playing using positive playback rate by setting playback rate to negative. private void ReversePositivePlaybackRateAnimationAccessibilityTest() { var textBox = FindElement.ByName <Edit>("ReversePositivePlaybackRateAnimationTextBox"); var playButton = FindElement.ByName <Button>("ReversePositivePlaybackRateAnimationPlayButton"); if (playButton != null && textBox != null) { using (var textBoxWaiter = new PropertyChangedEventWaiter(textBox, UIProperty.Get("Value.Value"))) { playButton.Click(); Log.Comment("ReversePositivePlaybackRateAnimationAccessibilityTest: textBoxWaiter: Waiting until AnimatedVisualPlayer playing ends."); textBoxWaiter.Wait(); Log.Comment("EventWaiter of reversePositivePlaybackRateAnimationProgressTextBox is raised."); Log.Comment("ReversePositivePlaybackRateAnimationAccessibilityTest: Value of textBox: \"{0}\".", textBox.Value); Verify.AreEqual(Constants.ZeroText, textBox.Value); } } else { Verify.Fail("ReversePositivePlaybackRateAnimationAccessibilityTest: playButton or any other UIElement is not found."); } }