Adding Test Method "KeyboardInput_HistoryHotkeys" (#1431)
Now that #744 has been fixed, I'm adding Test Method "KeyboardInput_HistoryHotkeys" to test the functionality of history hotkeys such as [Shift] + [Ctrl] + [D] to help prevent a regression or a break.
This commit is contained in:
parent
296cf038b9
commit
c3ed03ccfd
@ -5,6 +5,7 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using OpenQA.Selenium;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace CalculatorUITests
|
||||
{
|
||||
@ -362,6 +363,32 @@ public void KeyboardInput_MemoryHotkeys()
|
||||
Assert.IsNotNull(WinAppDriver.Instance.CalculatorSession.FindElementByAccessibilityId("MemoryPaneEmpty")); //verifies the Memory panel's memory clear button hotkey
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Priority(1)]
|
||||
public void KeyboardInput_HistoryHotkeys()
|
||||
{
|
||||
//Verifies history buttons
|
||||
CalculatorApp.EnsureCalculatorHasFocus();
|
||||
CalculatorApp.Window.SendKeys("4");
|
||||
CalculatorApp.Window.SendKeys(Keys.Multiply);
|
||||
CalculatorApp.Window.SendKeys("5");
|
||||
CalculatorApp.Window.SendKeys(Keys.Divide);
|
||||
CalculatorApp.Window.SendKeys("2");
|
||||
CalculatorApp.Window.SendKeys(Keys.Equal);
|
||||
page.HistoryPanel.ResizeWindowToDisplayHistoryButton();
|
||||
CalculatorApp.Window.SendKeys(Keys.Control + "h" + Keys.Control);
|
||||
var historyFlyoutItems = page.HistoryPanel.GetAllHistoryFlyoutListViewItems();
|
||||
var historyExpression = Regex.Replace(historyFlyoutItems[0].GetExpression(), @"\s", string.Empty);
|
||||
Assert.IsTrue(historyFlyoutItems[0].GetValue().Equals("10", StringComparison.InvariantCultureIgnoreCase)); //verifies History button hotkeys
|
||||
Assert.IsTrue(historyExpression.Equals("4×5÷2=", StringComparison.InvariantCultureIgnoreCase)); //verifies History button hotkeys
|
||||
page.HistoryPanel.ResizeWindowToDisplayHistoryLabel();
|
||||
var historyItems = page.HistoryPanel.GetAllHistoryListViewItems();
|
||||
Assert.IsTrue(historyItems[0].GetValue().Equals("10", StringComparison.InvariantCultureIgnoreCase));
|
||||
Assert.IsTrue(historyExpression.Equals("4×5÷2=", StringComparison.InvariantCultureIgnoreCase));
|
||||
CalculatorApp.Window.SendKeys(Keys.Shift + Keys.Control + "d" + Keys.Control + Keys.Shift);
|
||||
Assert.IsNotNull(WinAppDriver.Instance.CalculatorSession.FindElementByAccessibilityId("HistoryEmpty")); //verifies the History panel's clear history button hotkeys
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Arithmetic Operators Functionality via Mixed Input
|
||||
|
Loading…
Reference in New Issue
Block a user