How to use UntilInputIsProcessed method of FlaUI.Core.Input.Wait class

Best FlaUI code snippet using FlaUI.Core.Input.Wait.UntilInputIsProcessed

CalculatorViewShould.cs

Source:CalculatorViewShould.cs Github

copy

Full Screen

...44 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.Digit7Btn)).AsButton()).Click();45 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.Digit8Btn)).AsButton()).Click();46 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.Digit9Btn)).AsButton()).Click();47 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.Digit0Btn)).AsButton()).Click();48 Wait.UntilInputIsProcessed();49 // Assert50 resultLbl.Text.Should().Be("1,234,567,890.");51 }52 [Fact]53 public void ActivateDecimalSeparator_WhenDecimalButtonIsPressed()54 {55 // Arrange56 var mainScreen = this.Application.GetMainWindow(this.Automation);57 // Act58 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());59 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.Digit1Btn)).AsButton()).Click();60 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.DecimalBtn)).AsButton()).Click();61 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.Digit3Btn)).AsButton()).Click();62 Wait.UntilInputIsProcessed();63 // Assert64 resultLbl.Text.Should().Be("1.3");65 }66 [Fact]67 public void ProcessOperators_WhenOperatorButtonsArePressed()68 {69 // Arrange70 var mainScreen = this.Application.GetMainWindow(this.Automation);71 // Act72 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());73 Keyboard.Type("1");74 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.OperatorAddBtn)).AsButton()).Click();75 Keyboard.Type("9");76 Keyboard.Type(VirtualKeyShort.ENTER);77 Wait.UntilInputIsProcessed();78 var addResult = resultLbl.Text;79 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.OperatorSubtractBtn)).AsButton()).Click();80 Keyboard.Type("4");81 Keyboard.Type(VirtualKeyShort.ENTER);82 Wait.UntilInputIsProcessed();83 var subtractResult = resultLbl.Text;84 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.OperatorMultiplyBtn)).AsButton()).Click();85 Keyboard.Type("10");86 Keyboard.Type(VirtualKeyShort.ENTER);87 Wait.UntilInputIsProcessed();88 var multiplicationResult = resultLbl.Text;89 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.OperatorDivideBtn)).AsButton()).Click();90 Keyboard.Type("6");91 Keyboard.Type(VirtualKeyShort.ENTER);92 Wait.UntilInputIsProcessed();93 var divisionResult = resultLbl.Text;94 // Assert95 addResult.Should().Be("10.");96 subtractResult.Should().Be("6.");97 multiplicationResult.Should().Be("60.");98 divisionResult.Should().Be("10.");99 }100 [Fact]101 public void ProcessKeyboardEvents_WhenKeyboardKeyIsPressed()102 {103 // Arrange104 var mainScreen = this.Application.GetMainWindow(this.Automation);105 // Act106 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());107 Keyboard.Type("1234567890");108 Wait.UntilInputIsProcessed();109 // Assert110 resultLbl.Text.Should().Be("1,234,567,890.");111 }112 [Fact]113 public void ShowNegativeNumber_WhenAlgebSignButtonIsPressed()114 {115 // Arrange116 var mainScreen = this.Application.GetMainWindow(this.Automation);117 // Act118 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());119 var algebSignBtn = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.AlgebSignBtn)).AsButton());120 algebSignBtn?.Invoke();121 Wait.UntilInputIsProcessed();122 // Assert123 resultLbl.Text.Should().Be("-0.");124 }125 [Fact]126 public void ShowCalculatedResult_WhenCalculationButtonIsPressed()127 {128 // Arrange129 var mainScreen = this.Application.GetMainWindow(this.Automation);130 // Act131 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());132 Keyboard.Type("10");133 Wait.UntilInputIsProcessed();134 Keyboard.Type(VirtualKeyShort.ADD);135 Wait.UntilInputIsProcessed();136 Keyboard.Type("5");137 Wait.UntilInputIsProcessed();138 var calculateBtn = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.CalculateBtn)).AsButton());139 calculateBtn?.Invoke();140 Wait.UntilInputIsProcessed();141 // Assert142 resultLbl.Text.Should().Be("15.");143 }144 [Fact]145 public void ClearValues_WhenClearButtonIsPressedAShortTime()146 {147 // Arrange148 var mainScreen = this.Application.GetMainWindow(this.Automation);149 // Act150 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());151 Keyboard.Type("1234567890");152 Wait.UntilInputIsProcessed();153 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.ClearBtn)).AsButton()).Click();154 Wait.UntilInputIsProcessed();155 // Assert156 resultLbl.Text.Should().Be("0.");157 }158 [Fact]159 public async Task ClearValuesAndShowHint_WhenClearButtonIsClickedALongTimeAsync()160 {161 // Arrange162 var mainScreen = this.Application.GetMainWindow(this.Automation);163 // Act164 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());165 Keyboard.Type("1234567890");166 Wait.UntilInputIsProcessed();167 var clearBtn = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.ClearBtn)).AsButton());168 Mouse.MoveTo(clearBtn.GetClickablePoint());169 await ExtendedMouseInput.LongLeftMouseClickAsync(this.touchDelayWithOffset).ConfigureAwait(false);170 Wait.UntilInputIsProcessed();171 var hintMessageTxt = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.HintView.HintMessageTxt)).AsLabel());172 // Assert173 hintMessageTxt.Text.Should().NotBeNullOrWhiteSpace();174 resultLbl.Text.Should().Be("0.");175 }176 [Fact]177 public void SetSpecialFunctionLabels_WhenSpecialFunctionButtonsArePressed()178 {179 // Arrange180 var mainScreen = this.Application.GetMainWindow(this.Automation);181 // Act182 Keyboard.Type("1");183 Wait.UntilInputIsProcessed();184 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.YearsBtn)).AsButton()).Click();185 Wait.UntilInputIsProcessed();186 var yearsActiveResult = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.YearsActiveStatusLbl)).AsLabel()).Text;187 var yearsNumber = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.YearsNumberLbl)).AsLabel()).Text;188 Keyboard.Type("2");189 Wait.UntilInputIsProcessed();190 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.InterestBtn)).AsButton()).Click();191 Wait.UntilInputIsProcessed();192 var interestActiveResult = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.InterestActiveStatusLbl)).AsLabel()).Text;193 var interestNumber = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.InterestNumberLbl)).AsLabel()).Text;194 var nomInterestNumber = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.NominalInterestRateNumberLbl)).AsLabel()).Text;195 Keyboard.Type("3");196 Wait.UntilInputIsProcessed();197 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.StartBtn)).AsButton()).Click();198 Wait.UntilInputIsProcessed();199 var startActiveResult = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.StartActiveStatusLbl)).AsLabel()).Text;200 var startNumber = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.StartNumberLbl)).AsLabel()).Text;201 Keyboard.Type("4");202 Wait.UntilInputIsProcessed();203 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.RateBtn)).AsButton()).Click();204 Wait.UntilInputIsProcessed();205 var rateActiveResult = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.RateActiveStatusLbl)).AsLabel()).Text;206 var rateNumber = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.RateNumberLbl)).AsLabel()).Text;207 var repaymentRateNumber = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.RepaymentRateNumberLbl)).AsLabel()).Text;208 Keyboard.Type("5");209 Wait.UntilInputIsProcessed();210 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EndBtn)).AsButton()).Click();211 Wait.UntilInputIsProcessed();212 var endActiveResult = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EndActiveStatusLbl)).AsLabel()).Text;213 var endNumber = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EndNumberLbl)).AsLabel()).Text;214 Keyboard.Type(VirtualKeyShort.MULTIPLY);215 Wait.UntilInputIsProcessed();216 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.StartBtn)).AsButton()).Click();217 Wait.UntilInputIsProcessed();218 var advanceActiveResult = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.AdvanceActiveStatusLbl)).AsLabel()).Text;219 // Assert220 yearsActiveResult.Should().NotBeNullOrWhiteSpace();221 interestActiveResult.Should().NotBeNullOrWhiteSpace();222 startActiveResult.Should().NotBeNullOrWhiteSpace();223 rateActiveResult.Should().NotBeNullOrWhiteSpace();224 endActiveResult.Should().NotBeNullOrWhiteSpace();225 advanceActiveResult.Should().NotBeNullOrWhiteSpace();226 yearsNumber.Should().Be("1.00");227 interestNumber.Should().Be("2.000");228 nomInterestNumber.Should().Be("1.982");229 startNumber.Should().Be("3.00");230 rateNumber.Should().Be("4.00");231 repaymentRateNumber.Should().Be("-1,601.98");232 endNumber.Should().Be("5.00");233 }234 [Fact]235 public void ShowSpecialFunctionOutput_WhenSpecialFunctionButtonsArePressedAShortTime()236 {237 // Arrange238 var mainScreen = this.Application.GetMainWindow(this.Automation);239 // Act240 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());241 Keyboard.Type("1");242 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.YearsBtn)).AsButton()).Click();243 Wait.UntilInputIsProcessed();244 var yearsResult = resultLbl.Text;245 Keyboard.Type("2");246 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.InterestBtn)).AsButton()).Click();247 Wait.UntilInputIsProcessed();248 var interestResult = resultLbl.Text;249 Keyboard.Type("3");250 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.StartBtn)).AsButton()).Click();251 Wait.UntilInputIsProcessed();252 var startResult = resultLbl.Text;253 Keyboard.Type("4");254 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.RateBtn)).AsButton()).Click();255 Wait.UntilInputIsProcessed();256 var rateResult = resultLbl.Text;257 Keyboard.Type("5");258 WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EndBtn)).AsButton()).Click();259 Wait.UntilInputIsProcessed();260 var endResult = resultLbl.Text;261 // Assert262 yearsResult.Should().Be("1.00");263 interestResult.Should().Be("2.000");264 startResult.Should().Be("3.00");265 rateResult.Should().Be("4.00");266 endResult.Should().Be("5.00");267 }268 [Fact]269 public async Task ShowSavedSpecialFunctionValues_WhenSpecialFunctionButtonIsClickedALongTimeAsync()270 {271 // Arrange272 var mainScreen = this.Application.GetMainWindow(this.Automation);273 // Act274 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());275 Keyboard.Type("1");276 var yearsBtn = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.YearsBtn)).AsButton());277 yearsBtn.Click();278 Wait.UntilInputIsProcessed();279 Keyboard.Type("2");280 var interestBtn = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.InterestBtn)).AsButton());281 interestBtn.Click();282 Wait.UntilInputIsProcessed();283 Keyboard.Type("3");284 var startBtn = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.StartBtn)).AsButton());285 startBtn.Click();286 Wait.UntilInputIsProcessed();287 Keyboard.Type("4");288 var rateBtn = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.RateBtn)).AsButton());289 rateBtn.Click();290 Wait.UntilInputIsProcessed();291 Keyboard.Type("5");292 var endBtn = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EndBtn)).AsButton());293 endBtn.Click();294 Wait.UntilInputIsProcessed();295 Mouse.MoveTo(yearsBtn.GetClickablePoint());296 await ExtendedMouseInput.LongLeftMouseClickAsync(this.touchDelayWithOffset).ConfigureAwait(false);297 Wait.UntilInputIsProcessed();298 var yearsResult = resultLbl.Text;299 Mouse.MoveTo(interestBtn.GetClickablePoint());300 await ExtendedMouseInput.LongLeftMouseClickAsync(this.touchDelayWithOffset).ConfigureAwait(false);301 Wait.UntilInputIsProcessed();302 var interestResult = resultLbl.Text;303 Mouse.MoveTo(startBtn.GetClickablePoint());304 await ExtendedMouseInput.LongLeftMouseClickAsync(this.touchDelayWithOffset).ConfigureAwait(false);305 Wait.UntilInputIsProcessed();306 var startResult = resultLbl.Text;307 Mouse.MoveTo(rateBtn.GetClickablePoint());308 await ExtendedMouseInput.LongLeftMouseClickAsync(this.touchDelayWithOffset).ConfigureAwait(false);309 Wait.UntilInputIsProcessed();310 var rateResult = resultLbl.Text;311 Mouse.MoveTo(endBtn.GetClickablePoint());312 await ExtendedMouseInput.LongLeftMouseClickAsync(this.touchDelayWithOffset).ConfigureAwait(false);313 Wait.UntilInputIsProcessed();314 var endResult = resultLbl.Text;315 // Assert316 yearsResult.Should().Be("1.00");317 interestResult.Should().Be("2.000");318 startResult.Should().Be("3.00");319 rateResult.Should().Be("4.00");320 endResult.Should().Be("5.00");321 }322 [Fact(Skip = "https://github.com/FlaUI/FlaUI/issues/389")]323 public void ShowSavedYearsValue_WhenYearsButtonIsTouchedLong()324 {325 // Arrange326 var mainScreen = this.Application.GetMainWindow(this.Automation);327 // Act328 var resultLbl = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.EvaluationResultLbl)).AsLabel());329 var yearsBtn = WaitForElement(() => mainScreen.FindFirstDescendant(cf => cf.ByAutomationId(UiIds.ClassicCalculator.YearsBtn)).AsButton());330 Mouse.MoveTo(yearsBtn.GetClickablePoint());331 Touch.Hold(this.touchDelayWithOffset, yearsBtn.GetClickablePoint());332 Wait.UntilInputIsProcessed(this.touchDelayWithOffset);333 // Assert334 resultLbl.Text.Should().Be("0.00");335 }336 #region protected Overrides337 protected override AutomationBase GetAutomation()338 {339 var automation = new UIA3Automation();340 return automation;341 }342 protected override Application StartApplication()343 {344 var application = Application.Launch(this.AppPath);345 application.WaitWhileMainHandleIsMissing();346 // Give the application some additional time to start...

