diff --git a/src/CalcViewModel/CalcViewModel.vcxproj.filters b/src/CalcViewModel/CalcViewModel.vcxproj.filters
index 7a0619e..b219806 100644
--- a/src/CalcViewModel/CalcViewModel.vcxproj.filters
+++ b/src/CalcViewModel/CalcViewModel.vcxproj.filters
@@ -205,4 +205,7 @@
DataLoaders
+
+
+
\ No newline at end of file
diff --git a/src/Calculator.sln b/src/Calculator.sln
index ce6eb3b..d7b25cc 100644
--- a/src/Calculator.sln
+++ b/src/Calculator.sln
@@ -3,16 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29009.5
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Calculator", "Calculator\Calculator.vcxproj", "{9447424A-0E05-4911-BEB8-E0354405F39A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalcManager", "CalcManager\CalcManager.vcxproj", "{311E866D-8B93-4609-A691-265941FEE101}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3A5DF651-B8A1-45CA-9135-964A6FC7F5D1}"
ProjectSection(SolutionItems) = preProject
..\.clang-format = ..\.clang-format
nuget.config = nuget.config
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Calculator", "Calculator\Calculator.vcxproj", "{9447424A-0E05-4911-BEB8-E0354405F39A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalcManager", "CalcManager\CalcManager.vcxproj", "{311E866D-8B93-4609-A691-265941FEE101}"
+EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalcViewModel", "CalcViewModel\CalcViewModel.vcxproj", "{90E9761D-9262-4773-942D-CAEAE75D7140}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalculatorUnitTests", "CalculatorUnitTests\CalculatorUnitTests.vcxproj", "{D3BAED2C-4B07-4E1D-8807-9D6499450349}"
diff --git a/src/CalculatorUITestFramework/CalculatorUITestFramework.csproj b/src/CalculatorUITestFramework/CalculatorUITestFramework.csproj
index cdf0947..a068834 100644
--- a/src/CalculatorUITestFramework/CalculatorUITestFramework.csproj
+++ b/src/CalculatorUITestFramework/CalculatorUITestFramework.csproj
@@ -1,12 +1,11 @@
-
-
+
netstandard2.0
+ C:\Users\v-dapark\Source\Repos\Daniel-Parker\calculator\src\Backup\CalculatorUITestFramework\
+ 2.0
-
-
-
+
\ No newline at end of file
diff --git a/src/CalculatorUITestFramework/MemoryPanel.cs b/src/CalculatorUITestFramework/MemoryPanel.cs
index dfa24db..a02954b 100644
--- a/src/CalculatorUITestFramework/MemoryPanel.cs
+++ b/src/CalculatorUITestFramework/MemoryPanel.cs
@@ -42,7 +42,7 @@ public void OpenMemoryPanel()
///
/// Gets all of the memory items listed in the Memory Pane.
///
- /// A readonly collection of memory items.
+ /// A read-only collection of memory items.
public ReadOnlyCollection GetAllMemoryListViewItems()
{
OpenMemoryPanel();
@@ -62,6 +62,10 @@ public void ClearMemoryPanel()
{
this.PanelClearMemoryButton.Click();
}
+ else
+ {
+ return;
+ }
}
catch (WebDriverException ex)
{
@@ -70,7 +74,6 @@ public void ClearMemoryPanel()
Assert.IsNotNull(this.MemoryPaneEmptyLabel);
return;
}
-
throw;
}
}
diff --git a/src/CalculatorUITestFramework/ProgrammerCalculatorPage.cs b/src/CalculatorUITestFramework/ProgrammerCalculatorPage.cs
new file mode 100644
index 0000000..f0b1a2e
--- /dev/null
+++ b/src/CalculatorUITestFramework/ProgrammerCalculatorPage.cs
@@ -0,0 +1,54 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using OpenQA.Selenium.Appium.Windows;
+
+namespace CalculatorUITestFramework
+{
+ ///
+ /// This class contains the UI automation objects and helper methods available when the Calculator is in Scientific Mode.
+ ///
+ public class ProgrammerCalculatorPage
+ {
+ private WindowsDriver session => WinAppDriver.Instance.CalculatorSession;
+ public ScientificOperatorsPanel ScientificOperators = new ScientificOperatorsPanel();
+ public StandardOperatorsPanel StandardOperators = new StandardOperatorsPanel();
+ public ProgrammerOperatorsPanel ProgrammerOperators = new ProgrammerOperatorsPanel();
+ public MemoryPanel MemoryPanel = new MemoryPanel();
+ public HistoryPanel HistoryPanel = new HistoryPanel();
+ public NavigationMenu NavigationMenu = new NavigationMenu();
+ public WindowsElement Header => this.session.TryFindElementByAccessibilityId("Header");
+
+ public CalculatorResults CalculatorResults = new CalculatorResults();
+
+ public void NavigateToProgrammerCalculator()
+ {
+ // Ensure that calculator is in scientific mode
+ NavigationMenu.ChangeCalculatorMode(CalculatorMode.ProgrammerCalculator);
+ }
+
+ ///
+ /// Clear the Calculator display, Memory Panel and optionally the History Panel
+ ///
+ public void ClearAll()
+ {
+ string source = this.session.PageSource;
+
+ if (source.Contains("clearEntryButton"))
+ {
+ StandardOperators.ClearEntryButton.Click();
+ StandardOperators.ClearButton.Click();
+ }
+ if (source.Contains("clearButton"))
+ {
+ StandardOperators.ClearButton.Click();
+ }
+ MemoryPanel.ResizeWindowToDisplayMemoryLabel();
+ if (source.Contains("ClearMemory"))
+ {
+ MemoryPanel.NumberpadMCButton.Click();
+ }
+ }
+ }
+}
diff --git a/src/CalculatorUITestFramework/ProgrammerOperatorsPanel.cs b/src/CalculatorUITestFramework/ProgrammerOperatorsPanel.cs
new file mode 100644
index 0000000..1e23a44
--- /dev/null
+++ b/src/CalculatorUITestFramework/ProgrammerOperatorsPanel.cs
@@ -0,0 +1,202 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using OpenQA.Selenium;
+using OpenQA.Selenium.Appium.Windows;
+using System.Collections.Generic;
+using System.Diagnostics.Contracts;
+using System.Runtime.InteropServices.ComTypes;
+using System;
+using System.Diagnostics;
+
+namespace CalculatorUITestFramework
+{
+ ///
+ /// UI elements unique to programmer mode
+ ///
+ public class ProgrammerOperatorsPanel
+ {
+ private WindowsDriver session => WinAppDriver.Instance.CalculatorSession;
+ public NumberPad NumberPad = new NumberPad();
+
+ public WindowsElement HexButton => this.session.TryFindElementByAccessibilityId("hexButton");
+ public WindowsElement DecButton => this.session.TryFindElementByAccessibilityId("decimalButton");
+ public WindowsElement OctButton => this.session.TryFindElementByAccessibilityId("octolButton");
+ public WindowsElement BinButton => this.session.TryFindElementByAccessibilityId("binaryButton");
+ public WindowsElement FullKeypad => this.session.TryFindElementByAccessibilityId("fullKeypad");
+ public WindowsElement BitFlip => this.session.TryFindElementByAccessibilityId("bitFlip");
+ public WindowsElement WordButton => this.session.TryFindElementByAccessibilityId("wordButton");
+ public WindowsElement QWordButton => this.session.TryFindElementByAccessibilityId("qwordButton");
+ public WindowsElement DWordButton => this.session.TryFindElementByAccessibilityId("dwordButton");
+ public WindowsElement ByteButton => this.session.TryFindElementByAccessibilityId("byteButton");
+ public WindowsElement BitwiseButton => this.session.TryFindElementByAccessibilityId("bitwiseButton");
+ public WindowsElement BitShiftButton => this.session.TryFindElementByAccessibilityId("bitShiftButton");
+ public WindowsElement AndButton => this.session.TryFindElementByAccessibilityId("andButton");
+ public WindowsElement NandButton => this.session.TryFindElementByAccessibilityId("nandButton");
+ public WindowsElement OrButton => this.session.TryFindElementByAccessibilityId("orButton");
+ public WindowsElement NorButton => this.session.TryFindElementByAccessibilityId("norButton");
+ public WindowsElement NotButton => this.session.TryFindElementByAccessibilityId("notButton");
+ public WindowsElement XorButton => this.session.TryFindElementByAccessibilityId("xorButton");
+ public WindowsElement ArithmeticShiftButton => this.session.TryFindElementByAccessibilityId("arithmeticShiftButton");
+ public WindowsElement LogicalShiftButton => this.session.TryFindElementByAccessibilityId("logicalShiftButton");
+ public WindowsElement RotateCircularButton => this.session.TryFindElementByAccessibilityId("rotateCircularButton");
+ public WindowsElement RotateCarryShiftButton => this.session.TryFindElementByAccessibilityId("rotateCarryShiftButton");
+ public WindowsElement AButton => this.session.TryFindElementByAccessibilityId("aButton");
+ public WindowsElement BButton => this.session.TryFindElementByAccessibilityId("bButton");
+ public WindowsElement CButton => this.session.TryFindElementByAccessibilityId("cButton");
+ public WindowsElement DButton => this.session.TryFindElementByAccessibilityId("dButton");
+ public WindowsElement EButton => this.session.TryFindElementByAccessibilityId("eButton");
+ public WindowsElement FButton => this.session.TryFindElementByAccessibilityId("fButton");
+ public WindowsElement LeftShiftButton => this.session.TryFindElementByAccessibilityId("lshButton");
+ public WindowsElement RightShiftButton => this.session.TryFindElementByAccessibilityId("rshButton");
+ public WindowsElement LeftShiftLogicalButton => this.session.TryFindElementByAccessibilityId("lshLogicalButton");
+ public WindowsElement RightShiftLogicalButton => this.session.TryFindElementByAccessibilityId("rshLogicalButton");
+ public WindowsElement RoLButton => this.session.TryFindElementByAccessibilityId("rolButton");
+ public WindowsElement RoRButton => this.session.TryFindElementByAccessibilityId("rorButton");
+ public WindowsElement RoRCarryButton => this.session.TryFindElementByAccessibilityId("rorCarryButton");
+ public WindowsElement Bit0 => this.session.TryFindElementByAccessibilityId("Bit0");
+ public WindowsElement Bit1 => this.session.TryFindElementByAccessibilityId("Bit1");
+ public WindowsElement Bit2 => this.session.TryFindElementByAccessibilityId("Bit2");
+ public WindowsElement Bit3 => this.session.TryFindElementByAccessibilityId("Bit3");
+ public WindowsElement Bit4 => this.session.TryFindElementByAccessibilityId("Bit4");
+ public WindowsElement Bit5 => this.session.TryFindElementByAccessibilityId("Bit5");
+ public WindowsElement Bit6 => this.session.TryFindElementByAccessibilityId("Bit6");
+ public WindowsElement Bit7 => this.session.TryFindElementByAccessibilityId("Bit7");
+ public WindowsElement Bit8 => this.session.TryFindElementByAccessibilityId("Bit8");
+ public WindowsElement Bit9 => this.session.TryFindElementByAccessibilityId("Bit9");
+ public WindowsElement Bit10 => this.session.TryFindElementByAccessibilityId("Bit10");
+ public WindowsElement Bit11 => this.session.TryFindElementByAccessibilityId("Bit11");
+ public WindowsElement Bit12 => this.session.TryFindElementByAccessibilityId("Bit12");
+ public WindowsElement Bit13 => this.session.TryFindElementByAccessibilityId("Bit13");
+ public WindowsElement Bit14 => this.session.TryFindElementByAccessibilityId("Bit14");
+ public WindowsElement Bit15 => this.session.TryFindElementByAccessibilityId("Bit15");
+ public WindowsElement Bit16 => this.session.TryFindElementByAccessibilityId("Bit16");
+ public WindowsElement Bit17 => this.session.TryFindElementByAccessibilityId("Bit17");
+ public WindowsElement Bit18 => this.session.TryFindElementByAccessibilityId("Bit18");
+ public WindowsElement Bit19 => this.session.TryFindElementByAccessibilityId("Bit19");
+ public WindowsElement Bit20 => this.session.TryFindElementByAccessibilityId("Bit20");
+ public WindowsElement Bit21 => this.session.TryFindElementByAccessibilityId("Bit21");
+ public WindowsElement Bit22 => this.session.TryFindElementByAccessibilityId("Bit22");
+ public WindowsElement Bit23 => this.session.TryFindElementByAccessibilityId("Bit23");
+ public WindowsElement Bit24 => this.session.TryFindElementByAccessibilityId("Bit24");
+ public WindowsElement Bit25 => this.session.TryFindElementByAccessibilityId("Bit25");
+ public WindowsElement Bit26 => this.session.TryFindElementByAccessibilityId("Bit26");
+ public WindowsElement Bit27 => this.session.TryFindElementByAccessibilityId("Bit27");
+ public WindowsElement Bit28 => this.session.TryFindElementByAccessibilityId("Bit28");
+ public WindowsElement Bit29 => this.session.TryFindElementByAccessibilityId("Bit29");
+ public WindowsElement Bit30 => this.session.TryFindElementByAccessibilityId("Bit30");
+ public WindowsElement Bit31 => this.session.TryFindElementByAccessibilityId("Bit31");
+ public WindowsElement Bit32 => this.session.TryFindElementByAccessibilityId("Bit32");
+ public WindowsElement Bit33 => this.session.TryFindElementByAccessibilityId("Bit33");
+ public WindowsElement Bit34 => this.session.TryFindElementByAccessibilityId("Bit34");
+ public WindowsElement Bit35 => this.session.TryFindElementByAccessibilityId("Bit35");
+ public WindowsElement Bit36 => this.session.TryFindElementByAccessibilityId("Bit36");
+ public WindowsElement Bit37 => this.session.TryFindElementByAccessibilityId("Bit37");
+ public WindowsElement Bit38 => this.session.TryFindElementByAccessibilityId("Bit38");
+ public WindowsElement Bit39 => this.session.TryFindElementByAccessibilityId("Bit39");
+ public WindowsElement Bit40 => this.session.TryFindElementByAccessibilityId("Bit40");
+ public WindowsElement Bit41 => this.session.TryFindElementByAccessibilityId("Bit41");
+ public WindowsElement Bit42 => this.session.TryFindElementByAccessibilityId("Bit42");
+ public WindowsElement Bit43 => this.session.TryFindElementByAccessibilityId("Bit43");
+ public WindowsElement Bit44 => this.session.TryFindElementByAccessibilityId("Bit44");
+ public WindowsElement Bit45 => this.session.TryFindElementByAccessibilityId("Bit45");
+ public WindowsElement Bit46 => this.session.TryFindElementByAccessibilityId("Bit46");
+ public WindowsElement Bit47 => this.session.TryFindElementByAccessibilityId("Bit47");
+ public WindowsElement Bit48 => this.session.TryFindElementByAccessibilityId("Bit48");
+ public WindowsElement Bit49 => this.session.TryFindElementByAccessibilityId("Bit49");
+ public WindowsElement Bit50 => this.session.TryFindElementByAccessibilityId("Bit50");
+ public WindowsElement Bit51 => this.session.TryFindElementByAccessibilityId("Bit51");
+ public WindowsElement Bit52 => this.session.TryFindElementByAccessibilityId("Bit52");
+ public WindowsElement Bit53 => this.session.TryFindElementByAccessibilityId("Bit53");
+ public WindowsElement Bit54 => this.session.TryFindElementByAccessibilityId("Bit54");
+ public WindowsElement Bit55 => this.session.TryFindElementByAccessibilityId("Bit55");
+ public WindowsElement Bit56 => this.session.TryFindElementByAccessibilityId("Bit56");
+ public WindowsElement Bit57 => this.session.TryFindElementByAccessibilityId("Bit57");
+ public WindowsElement Bit58 => this.session.TryFindElementByAccessibilityId("Bit58");
+ public WindowsElement Bit59 => this.session.TryFindElementByAccessibilityId("Bit59");
+ public WindowsElement Bit60 => this.session.TryFindElementByAccessibilityId("Bit60");
+ public WindowsElement Bit61 => this.session.TryFindElementByAccessibilityId("Bit61");
+ public WindowsElement Bit62 => this.session.TryFindElementByAccessibilityId("Bit62");
+ public WindowsElement Bit63 => this.session.TryFindElementByAccessibilityId("Bit63");
+
+ public void SetArithmeticShift()
+ {
+ BitShiftButton.Click();
+ if (this.ArithmeticShiftButton.GetAttribute("isEnabled") != "True")
+ {
+ ArithmeticShiftButton.Click();
+ }
+ else
+ {
+ BitShiftButton.Click();
+ }
+ }
+ public void SetLogicalShift()
+ {
+ BitShiftButton.Click();
+ if (this.LogicalShiftButton.GetAttribute("isEnabled") != "True")
+ {
+ LogicalShiftButton.Click();
+ }
+ else
+ {
+ BitShiftButton.Click();
+ }
+ }
+ public void SetRotateCircularShift()
+ {
+ BitShiftButton.Click();
+ if (this.RotateCircularButton.GetAttribute("isEnabled") != "True")
+ {
+ RotateCircularButton.Click();
+ }
+ else
+ {
+ BitShiftButton.Click();
+ }
+ }
+ public void SetRotateThroughCarryCircularShift()
+ {
+ BitShiftButton.Click();
+ if (this.RotateCarryShiftButton.GetAttribute("isEnabled") != "True")
+ {
+ RotateCarryShiftButton.Click();
+ }
+ else
+ {
+ BitShiftButton.Click();
+ }
+ }
+ public void ResetWordSize()
+ {
+ string source = this.session.PageSource;
+ if (source.Contains("qwordButton"))
+ {
+ return;
+ }
+ else if (source.Contains("dwordButton"))
+ {
+ DWordButton.Click();
+ WordButton.Click();
+ ByteButton.Click();
+ }
+ else if (source.Contains("wordButton"))
+ {
+ WordButton.Click();
+ ByteButton.Click();
+ }
+ else if (source.Contains("byteButton"))
+ {
+ ByteButton.Click();
+ }
+ else
+ {
+ throw new NotFoundException("Could not find word size buttons in page source");
+ }
+ }
+ public void ResetNumberSystem()
+ {
+ DecButton.Click();
+ }
+ }
+}
diff --git a/src/CalculatorUITestFramework/ScientificCalculatorPage.cs b/src/CalculatorUITestFramework/ScientificCalculatorPage.cs
new file mode 100644
index 0000000..28943e5
--- /dev/null
+++ b/src/CalculatorUITestFramework/ScientificCalculatorPage.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using OpenQA.Selenium.Appium.Windows;
+
+namespace CalculatorUITestFramework
+{
+ ///
+ /// This class contains the UI automation objects and helper methods available when the Calculator is in Scientific Mode.
+ ///
+ public class ScientificCalculatorPage
+ {
+ private WindowsDriver session => WinAppDriver.Instance.CalculatorSession;
+ public ScientificOperatorsPanel ScientificOperators = new ScientificOperatorsPanel();
+ public StandardOperatorsPanel StandardOperators = new StandardOperatorsPanel();
+ public MemoryPanel MemoryPanel = new MemoryPanel();
+ public HistoryPanel HistoryPanel = new HistoryPanel();
+ public NavigationMenu NavigationMenu = new NavigationMenu();
+ public WindowsElement Header => this.session.TryFindElementByAccessibilityId("Header");
+
+ public CalculatorResults CalculatorResults = new CalculatorResults();
+
+ public void NavigateToScientificCalculator()
+ {
+ // Ensure that calculator is in scientific mode
+ this.NavigationMenu.ChangeCalculatorMode(CalculatorMode.ScientificCalculator);
+ }
+
+ ///
+ /// Clear the Calculator display, Memory Panel and optionally the History Panel
+ ///
+ public void ClearAll()
+ {
+ string source = this.session.PageSource;
+
+ if (source.Contains("clearEntryButton"))
+ {
+ this.StandardOperators.ClearEntryButton.Click();
+ source = this.session.PageSource;
+ }
+ if (source.Contains("clearButton"))
+ {
+ this.StandardOperators.ClearButton.Click();
+ }
+ MemoryPanel.ResizeWindowToDisplayMemoryLabel();
+ HistoryPanel.ClearHistory();
+ }
+ }
+}
diff --git a/src/CalculatorUITestFramework/ScientificOperatorsPanel.cs b/src/CalculatorUITestFramework/ScientificOperatorsPanel.cs
new file mode 100644
index 0000000..15776d0
--- /dev/null
+++ b/src/CalculatorUITestFramework/ScientificOperatorsPanel.cs
@@ -0,0 +1,167 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using OpenQA.Selenium;
+using OpenQA.Selenium.Appium.Windows;
+using System.Collections.Generic;
+using System.Diagnostics.Contracts;
+using System.Runtime.InteropServices.ComTypes;
+using System;
+using System.Diagnostics;
+
+namespace CalculatorUITestFramework
+{
+ public enum AngleOperatorState
+ {
+ Degrees,
+ Radians,
+ Gradians
+ }
+
+ public enum fEButtonState
+ {
+ Normal,
+ Exponential
+ }
+
+ ///
+ /// UI elements unique to Scientific mode
+ ///
+ public class ScientificOperatorsPanel
+ {
+ private WindowsDriver session => WinAppDriver.Instance.CalculatorSession;
+ public WindowsElement XPower3Button => this.session.TryFindElementByAccessibilityId("xpower3Button");
+ public WindowsElement XPowerYButton => this.session.TryFindElementByAccessibilityId("powerButton");
+ public WindowsElement PowerOf10Button => this.session.TryFindElementByAccessibilityId("powerOf10Button");
+ public WindowsElement LogButton => this.session.TryFindElementByAccessibilityId("logBase10Button");
+ public WindowsElement LnButton => this.session.TryFindElementByAccessibilityId("logBaseEButton");
+ public WindowsElement PiButton => this.session.TryFindElementByAccessibilityId("piButton");
+ public WindowsElement EulerButton => this.session.TryFindElementByAccessibilityId("eulerButton");
+ public WindowsElement AbsButton => this.session.TryFindElementByAccessibilityId("absButton");
+ public WindowsElement ExpButton => this.session.TryFindElementByAccessibilityId("expButton");
+ public WindowsElement ModButton => this.session.TryFindElementByAccessibilityId("modButton");
+ public WindowsElement ParenthesisLeftButton => this.session.TryFindElementByAccessibilityId("openParenthesisButton");
+ public WindowsElement ParenthesisRightButton => this.session.TryFindElementByAccessibilityId("closeParenthesisButton");
+ public WindowsElement FactorialButton => this.session.TryFindElementByAccessibilityId("factorialButton");
+ public WindowsElement BackSpaceButton => this.session.TryFindElementByAccessibilityId("backSpaceButton");
+ public WindowsElement DegButton => this.session.TryFindElementByAccessibilityId("degButton");
+ public WindowsElement RadButton => this.session.TryFindElementByAccessibilityId("radButton");
+ public WindowsElement GradButton => this.session.TryFindElementByAccessibilityId("gradButton");
+ public WindowsElement AngleOperator => this.session.TryFindElementByAccessibilityId("ScientificAngleOperators");
+ public WindowsElement TrigButton => this.session.TryFindElementByAccessibilityId("trigButton");
+ public WindowsElement FuncButton => this.session.TryFindElementByAccessibilityId("funcButton");
+ public WindowsElement SinButton => this.session.TryFindElementByAccessibilityId("sinButton");
+ public WindowsElement CosButton => this.session.TryFindElementByAccessibilityId("cosButton");
+ public WindowsElement TanButton => this.session.TryFindElementByAccessibilityId("tanButton");
+ public WindowsElement CscButton => this.session.TryFindElementByAccessibilityId("cscButton");
+ public WindowsElement SecButton => this.session.TryFindElementByAccessibilityId("secButton");
+ public WindowsElement CotButton => this.session.TryFindElementByAccessibilityId("cotButton");
+ public WindowsElement TrigShiftButton => this.session.TryFindElementByAccessibilityId("trigShiftButton");
+ public WindowsElement HypShiftButton => this.session.TryFindElementByAccessibilityId("hypShiftButton");
+ public WindowsElement InvSinButton => this.session.TryFindElementByAccessibilityId("invsinButton");
+ public WindowsElement InvCosButton => this.session.TryFindElementByAccessibilityId("invcosButton");
+ public WindowsElement InvTanButton => this.session.TryFindElementByAccessibilityId("invtanButton");
+ public WindowsElement InvCscButton => this.session.TryFindElementByAccessibilityId("invcscButton");
+ public WindowsElement InvSecButton => this.session.TryFindElementByAccessibilityId("invsecButton");
+ public WindowsElement InvCotButton => this.session.TryFindElementByAccessibilityId("invcotButton");
+ public WindowsElement SinhButton => this.session.TryFindElementByAccessibilityId("sinhButton");
+ public WindowsElement CoshButton => this.session.TryFindElementByAccessibilityId("coshButton");
+ public WindowsElement TanhButton => this.session.TryFindElementByAccessibilityId("tanhButton");
+ public WindowsElement CschButton => this.session.TryFindElementByAccessibilityId("cschButton");
+ public WindowsElement SechButton => this.session.TryFindElementByAccessibilityId("sechButton");
+ public WindowsElement CothButton => this.session.TryFindElementByAccessibilityId("cothButton");
+ public WindowsElement InvSinhButton => this.session.TryFindElementByAccessibilityId("invsinhButton");
+ public WindowsElement InvCoshButton => this.session.TryFindElementByAccessibilityId("invcoshButton");
+ public WindowsElement InvTanhButton => this.session.TryFindElementByAccessibilityId("invtanhButton");
+ public WindowsElement InvCschButton => this.session.TryFindElementByAccessibilityId("invcschButton");
+ public WindowsElement InvSechButton => this.session.TryFindElementByAccessibilityId("invsechButton");
+ public WindowsElement InvCothButton => this.session.TryFindElementByAccessibilityId("invcothButton");
+ public WindowsElement FloorButton => this.session.TryFindElementByAccessibilityId("floorButton");
+ public WindowsElement CeilButton => this.session.TryFindElementByAccessibilityId("ceilButton");
+ public WindowsElement RandButton => this.session.TryFindElementByAccessibilityId("randButton");
+ public WindowsElement DmsButton => this.session.TryFindElementByAccessibilityId("dmsButton");
+ public WindowsElement DegreesButton => this.session.TryFindElementByAccessibilityId("degreesButton");
+ public WindowsElement FixedToExponentialButton => this.session.TryFindElementByAccessibilityId("ftoeButton");
+ public WindowsElement NegateButton => this.session.TryFindElementByAccessibilityId("negateButton");
+ public WindowsElement TrigFlyout => this.session.TryFindElementByAccessibilityId("Trigflyout");
+ public WindowsElement LightDismiss => this.session.TryFindElementByAccessibilityId("Light Dismiss");
+ private WindowsElement DegRadGradButton => GetAngleOperatorButton();
+ private WindowsElement GetAngleOperatorButton()
+ {
+ string source = this.session.PageSource;
+ if (source.Contains("degButton"))
+ {
+ return DegButton;
+ }
+ else if (source.Contains("gradButton"))
+ {
+ return GradButton;
+ }
+ else if (source.Contains("radButton"))
+ {
+ return RadButton;
+ }
+
+ throw new NotFoundException("Could not find deg, rad or grad button in page source");
+ }
+
+ ///
+ /// Set the state of the degrees, radians and gradians buttons.
+ ///
+ public void SetAngleOperator(AngleOperatorState value)
+ {
+ //set the desired string value for the button
+ string desiredId;
+ switch (value)
+ {
+ case AngleOperatorState.Degrees:
+ desiredId = "degButton";
+ break;
+ case AngleOperatorState.Gradians:
+ desiredId = "gradButton";
+ break;
+ case AngleOperatorState.Radians:
+ desiredId = "radButton";
+ break;
+ default:
+ throw new NotImplementedException();
+ }
+ while (this.DegRadGradButton.GetAttribute("AutomationId") != desiredId)
+ {
+ this.DegRadGradButton.Click();
+ }
+ }
+
+ public void ResetFEButton(fEButtonState value)
+ {
+ if (this.FixedToExponentialButton.GetAttribute("Toggle.ToggleState") != "0")
+ {
+ FixedToExponentialButton.Click();
+ }
+ }
+
+ public WindowsElement ResetTrigDropdownToggles()
+ {
+ TrigButton.Click();
+ string source = this.session.PageSource;
+ if (source.Contains("sinButton"))
+ {
+ LightDismiss.Click();
+ }
+ else if (source.Contains("invsinButton"))
+ {
+ TrigShiftButton.Click();
+ }
+ else if (source.Contains("sinhButton"))
+ {
+ HypShiftButton.Click();
+ }
+ else if (source.Contains("invsinhButton"))
+ {
+ TrigShiftButton.Click();
+ HypShiftButton.Click();
+ }
+ throw new NotFoundException("Could not find trig drop-down buttons in page source");
+ }
+ }
+}
diff --git a/src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs b/src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs
index 66cea0f..1a4070e 100644
--- a/src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs
+++ b/src/CalculatorUITestFramework/StandardAoTCalculatorPage.cs
@@ -160,5 +160,43 @@ private void GrowWindowToShowInvertButton(int height)
GrowWindowToShowInvertButton(width + 100);
}
}
+ ///
+ /// If the Invert button is not displayed, resize the window
+ /// Two attempts are made, the the button is not found a "not found" exception is thrown
+ ///
+ public void ResizeAoTWindowToDiplayInvertButton()
+ {
+ Point newWindowPostion = new Point(8, 8);
+ WinAppDriver.Instance.CalculatorSession.Manage().Window.Position = newWindowPostion;
+ string source0 = this.session.PageSource;
+ if (source0.Contains("invertButton"))
+ {
+ return;
+ }
+ else
+ {
+ Size newWindowSize = new Size(502, 502);
+ WinAppDriver.Instance.CalculatorSession.Manage().Window.Size = newWindowSize;
+ string source1 = this.session.PageSource;
+ if (source1.Contains("invertButton"))
+ {
+ return;
+ }
+ else
+ {
+ Size newWindowSize2 = new Size(750, 750);
+ WinAppDriver.Instance.CalculatorSession.Manage().Window.Size = newWindowSize2;
+ }
+ string source2 = this.session.PageSource;
+ if (source2.Contains("invertButton"))
+ {
+ return;
+ }
+ else
+ {
+ throw new NotFoundException("Could not find the Invert Button");
+ }
+ }
+ }
}
}
diff --git a/src/CalculatorUITestFramework/StandardCalculatorPage.cs b/src/CalculatorUITestFramework/StandardCalculatorPage.cs
index 24b249b..72439b5 100644
--- a/src/CalculatorUITestFramework/StandardCalculatorPage.cs
+++ b/src/CalculatorUITestFramework/StandardCalculatorPage.cs
@@ -75,6 +75,7 @@ public void EnsureCalculatorIsInStandardMode()
this.StandardAoTCalculatorPage.NavigateToStandardMode();
}
}
+
}
}
diff --git a/src/CalculatorUITestFramework/StandardOperatorsPanel.cs b/src/CalculatorUITestFramework/StandardOperatorsPanel.cs
index d0eb8d3..20562e6 100644
--- a/src/CalculatorUITestFramework/StandardOperatorsPanel.cs
+++ b/src/CalculatorUITestFramework/StandardOperatorsPanel.cs
@@ -27,6 +27,5 @@ public class StandardOperatorsPanel
public WindowsElement ClearButton => this.session.TryFindElementByAccessibilityId("clearButton");
public WindowsElement BackSpaceButton => this.session.TryFindElementByAccessibilityId("backSpaceButton");
public WindowsElement NegateButton => this.session.TryFindElementByAccessibilityId("negateButton");
-
}
}
diff --git a/src/CalculatorUITestFramework/WinAppDriver.cs b/src/CalculatorUITestFramework/WinAppDriver.cs
index 0c62844..bf61f4d 100644
--- a/src/CalculatorUITestFramework/WinAppDriver.cs
+++ b/src/CalculatorUITestFramework/WinAppDriver.cs
@@ -12,6 +12,7 @@ namespace CalculatorUITestFramework
public sealed class WinAppDriver
{
private WindowsDriverLocalService windowsDriverService = null;
+ public MemoryPanel MemoryPanel = new MemoryPanel();
private const string defaultAppId = "Microsoft.WindowsCalculator.Dev_8wekyb3d8bbwe!App";
private static WinAppDriver instance = null;
public static WinAppDriver Instance
diff --git a/src/CalculatorUITests/CalculatorUITests.csproj b/src/CalculatorUITests/CalculatorUITests.csproj
index 33289c8..dd32bf8 100644
--- a/src/CalculatorUITests/CalculatorUITests.csproj
+++ b/src/CalculatorUITests/CalculatorUITests.csproj
@@ -1,22 +1,19 @@
-
-
+
netcoreapp2.1
-
false
+ C:\Users\v-dapark\Source\Repos\Daniel-Parker\calculator\src\Backup\CalculatorUITests\
+ 2.0
-
-
-
PreserveNewest
@@ -25,5 +22,4 @@
PreserveNewest
-
-
+
\ No newline at end of file
diff --git a/src/CalculatorUITests/ProgrammerModeFunctionalTests.cs b/src/CalculatorUITests/ProgrammerModeFunctionalTests.cs
new file mode 100644
index 0000000..5754085
--- /dev/null
+++ b/src/CalculatorUITests/ProgrammerModeFunctionalTests.cs
@@ -0,0 +1,892 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using CalculatorUITestFramework;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using OpenQA.Selenium;
+using OpenQA.Selenium.Appium.Windows;
+using System;
+using System.Collections.Generic;
+
+namespace CalculatorUITests
+{
+ [TestClass]
+ public class ProgrammerModeFunctionalTests
+ {
+ private static ProgrammerCalculatorPage page = new ProgrammerCalculatorPage();
+
+ ///
+ /// Initializes the WinAppDriver web driver session.
+ ///
+ ///
+ [ClassInitialize]
+ public static void ClassInitialize(TestContext context)
+ {
+ // Create session to launch a Calculator window
+ WinAppDriver.Instance.SetupCalculatorSession(context);
+
+ // Ensure that calculator is in programmer mode
+ page.NavigateToProgrammerCalculator();
+
+ // Ensure that calculator window is large enough to display the memory/history panel; a good size for most tests
+ page.MemoryPanel.ResizeWindowToDisplayMemoryLabel();
+ }
+
+ ///
+ /// Closes the app and WinAppDriver web driver session.
+ ///
+ [ClassCleanup]
+ public static void ClassCleanup()
+ {
+ // Tear down Calculator session.
+ WinAppDriver.Instance.TearDownCalculatorSession();
+ }
+
+ ///
+ /// Ensures the calculator is in a cleared state with the correct default options
+ ///
+ [TestInitialize]
+ public void TestInit()
+ {
+ if ("0" != page.CalculatorResults.GetCalculatorResultText())
+ {
+ page.ClearAll();
+ }
+ CalculatorApp.EnsureCalculatorHasFocus();
+ page.ProgrammerOperators.SetArithmeticShift();
+ page.ProgrammerOperators.ResetWordSize();
+ page.ProgrammerOperators.ResetNumberSystem();
+ }
+
+ [TestCleanup]
+ public void TestCleanup()
+ {
+ page.ClearAll();
+ }
+
+ ///
+ /// Arithmetic shift, decimal notation, QWord
+ ///
+ #region Smoke Tests
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Arithmetic_Decimal_LeftShift()
+ {
+ page.StandardOperators.NumberPad.Input(5);
+ page.ProgrammerOperators.LeftShiftButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("10", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Arithmetic_Decimal_RightShift()
+ {
+ page.StandardOperators.NumberPad.Input(25);
+ page.StandardOperators.NegateButton.Click();
+ page.ProgrammerOperators.RightShiftButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("-13", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Arithmetic_Decimal_And()
+ {
+ page.StandardOperators.NumberPad.Input(25);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.AndButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Arithmetic_Decimal_Nand()
+ {
+ page.StandardOperators.NumberPad.Input(25);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NandButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("-2", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Arithmetic_Decimal_Or()
+ {
+ page.StandardOperators.NumberPad.Input(25);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.OrButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("31", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Arithmetic_Decimal_Nor()
+ {
+ page.StandardOperators.NumberPad.Input(25);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NorButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("-32", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Arithmetic_Decimal_Not()
+ {
+ page.StandardOperators.NumberPad.Input(25);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NotButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("-26", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Arithmetic_Decimal_Xor()
+ {
+ page.StandardOperators.NumberPad.Input(25);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.XorButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("30", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Checks for the highest value bit that should be enabled according to the Word size setting
+ ///
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_WordSize()
+ {
+ page.ProgrammerOperators.BitFlip.Click();
+ if (page.ProgrammerOperators.Bit63.GetAttribute("IsEnabled") != "True")
+ {
+ throw new NotFoundException("According to the current Word size setting, some bits that should be enabled are disabled");
+ }
+ else
+ {
+ page.ProgrammerOperators.QWordButton.Click();
+ if (page.ProgrammerOperators.Bit31.GetAttribute("IsEnabled") != "True")
+ {
+ throw new NotFoundException("According to the current Word size setting, some bits that should be enabled are disabled");
+ }
+ else
+ {
+ page.ProgrammerOperators.DWordButton.Click();
+ if (page.ProgrammerOperators.Bit15.GetAttribute("IsEnabled") != "True")
+ {
+ throw new NotFoundException("According to the current Word size setting, some bits that should be enabled are disabled");
+ }
+ else
+ {
+ page.ProgrammerOperators.WordButton.Click();
+ if (page.ProgrammerOperators.Bit7.GetAttribute("IsEnabled") != "True")
+ {
+ throw new NotFoundException("According to the current Word size setting, some bits that should be enabled are disabled");
+ }
+ else
+ {
+ page.ProgrammerOperators.ByteButton.Click();
+ if (page.ProgrammerOperators.Bit63.GetAttribute("IsEnabled") != "True")
+ {
+ throw new NotFoundException("According to the current Word size setting, some bits that should be enabled are disabled");
+ }
+ }
+ }
+ }
+ page.ProgrammerOperators.FullKeypad.Click();
+ }
+ }
+
+
+ ///
+ /// Toggles each bit on and off
+ ///
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_BitFlipKeypad()
+ {
+ page.ProgrammerOperators.BitFlip.Click();
+ page.ProgrammerOperators.Bit63.Click();
+ Assert.AreEqual("-9,223,372,036,854,775,808", page.CalculatorResults.GetCalculatorResultText());
+ page.ProgrammerOperators.FullKeypad.Click();
+ }
+ #endregion
+
+ ///
+ /// Arithmetic shift, octal notation, QWord
+ ///
+ #region Arithmetic logic operators
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Octal_LeftShift()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.ProgrammerOperators.LeftShiftButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 6", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Octal_RightShift()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.StandardOperators.NumberPad.Input(25);
+ page.StandardOperators.NegateButton.Click();
+ page.ProgrammerOperators.RightShiftButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 5", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Octal_And()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.StandardOperators.NumberPad.Input(16);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.AndButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("6", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Octal_Nand()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.StandardOperators.NumberPad.Input(16);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NandButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Octal_Or()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.StandardOperators.NumberPad.Input(16);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.OrButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 7", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Octal_Nor()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.StandardOperators.NumberPad.Input(16);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NorButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Octal_Not()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.StandardOperators.NumberPad.Input(16);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NotButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Octal_Xor()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.StandardOperators.NumberPad.Input(16);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.XorButton.Click();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Arithmetic shift, binary notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Binary_LeftShift()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.LeftShiftButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 0 1 0 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Binary_RightShift()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.RightShiftButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 0 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Binary_And()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.AndButton.Click();
+ page.StandardOperators.NumberPad.Input(1000);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 0 0 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Binary_Nand()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NandButton.Click();
+ page.StandardOperators.NumberPad.Input(1000);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Binary_Or()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.OrButton.Click();
+ page.StandardOperators.NumberPad.Input(1100);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 1 1 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Binary_Nor()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NorButton.Click();
+ page.StandardOperators.NumberPad.Input(1100);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Binary_Not()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NotButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Binary_Xor()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.XorButton.Click();
+ page.StandardOperators.NumberPad.Input(1100);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 1 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Arithmetic shift, hexadecimal notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Hex_LeftShift()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.AButton.Click();
+ page.ProgrammerOperators.LeftShiftButton.Click();
+ page.ProgrammerOperators.BButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("5 0 0 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Hex_RightShift()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.FButton.Click();
+ page.ProgrammerOperators.RightShiftButton.Click();
+ page.StandardOperators.NumberPad.Input(2);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("3", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Hex_And()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.AButton.Click();
+ page.ProgrammerOperators.BButton.Click();
+ page.ProgrammerOperators.CButton.Click();
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.AndButton.Click();
+ page.ProgrammerOperators.FButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("C", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Hex_Nand()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.AButton.Click();
+ page.ProgrammerOperators.BButton.Click();
+ page.ProgrammerOperators.CButton.Click();
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NandButton.Click();
+ page.ProgrammerOperators.FButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("F F F F F F F F F F F F F F F 3", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Hex_Or()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.AButton.Click();
+ page.ProgrammerOperators.BButton.Click();
+ page.ProgrammerOperators.CButton.Click();
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.OrButton.Click();
+ page.ProgrammerOperators.FButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("A B F", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Hex_Nor()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.AButton.Click();
+ page.ProgrammerOperators.BButton.Click();
+ page.ProgrammerOperators.CButton.Click();
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NorButton.Click();
+ page.ProgrammerOperators.FButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("F F F F F F F F F F F F F 5 4 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Hex_Not()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.AButton.Click();
+ page.ProgrammerOperators.BButton.Click();
+ page.ProgrammerOperators.CButton.Click();
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.NotButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("F F F F F F F F F F F F F 5 4 3", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Arithmetic_Operator_Hex_Xor()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.AButton.Click();
+ page.ProgrammerOperators.BButton.Click();
+ page.ProgrammerOperators.CButton.Click();
+ page.ProgrammerOperators.BitwiseButton.Click();
+ page.ProgrammerOperators.XorButton.Click();
+ page.ProgrammerOperators.FButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("A B 3", page.CalculatorResults.GetCalculatorResultText());
+ }
+ #endregion
+
+ ///
+ /// Logical shift, decimal notation, QWord - AND/NAND/OR/NOR/NOT/XOR will always be the same regardless of what shift setting is selected, so the previous section should have those covered
+ ///
+ #region Logical-shift operators
+ [TestMethod]
+ [Priority(1)]
+ public void Logical_Operator_Decimal_LeftShift()
+ {
+ page.ProgrammerOperators.SetLogicalShift();
+ page.StandardOperators.NumberPad.Input(7);
+ page.ProgrammerOperators.LeftShiftLogicalButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("14", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Logical_Operator_Decimal_RightShift()
+ {
+ page.ProgrammerOperators.SetLogicalShift();
+ page.StandardOperators.NumberPad.Input(16);
+ page.StandardOperators.NegateButton.Click();
+ page.ProgrammerOperators.RightShiftLogicalButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("9,223,372,036,854,775,800", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Logical shift, octal notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void Logical_Operator_Octal_LeftShift()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.ProgrammerOperators.SetLogicalShift();
+ page.StandardOperators.NumberPad.Input(7);
+ page.ProgrammerOperators.LeftShiftLogicalButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 6", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Logical_Operator_Octal_RightShift()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.ProgrammerOperators.SetLogicalShift();
+ page.StandardOperators.NumberPad.Input(16);
+ page.StandardOperators.NegateButton.Click();
+ page.ProgrammerOperators.RightShiftLogicalButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Logical shift, binary notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void Logical_Operator_Binary_LeftShift()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.ProgrammerOperators.SetLogicalShift();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.LeftShiftLogicalButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 0 1 0 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Logical_Operator_Binary_RightShift()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.ProgrammerOperators.SetLogicalShift();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.StandardOperators.NegateButton.Click();
+ page.ProgrammerOperators.RightShiftLogicalButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.IsTrue(String.Equals(page.CalculatorResults.GetCalculatorResultText(), "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1", StringComparison.OrdinalIgnoreCase));
+ }
+
+ ///
+ /// Logical shift, hexadecimal notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void Logical_Operator_Hex_LeftShift()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.SetLogicalShift();
+ page.ProgrammerOperators.AButton.Click();
+ page.ProgrammerOperators.LeftShiftLogicalButton.Click();
+ page.ProgrammerOperators.BButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("5 0 0 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Logical_Operator_Hex_RightShift()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.SetLogicalShift();
+ page.ProgrammerOperators.FButton.Click();
+ page.StandardOperators.NegateButton.Click();
+ page.ProgrammerOperators.RightShiftLogicalButton.Click();
+ page.StandardOperators.NumberPad.Input(1);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("7 F F F F F F F F F F F F F F 8", page.CalculatorResults.GetCalculatorResultText());
+ }
+ #endregion
+
+ ///
+ /// Rotate circular shift, decimal notation, QWord
+ ///
+ #region Rotate-Circular-shift operators
+ [TestMethod]
+ [Priority(1)]
+ public void Circular_Operator_Decimal_LeftShift()
+ {
+ page.ProgrammerOperators.SetRotateCircularShift();
+ page.StandardOperators.NumberPad.Input(7);
+ page.ProgrammerOperators.RoLButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("14", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Circular_Operator_Decimal_RightShift()
+ {
+ page.ProgrammerOperators.SetRotateCircularShift();
+ page.StandardOperators.NumberPad.Input(16);
+ page.StandardOperators.NegateButton.Click();
+ page.ProgrammerOperators.RoRButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("9,223,372,036,854,775,800", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Rotate circular shift, octal notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void Circular_Operator_Octal_LeftShift()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.ProgrammerOperators.SetRotateCircularShift();
+ page.StandardOperators.NumberPad.Input(25);
+ page.ProgrammerOperators.RoLButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("5 2", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Circular_Operator_Octal_RightShift()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.ProgrammerOperators.SetRotateCircularShift();
+ page.StandardOperators.NumberPad.Input(25);
+ page.ProgrammerOperators.RoRButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Rotate circular shift, binary notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void Circular_Operator_Binary_LeftShift()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.ProgrammerOperators.SetRotateCircularShift();
+ page.StandardOperators.NumberPad.Input(1011);
+ page.ProgrammerOperators.RoLButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 0 1 1 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Circular_Operator_Binary_RightShift()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.ProgrammerOperators.SetRotateCircularShift();
+ page.StandardOperators.NumberPad.Input(1011);
+ page.ProgrammerOperators.RoRButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Rotate circular shift, hexadecimal notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void Circular_Operator_Hex_LeftShift()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.SetRotateCircularShift();
+ page.ProgrammerOperators.AButton.Click();
+ page.ProgrammerOperators.RoLButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 4", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Circular_Operator_Hex_RightShift()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.SetRotateCircularShift();
+ page.ProgrammerOperators.FButton.Click();
+ page.ProgrammerOperators.RoRButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7", page.CalculatorResults.GetCalculatorResultText());
+ }
+ #endregion
+
+ ///
+ /// Rotate through carry circular shift, decimal notation, QWord
+ ///
+ #region Rotate-Through-Carry-Circular-shift operators
+ [TestMethod]
+ [Priority(1)]
+ public void ThroughCarry_Operator_Decimal_LeftShift()
+ {
+ page.ProgrammerOperators.SetRotateThroughCarryCircularShift();
+ page.StandardOperators.NumberPad.Input(7);
+ page.StandardOperators.NegateButton.Click();
+ page.ProgrammerOperators.RoLButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("-14", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void ThroughCarry_Operator_Decimal_RightShift()
+ {
+ page.ProgrammerOperators.SetRotateThroughCarryCircularShift();
+ page.StandardOperators.NumberPad.Input(17);
+ page.ProgrammerOperators.RoRCarryButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("8", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Rotate through carry circular shift, octal notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void ThroughCarry_Operator_Octal_LeftShift()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.ProgrammerOperators.SetRotateThroughCarryCircularShift();
+ page.StandardOperators.NumberPad.Input(111);
+ page.ProgrammerOperators.RoLButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("2 2 2", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void ThroughCarry_Operator_Octal_RightShift()
+ {
+ page.ProgrammerOperators.OctButton.Click();
+ page.ProgrammerOperators.SetRotateThroughCarryCircularShift();
+ page.StandardOperators.NumberPad.Input(111);
+ page.ProgrammerOperators.RoRCarryButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("4 4", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Rotate through carry circular shift, binary notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void ThroughCarry_Operator_Binary_LeftShift()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.ProgrammerOperators.SetRotateThroughCarryCircularShift();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.RoLButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 0 1 0 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void ThroughCarry_Operator_Binary_RightShift()
+ {
+ page.ProgrammerOperators.BinButton.Click();
+ page.ProgrammerOperators.SetRotateThroughCarryCircularShift();
+ page.StandardOperators.NumberPad.Input(1011);
+ page.ProgrammerOperators.RoRCarryButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1 0 1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ ///
+ /// Rotate through carry circular shift, hexadecimal notation, QWord
+ ///
+ [TestMethod]
+ [Priority(1)]
+ public void ThroughCarry_Operator_Hex_LeftShift()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.SetRotateThroughCarryCircularShift();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.RoLButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("2 0 2 0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void ThroughCarry_Operator_Hex_RightShift()
+ {
+ page.ProgrammerOperators.HexButton.Click();
+ page.ProgrammerOperators.SetRotateThroughCarryCircularShift();
+ page.StandardOperators.NumberPad.Input(1010);
+ page.ProgrammerOperators.RoRCarryButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("8 0 8", page.CalculatorResults.GetCalculatorResultText());
+ }
+ #endregion
+ }
+}
diff --git a/src/CalculatorUITests/ScientificModeFunctionalTests.cs b/src/CalculatorUITests/ScientificModeFunctionalTests.cs
new file mode 100644
index 0000000..837f031
--- /dev/null
+++ b/src/CalculatorUITests/ScientificModeFunctionalTests.cs
@@ -0,0 +1,621 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using CalculatorUITestFramework;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using OpenQA.Selenium;
+using OpenQA.Selenium.Appium.Windows;
+using System;
+using System.Collections.Generic;
+
+namespace CalculatorUITests
+{
+ [TestClass]
+ public class ScientificModeFunctionalTests
+ {
+ private static ScientificCalculatorPage page = new ScientificCalculatorPage();
+
+ ///
+ /// Initializes the WinAppDriver web driver session.
+ ///
+ ///
+ [ClassInitialize]
+ public static void ClassInitialize(TestContext context)
+ {
+ // Create session to launch a Calculator window
+ WinAppDriver.Instance.SetupCalculatorSession(context);
+
+ // Ensure that calculator is in scientific mode
+ page.NavigateToScientificCalculator();
+
+ // Ensure that calculator window is large enough to display the memory/history panel; a good size for most tests
+ page.MemoryPanel.ResizeWindowToDisplayMemoryLabel();
+ }
+
+ ///
+ /// Closes the app and WinAppDriver web driver session.
+ ///
+ [ClassCleanup]
+ public static void ClassCleanup()
+ {
+ // Tear down Calculator session.
+ WinAppDriver.Instance.TearDownCalculatorSession();
+ }
+
+ ///
+ /// Ensures the calculator is in a cleared state
+ ///
+ [TestInitialize]
+ public void TestInit()
+ {
+ if ("0" != page.CalculatorResults.GetCalculatorResultText())
+ {
+ page.ClearAll();
+ }
+ CalculatorApp.EnsureCalculatorHasFocus();
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+ page.ScientificOperators.ResetFEButton(fEButtonState.Normal);
+ }
+
+ [TestCleanup]
+ public void TestCleanup()
+ {
+ page.ClearAll();
+ }
+
+ #region Smoke Tests
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Cube()
+ {
+ page.StandardOperators.NumberPad.Input(3);
+ page.ScientificOperators.XPower3Button.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("27", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Sin()
+ {
+ page.StandardOperators.NumberPad.Input(90);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.SinButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Tanh()
+ {
+ page.StandardOperators.NumberPad.Input(90);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.TanhButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_InvCos()
+ {
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.InvCosButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("0", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Floor()
+ {
+ page.StandardOperators.NumberPad.Input(5.9);
+ page.ScientificOperators.FuncButton.Click();
+ page.ScientificOperators.FloorButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("5", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_Parentheses()
+ {
+ page.StandardOperators.NumberPad.Input(3);
+ page.StandardOperators.MultiplyButton.Click();
+ page.ScientificOperators.ParenthesisLeftButton.Click();
+ page.StandardOperators.NumberPad.Input(2);
+ page.StandardOperators.PlusButton.Click();
+ page.StandardOperators.NumberPad.Input(2);
+ page.ScientificOperators.ParenthesisRightButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("12", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_RadianAngleOperator()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Radians);
+
+ page.ScientificOperators.PiButton.Click();
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.CosButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("-1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_GradianAngleOperator()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Gradians);
+
+ page.StandardOperators.NumberPad.Input(100);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.SinButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(0)]
+ public void SmokeTest_FixedToExponential()
+ {
+ page.ScientificOperators.FixedToExponentialButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("0.e+0", page.CalculatorResults.GetCalculatorResultText());
+ }
+ #endregion
+
+ #region Advanced Arithmetic Tests
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_XPowerY()
+ {
+ page.StandardOperators.NumberPad.Input(3);
+ page.ScientificOperators.XPowerYButton.Click();
+ page.StandardOperators.NumberPad.Input(5);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("243", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_PowerOf10Button()
+ {
+ page.StandardOperators.NumberPad.Input(5);
+ page.ScientificOperators.PowerOf10Button.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("100,000", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_LogButton()
+ {
+ page.StandardOperators.NumberPad.Input(10000);
+ page.ScientificOperators.LogButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("4", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_LnButton()
+ {
+ page.ScientificOperators.EulerButton.Click();
+ page.ScientificOperators.LnButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_AbsButton()
+ {
+ page.StandardOperators.NumberPad.Input(25);
+ page.ScientificOperators.NegateButton.Click();
+ page.ScientificOperators.AbsButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("25", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_ExpButton()
+ {
+ page.StandardOperators.NumberPad.Input(4);
+ page.ScientificOperators.ExpButton.Click();
+ page.StandardOperators.NumberPad.Input(4);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("40,000", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_ModButton()
+ {
+ page.StandardOperators.NumberPad.Input(53);
+ page.ScientificOperators.ModButton.Click();
+ page.StandardOperators.NumberPad.Input(10);
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("3", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_FactorialButton()
+ {
+ page.StandardOperators.NumberPad.Input(4);
+ page.ScientificOperators.FactorialButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("24", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_CeilingButton()
+ {
+ page.StandardOperators.NumberPad.Input(4.1);
+ page.ScientificOperators.FuncButton.Click();
+ page.ScientificOperators.CeilButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("5", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_RandomButton()
+ {
+ page.ScientificOperators.FuncButton.Click();
+ page.ScientificOperators.RandButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.IsTrue(page.CalculatorResults.GetCalculatorResultText().StartsWith("0."));
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_DmsButton()
+ {
+ page.StandardOperators.NumberPad.Input(2.999);
+ page.ScientificOperators.FuncButton.Click();
+ page.ScientificOperators.DmsButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("2.59564", page.CalculatorResults.GetCalculatorResultText());
+ }
+
+ [TestMethod]
+ [Priority(1)]
+ public void Operator_DegreesButton()
+ {
+ page.StandardOperators.NumberPad.Input(2.59564);
+ page.ScientificOperators.FuncButton.Click();
+ page.ScientificOperators.DegreesButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("2.999", page.CalculatorResults.GetCalculatorResultText());
+ }
+ #endregion
+
+ #region Trigonometry Tests
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_CosButton()
+ {
+
+ page.StandardOperators.NumberPad.Input(180);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.CosButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("-1", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_TanButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(45);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TanButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_SecButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(180);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.SecButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("-1", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_CscButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(90);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.CscButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_CotButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(45);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.CotButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvSinButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.InvSinButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("90", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvTanButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.InvTanButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("45", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvSecButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.NegateButton.Click();
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.InvSecButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("180", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvCscButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.InvCscButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("90", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvCotButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.InvCotButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("45", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_SinhButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.SinhButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.IsTrue(page.CalculatorResults.GetCalculatorResultText().StartsWith("1.175201"));
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_CoshButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.CoshButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.IsTrue(page.CalculatorResults.GetCalculatorResultText().StartsWith("1.54308"));
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_SechButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.SechButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.IsTrue(page.CalculatorResults.GetCalculatorResultText().StartsWith("0.64805"));
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_CschButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.CschButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.IsTrue(page.CalculatorResults.GetCalculatorResultText().StartsWith("0.850918"));
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_CothButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(45);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.CothButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvSinhButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.InvSinhButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.IsTrue(page.CalculatorResults.GetCalculatorResultText().StartsWith("0.881373"));
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvCoshButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.InvCoshButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("0", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvTanhButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(0.0);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.InvTanhButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("0", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvSechButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.InvSechButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.AreEqual("0", page.CalculatorResults.GetCalculatorResultText());
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvCschButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(1);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.InvCschButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.IsTrue(page.CalculatorResults.GetCalculatorResultText().StartsWith("0.881373"));
+
+ }
+
+ [TestMethod]
+ [Priority(2)]
+ public void Trig_InvCothButton()
+ {
+ page.ScientificOperators.SetAngleOperator(AngleOperatorState.Degrees);
+
+ page.StandardOperators.NumberPad.Input(2);
+ page.ScientificOperators.TrigButton.Click();
+ page.ScientificOperators.TrigShiftButton.Click();
+ page.ScientificOperators.HypShiftButton.Click();
+ page.ScientificOperators.InvCothButton.Click();
+ page.StandardOperators.EqualButton.Click();
+ Assert.IsTrue(page.CalculatorResults.GetCalculatorResultText().StartsWith("0.549306"));
+
+ }
+ #endregion
+ }
+}
diff --git a/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj b/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj
index bf059ad..200ddc0 100644
--- a/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj
+++ b/src/CalculatorUnitTests/CalculatorUnitTests.vcxproj
@@ -291,4 +291,4 @@
-
+
\ No newline at end of file