Full Screen

Full Screen

SmokeTestUI.cs

Source:SmokeTestUI.cs Github

copy

Full Screen

...122 {123 _window.FindFirstDescendant(_cF.ByAutomationId("Ticker")).AsTextBox().Click();124 Keyboard.Type("AMD");125 _window.FindFirstDescendant(_cF.ByAutomationId("Go")).AsButton().Click();126 Wait.UntilInputIsProcessed(QuickTimeout);127 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("TdStockListView")).AsListBox().Items;128 Assert.That(stockData, Is.Not.Null);129 }130 [Test]131 public void TC2_2_StockBrowseTabStockScreenerBackToMain()132 {133 var stockTab = _window.FindFirstDescendant(_cF.ByText("Stock Screener")).AsTabItem().Select();134 stockTab.Click();135 _window.FindFirstDescendant(_cF.ByAutomationId("OnToggle")).AsToggleButton().Click();136 _window.FindFirstDescendant(_cF.ByAutomationId("MoversGrp")).AsComboBox().Select(2).Click();137 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("MoversList")).AsListBox().Items;138 Wait.UntilInputIsProcessed(QuickTimeout);139 Assert.That(stockData, Is.Not.Null);140 var homeTab = _window.FindFirstDescendant(_cF.ByText("Home")).AsTabItem().Select();141 homeTab.Click();142 _window.FindFirstDescendant(_cF.ByAutomationId("Ticker")).AsTextBox().Click();143 Keyboard.Type("AMD");144 _window.FindFirstDescendant(_cF.ByAutomationId("Go")).AsButton().Click();145 Wait.UntilInputIsProcessed(QuickTimeout);146 var stockData2 = _window.FindFirstDescendant(_cF.ByAutomationId("TdStockListView")).AsListBox().Items;147 Assert.That(stockData2, Is.Not.Null);148 }149 [Test]150 public void TC2_3_StockMainPageIsNotNull()151 {152 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("TdStockListView")).AsListBox().Items;153 Assert.That(stockData, Is.Not.Null);154 }155 [Test]156 public void TC2_4_API_TDAmeritradeReceivesResponse()157 {158 _window.FindFirstDescendant(_cF.ByAutomationId("Ticker")).AsTextBox().Click();159 Keyboard.Type("MSFT");160 _window.FindFirstDescendant(_cF.ByAutomationId("Go")).AsButton().Click();161 Wait.UntilInputIsProcessed(QuickTimeout);162 var stockData2 = _window.FindFirstDescendant(_cF.ByAutomationId("TdStockListView")).AsListBox().Items;163 Assert.That(stockData2, Is.Not.Null);164 }165 [Test]166 public void TC2_5_PrivacyUIOpen()167 {168 _window.FindFirstDescendant(_cF.ByAutomationId("Abt")).AsButton().Click();169 using var auto = new UIA3Automation();170 var privacyWindow = _app.GetAllTopLevelWindows(auto);171 Assert.That(privacyWindow[0], Is.Not.Null);172 }173 [Test]174 public void TC3_1_CalculationsUI()175 {176 var stockTab = _window.FindFirstDescendant(_cF.ByText("Calculations")).AsTabItem().Select();177 stockTab.Click();178 Assert.That(stockTab.IsSelected);179 }180 [Test]181 public void TC3_2_Calculations_Calc_PCT_Negative()182 {183 var stockTab = _window.FindFirstDescendant(_cF.ByText("Calculations")).AsTabItem().Select();184 stockTab.Click();185 _window.FindFirstDescendant(_cF.ByAutomationId("PercentBought")).AsTextBox().Click();186 Keyboard.Type("15");187 _window.FindFirstDescendant(_cF.ByAutomationId("PercentSold")).AsTextBox().Click();188 Keyboard.Type("13");189 _window.FindFirstDescendant(_cF.ByAutomationId("pctBtn")).AsButton().Click();190 Wait.UntilInputIsProcessed(QuickTimeout);191 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("PercentResult"));192 Assert.AreEqual(stockData.Name, "-13.3%");193 }194 [Test]195 public void TC3_3_Calculations_Calc_PCT_Positive()196 {197 var stockTab = _window.FindFirstDescendant(_cF.ByText("Calculations")).AsTabItem().Select();198 stockTab.Click();199 _window.FindFirstDescendant(_cF.ByAutomationId("PercentBought")).AsTextBox().Click();200 Keyboard.Type("7");201 _window.FindFirstDescendant(_cF.ByAutomationId("PercentSold")).AsTextBox().Click();202 Keyboard.Type("14.35");203 _window.FindFirstDescendant(_cF.ByAutomationId("pctBtn")).AsButton().Click();204 Wait.UntilInputIsProcessed(QuickTimeout);205 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("PercentResult"));206 Assert.AreEqual(stockData.Name, "105%");207 }208 [Test]209 public void TC3_4_Calculations_Cacl_Money_Positive()210 {211 var stockTab = _window.FindFirstDescendant(_cF.ByText("Calculations")).AsTabItem().Select();212 stockTab.Click();213 _window.FindFirstDescendant(_cF.ByAutomationId("RoiBought")).AsTextBox().Click();214 Keyboard.Type("25");215 _window.FindFirstDescendant(_cF.ByAutomationId("RoiSold")).AsTextBox().Click();216 Keyboard.Type("28");217 _window.FindFirstDescendant(_cF.ByAutomationId("RoiShares")).AsTextBox().Click();218 Keyboard.Type("5000");219 _window.FindFirstDescendant(_cF.ByAutomationId("roiBtn")).AsButton().Click();220 Wait.UntilInputIsProcessed(QuickTimeout);221 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("RoiResult"));222 Assert.AreEqual(stockData.Name, "$15000");223 }224 [Test]225 public void TC3_5_Calculations_Cacl_Money_Negative()226 {227 var stockTab = _window.FindFirstDescendant(_cF.ByText("Calculations")).AsTabItem().Select();228 stockTab.Click();229 _window.FindFirstDescendant(_cF.ByAutomationId("RoiBought")).AsTextBox().Click();230 Keyboard.Type("52");231 _window.FindFirstDescendant(_cF.ByAutomationId("RoiSold")).AsTextBox().Click();232 Keyboard.Type("13");233 _window.FindFirstDescendant(_cF.ByAutomationId("RoiShares")).AsTextBox().Click();234 Keyboard.Type("5000");235 _window.FindFirstDescendant(_cF.ByAutomationId("roiBtn")).AsButton().Click();236 Wait.UntilInputIsProcessed(QuickTimeout);237 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("RoiResult"));238 Assert.AreEqual(stockData.Name, "$-195000");239 }240 [Test]241 public void TC3_6_Calculations_Split_Portfolio_Times_Three()242 {243 var stockTab = _window.FindFirstDescendant(_cF.ByText("Calculations")).AsTabItem().Select();244 stockTab.Click();245 _window.FindFirstDescendant(_cF.ByAutomationId("AccountInput")).AsTextBox().Click();246 Keyboard.Type("2500");247 var slider = _window.FindFirstDescendant(_ => _cF.ByAutomationId("AccountSlider"));248 slider.Patterns.RangeValue.Pattern.SetValue(3);249 Wait.UntilInputIsProcessed(QuickTimeout);250 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("AccountResult"));251 Assert.AreEqual(stockData.Name, "$833.33333");252 }253 [Test]254 public void TC3_7_Calculations_Split_Portfolio_Times_Five()255 {256 var stockTab = _window.FindFirstDescendant(_cF.ByText("Calculations")).AsTabItem().Select();257 stockTab.Click();258 _window.FindFirstDescendant(_cF.ByAutomationId("AccountInput")).AsTextBox().Click();259 Keyboard.Type("2500");260 var slider = _window.FindFirstDescendant(_ => _cF.ByAutomationId("AccountSlider"));261 slider.Patterns.RangeValue.Pattern.SetValue(5);262 263 Wait.UntilInputIsProcessed(QuickTimeout);264 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("AccountResult"));265 Assert.AreEqual(stockData.Name, "$500");266 }267 [Test]268 public void TC3_8_Calculations_Split_Portfolio_Times_Seven()269 {270 var stockTab = _window.FindFirstDescendant(_cF.ByText("Calculations")).AsTabItem().Select();271 stockTab.Click();272 _window.FindFirstDescendant(_cF.ByAutomationId("AccountInput")).AsTextBox().Click();273 Keyboard.Type("2500");274 var slider = _window.FindFirstDescendant(_ => _cF.ByAutomationId("AccountSlider"));275 slider.Patterns.RangeValue.Pattern.SetValue(7);276 Wait.UntilInputIsProcessed(QuickTimeout);277 var stockData = _window.FindFirstDescendant(_cF.ByAutomationId("AccountResult"));278 Assert.AreEqual(stockData.Name, "$357.14285");279 }280 }281}...

Full Screen

Full Screen

Calculator.cs

Source:Calculator.cs Github

copy

Full Screen

...21 mainWindow.SetForeground();22 23 /*Keyboard.TypeSimultaneously(VirtualKeyShort.LWIN, VirtualKeyShort.KEY_R);24 Keyboard.Type("calc");25 Wait.UntilInputIsProcessed();26 Keyboard.Press(VirtualKeyShort.ENTER);27 Wait.UntilInputIsProcessed();28 mainWindow = automation.GetDesktop().FindFirstDescendant(cf => cf.ByName("Kalkulačka")).AsWindow();29 Process p = Process.GetProcessesByName("Calculator").First();30 app = new Application(p, true);*/31 }32 #region Private properties33 private readonly Application app;34 private readonly Window mainWindow;35 #endregion Private members36 #region Private methods37 private AutomationElement FindElement(string text)38 {39 var element = mainWindow.FindFirstDescendant(cf => cf.ByAutomationId(text));40 return element;41 }42 #endregion43 #region Public properties44 public Button Button0 => FindElement("num0Button").AsButton();45 public Button Button1 => FindElement("num1Button").AsButton();46 public Button Button2 => FindElement("num2Button").AsButton();47 public Button Button3 => FindElement("num3Button").AsButton();48 public Button Button4 => FindElement("num4Button").AsButton();49 public Button Button5 => FindElement("num5Button").AsButton();50 public Button Button6 => FindElement("num6Button").AsButton();51 public Button Button7 => FindElement("num7Button").AsButton();52 public Button Button8 => FindElement("num8Button").AsButton();53 public Button Button9 => FindElement("num9Button").AsButton();54 public Button ButtonPi => FindElement("piButton").AsButton();55 public Button ButtonPlus => FindElement("plusButton").AsButton();56 public Button ButtonMinus => FindElement("minusButton").AsButton();57 public Button ButtonMultiply => FindElement("multiplyButton").AsButton();58 public Button ButtonDivide => FindElement("divideButton").AsButton();59 public Button ButtonDecimalSeparator => FindElement("decimalSeparatorButton").AsButton();60 public Button ButtonEquals => FindElement("equalButton").AsButton();61 public string Result62 {63 get64 {65 var resultElement = FindElement("CalculatorResults");66 var value = resultElement.Properties.Name;67 return Regex.Replace(value, "Zobrazuje se ", string.Empty);68 }69 }70 public string Header71 {72 get73 {74 var headerElement = FindElement("Header").AsTextBox();75 var value = headerElement.Name;76 return Regex.Replace(value, "Režim kalkulačky ", string.Empty);77 }78 }79 #endregion80 #region Public methods81 public void Close()82 {83 mainWindow.Close();84 }85 public void SwitchToStandard()86 {87 Keyboard.TypeSimultaneously(VirtualKeyShort.ALT, VirtualKeyShort.KEY_1);88 Wait.UntilInputIsProcessed();89 app.WaitWhileBusy();90 }91 public void SwitchToScientific()92 {93 Keyboard.TypeSimultaneously(VirtualKeyShort.ALT, VirtualKeyShort.KEY_2);94 Wait.UntilInputIsProcessed();95 app.WaitWhileBusy();96 }97 #endregion98 }99}...

Full Screen

Full Screen

UntilInputIsProcessed

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using FlaUI.Core;7using FlaUI.Core.AutomationElements;8using FlaUI.Core.Input;9using FlaUI.Core.Tools;10using FlaUI.UIA3;11using System.Diagnostics;12using System.Threading;13{14 {15 static void Main(string[] args)16 {17 Process.Start("notepad.exe");18 var automation = new UIA3Automation();19 Wait.UntilInputIsProcessed(2000);20 var window = automation.GetDesktop().FindFirstChild(cf => cf.ByControlType(FlaUI.Core.Definitions.ControlType.Window).And(cf.ByName("Untitled - Notepad")));21 var textArea = window.FindFirstChild(cf => cf.ByControlType(FlaUI.Core.Definitions.ControlType.Edit));22 textArea.AsTextBox().Text = "Hello World";23 Wait.UntilInputIsProcessed(2000);24 window.Close();25 }26 }27}28using System;29using System.Collections.Generic;30using System.Linq;31using System.Text;32using System.Threading.Tasks;33using FlaUI.Core;34using FlaUI.Core.AutomationElements;35using FlaUI.Core.Input;36using FlaUI.Core.Tools;37using FlaUI.UIA3;38using System.Diagnostics;39using System.Threading;40{41 {42 static void Main(string[] args)43 {44 Process.Start("notepad.exe");45 var automation = new UIA3Automation();46 Wait.UntilInputIsProcessed(2000);47 var window = automation.GetDesktop().FindFirstChild(cf => cf.ByControlType(FlaUI.Core.Definitions.ControlType.Window).And(cf.ByName("Untitled - Notepad")));

Full Screen

Full Screen

UntilInputIsProcessed

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using System.Windows.Forms;7using FlaUI.Core.AutomationElements;8using FlaUI.Core.Input;9using FlaUI.Core.WindowsAPI;10using FlaUI.UIA3;11using FlaUI.Core.Definitions;12using System.Threading;13{14 {15 static void Main(string[] args)16 {17 var app = FlaUI.Core.Application.Launch(@"C:\Windows\notepad.exe");18 var automation = new UIA3Automation();19 Wait.UntilInputIsProcessed(TimeSpan.FromSeconds(10));20 var window = app.GetMainWindow(automation);21 Wait.UntilInputIsProcessed(TimeSpan.FromSeconds(10));22 var textbox = window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Edit)).AsTextBox();23 Wait.UntilInputIsProcessed(TimeSpan.FromSeconds(10));24 textbox.Enter("Hello World!");25 }26 }27}28using System;29using System.Collections.Generic;30using System.Linq;31using System.Text;32using System.Threading.Tasks;33using System.Windows.Forms;34using FlaUI.Core.AutomationElements;35using FlaUI.Core.Input;36using FlaUI.Core.WindowsAPI;37using FlaUI.UIA3;38using FlaUI.Core.Definitions;39using System.Threading;40{41 {42 static void Main(string[] args)43 {44 var app = FlaUI.Core.Application.Launch(@"C:\Windows\notepad.exe");45 var automation = new UIA3Automation();46 Wait.UntilInputIsProcessed(TimeSpan.FromSeconds(10));47 var window = app.GetMainWindow(automation);48 Wait.UntilInputIsProcessed(TimeSpan.FromSeconds(10));49 var textbox = window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Edit

Full Screen

Full Screen

UntilInputIsProcessed

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using FlaUI.Core;7using FlaUI.Core.Input;8using FlaUI.Core.AutomationElements;9{10 {11 static void Main(string[] args)12 {13 var app = FlaUI.Core.Application.Launch(@"C:\Windows\System32\calc.exe");14 var window = app.GetMainWindow(FlaUI.Core.Automation.AutomationFactory.Instance);15 var button = window.FindFirstDescendant(cf => cf.ByAutomationId("num1Button")).AsButton();16 button.Click();17 var button2 = window.FindFirstDescendant(cf => cf.ByAutomationId("num2Button")).AsButton();18 button2.Click();19 var button3 = window.FindFirstDescendant(cf => cf.ByAutomationId("num3Button")).AsButton();20 button3.Click();21 var button4 = window.FindFirstDescendant(cf => cf.ByAutomationId("num4Button")).AsButton();22 button4.Click();23 var button5 = window.FindFirstDescendant(cf => cf.ByAutomationId("num5Button")).AsButton();24 button5.Click();25 var button6 = window.FindFirstDescendant(cf => cf.ByAutomationId("num6Button")).AsButton();26 button6.Click();27 var button7 = window.FindFirstDescendant(cf => cf.ByAutomationId("num7Button")).AsButton();28 button7.Click();29 var button8 = window.FindFirstDescendant(cf => cf.ByAutomationId("num8Button")).AsButton();30 button8.Click();31 var button9 = window.FindFirstDescendant(cf => cf.ByAutomationId("num9Button")).AsButton();32 button9.Click();33 var button0 = window.FindFirstDescendant(cf => cf.ByAutomationId("num0Button")).AsButton();34 button0.Click();35 var buttonPlus = window.FindFirstDescendant(cf => cf.ByAutomationId("plusButton")).AsButton();36 buttonPlus.Click();37 var buttonEqual = window.FindFirstDescendant(cf => cf.ByAutomationId("equalButton")).AsButton();38 buttonEqual.Click();39 var buttonClear = window.FindFirstDescendant(cf => cf.ByAutomationId("clearButton")).AsButton();40 buttonClear.Click();41 Wait.UntilInputIsProcessed();42 }43 }44}

Full Screen

Full Screen

UntilInputIsProcessed

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using FlaUI.Core;7using FlaUI.Core.AutomationElements;8using FlaUI.Core.Input;9using FlaUI.Core.Tools;10{11 {12 static void Main(string[] args)13 {14 var app = FlaUI.Core.Application.Launch(@"C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE");15 var automation = FlaUI.Core.Automation.AutomationFactory.GetAutomation();16 var mainwindow = app.GetMainWindow(automation);17 var textbox = mainwindow.FindFirstDescendant(cf => cf.ByControlType(FlaUI.Core.Definitions.ControlType.Edit)).AsTextBox();18 textbox.Text = "Hello World";19 Wait.UntilInputIsProcessed();20 Console.WriteLine("Hello World");21 Console.ReadLine();22 }23 }24}25using System;26using System.Collections.Generic;27using System.Linq;28using System.Text;29using System.Threading.Tasks;30using FlaUI.Core;31using FlaUI.Core.AutomationElements;32using FlaUI.Core.Input;33using FlaUI.Core.Tools;34{35 {36 static void Main(string[] args)37 {38 var app = FlaUI.Core.Application.Launch(@"C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE");39 var automation = FlaUI.Core.Automation.AutomationFactory.GetAutomation();40 var mainwindow = app.GetMainWindow(automation);41 var textbox = mainwindow.FindFirstDescendant(cf => cf.ByControlType(FlaUI.Core.Definitions.ControlType.Edit)).AsTextBox();42 textbox.Text = "Hello World";43 Wait.WaitWhileBusy();44 Console.WriteLine("Hello World");45 Console.ReadLine();46 }47 }48}49using System;50using System.Collections.Generic;51using System.Linq;52using System.Text;53using System.Threading.Tasks;54using FlaUI.Core;55using FlaUI.Core.AutomationElements;56using FlaUI.Core.Input;57using FlaUI.Core.Tools;58{59 {60 static void Main(string[] args)61 {62 var app = FlaUI.Core.Application.Launch(@"C:\Program Files (

Full Screen

Full Screen

UntilInputIsProcessed

Using AI Code Generation

copy

Full Screen

1using FlaUI.Core;2using FlaUI.Core.Input;3using FlaUI.Core.WindowsAPI;4using System;5using System.Collections.Generic;6using System.Linq;7using System.Text;8using System.Threading.Tasks;9{10 {11 static void Main(string[] args)12 {13 var app = Application.Launch(@"C:\Windows\System32\calc.exe");14 var window = app.GetMainWindow();15 window.WaitWhileBusy();16 var button = window.FindFirstDescendant(cf => cf.ByAutomationId("num8Button"));

Full Screen

Full Screen

UntilInputIsProcessed

Using AI Code Generation

copy

Full Screen

1using FlaUI.Core;2using FlaUI.Core.Input;3using FlaUI.Core.WindowsAPI;4using System;5using System.Collections.Generic;6using System.Linq;7using System.Text;8using System.Threading.Tasks;9{10 {11 static void Main(string[] args)12 {13 var application = Application.Launch("notepad.exe");14 var window = application.GetMainWindow(FlaUI.Core.Automation.WindowsFramework.WinForms);15 window.Focus();16 window.SetTransparency(0.5);17 window.SetForeground();18 window.SetTopmost(true);19 window.SetWindowPosition(10, 10, 300, 300);20 window.SetWindowState(WindowState.Maximized);21 window.SetWindowState(WindowState.Minimized);22 window.SetWindowState(WindowState.Normal);23 window.SetWindowPosition(10, 10, 300, 300);24 window.SetTransparency(1);25 window.SetTopmost(false);26 window.SetForeground();27 window.SetWindowPosition(10, 10, 300, 300);28 window.SetWindowState(WindowState.Maximized);29 window.SetWindowState(WindowState.Minimized);30 window.SetWindowState(WindowState.Normal);31 window.SetWindowPosition(10, 10, 300, 300);32 window.SetTransparency(0.5);33 window.SetTopmost(true);34 window.SetForeground();35 window.SetWindowPosition(10, 10, 300, 300);36 window.SetWindowState(WindowState.Maximized);37 window.SetWindowState(WindowState.Minimized);38 window.SetWindowState(WindowState.Normal);39 window.SetWindowPosition(10, 10, 300, 300);40 window.SetTransparency(1);41 window.SetTopmost(false);42 window.SetForeground();43 window.SetWindowPosition(10, 10, 300, 300);44 window.SetWindowState(WindowState.Maximized);45 window.SetWindowState(WindowState.Minimized);46 window.SetWindowState(WindowState.Normal);47 window.SetWindowPosition(10, 10, 300, 300);48 window.SetTransparency(0.5);49 window.SetTopmost(true);50 window.SetForeground();51 window.SetWindowPosition(10, 10, 300, 300);52 window.SetWindowState(WindowState.Maximized);53 window.SetWindowState(WindowState.Minimized);54 window.SetWindowState(WindowState.Normal);55 window.SetWindowPosition(10, 10, 300, 300

Full Screen

Full Screen

UntilInputIsProcessed

Using AI Code Generation

copy

Full Screen

1using FlaUI.Core;2using FlaUI.Core.Input;3using FlaUI.Core.AutomationElements.Infrastructure;4using FlaUI.Core.AutomationElements;5using FlaUI.Core.Definitions;6using FlaUI.Core.Tools;7using FlaUI.UIA3;8using System;9using System.Diagnostics;10using System.Threading;11using System.Windows.Forms;12using System.Drawing;13using System.Collections.Generic;14using FlaUI.Core.WindowsAPI;15using FlaUI.Core.WindowsAPI;

Full Screen

Full Screen

UntilInputIsProcessed

Using AI Code Generation

copy

Full Screen

1using System;2using FlaUI.Core.Input;3{4 static void Main(string[] args)5 {6 Wait.UntilInputIsProcessed();7 }8}9using System;10using FlaUI.Core.Input;11{12 static void Main(string[] args)13 {14 Wait.UntilResponsive();15 }16}17using System;18using FlaUI.Core.Input;19{20 static void Main(string[] args)21 {22 Wait.UntilResponsiveAndIdle();23 }24}25using System;26using FlaUI.Core.Input;27{28 static void Main(string[] args)29 {30 Wait.UntilResponsiveAndIdle();31 }32}33using System;34using FlaUI.Core.Input;35{36 static void Main(string[] args)37 {38 Wait.UntilResponsiveAndIdle();39 }40}41using System;42using FlaUI.Core.Input;43{44 static void Main(string[] args)45 {46 Wait.UntilResponsiveAndIdle();47 }48}49using System;50using FlaUI.Core.Input;51{52 static void Main(string[] args)53 {54 Wait.UntilResponsiveAndIdle();55 }56}57using System;58using FlaUI.Core.Input;59{60 static void Main(string[] args)61 {62 Wait.UntilResponsiveAndIdle();63 }64}65using System;66using FlaUI.Core.Input;67{68 static void Main(string[] args)69 {

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run FlaUI automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in Wait

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful