mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-23 06:25:19 -07:00
remove wait helper and reduce UI tests to base sanity checks
This commit is contained in:
parent
2308e69499
commit
3970777dc1
2 changed files with 0 additions and 99 deletions
|
@ -1,11 +1,8 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting.Logging;
|
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Appium.Windows;
|
using OpenQA.Selenium.Appium.Windows;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace CalculatorUITestFramework
|
namespace CalculatorUITestFramework
|
||||||
{
|
{
|
||||||
|
@ -71,43 +68,5 @@ namespace CalculatorUITestFramework
|
||||||
// process id (any entry of allWindowHandles)
|
// process id (any entry of allWindowHandles)
|
||||||
driver.SwitchTo().Window(allWindowHandles[0]);
|
driver.SwitchTo().Window(allWindowHandles[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Waits for an element to be created.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="driver">this</param>
|
|
||||||
/// <param name="id">the automation id</param>
|
|
||||||
/// <param name="timeout">optional timeout in ms</param>
|
|
||||||
/// <returns>the element with the matching automation id</returns>
|
|
||||||
public static WindowsElement WaitForElementByAccessibilityId(this WindowsDriver<WindowsElement> driver, string id, int timeout = 1000)
|
|
||||||
{
|
|
||||||
Stopwatch timer = new Stopwatch();
|
|
||||||
timer.Reset();
|
|
||||||
timer.Start();
|
|
||||||
while (timer.ElapsedMilliseconds < timeout)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var element = driver.TryFindElementByAccessibilityId(id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
catch(WebDriverException ex)
|
|
||||||
{
|
|
||||||
if (ex.Message.Contains("An element could not be located on the page using the given search parameters"))
|
|
||||||
{
|
|
||||||
Logger.LogMessage("Element not found. Waiting for 10ms in WaitForElementByAccessibilityId");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
timer.Stop();
|
|
||||||
|
|
||||||
// one last attempt. Throws the not found exception if this fails
|
|
||||||
return driver.TryFindElementByAccessibilityId(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -919,64 +919,6 @@ namespace CalculatorUITests
|
||||||
CalculatorApp.Window.SendKeys(Keys.Control + "v" + Keys.Control);
|
CalculatorApp.Window.SendKeys(Keys.Control + "v" + Keys.Control);
|
||||||
Assert.AreEqual("Invalid input", page.CalculatorResults.GetCalculatorResultText());
|
Assert.AreEqual("Invalid input", page.CalculatorResults.GetCalculatorResultText());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
[Priority(1)]
|
|
||||||
public void Copy_And_Paste_Big_QWord_Number()
|
|
||||||
{
|
|
||||||
page.ProgrammerOperators.BitFlip.Click();
|
|
||||||
page.ProgrammerOperators.Bit63.Click();
|
|
||||||
CalculatorApp.Window.SendKeys(Keys.Control + "c" + Keys.Control);
|
|
||||||
page.ProgrammerOperators.FullKeypad.Click();
|
|
||||||
page.StandardOperators.ClearEntryButton.Click();
|
|
||||||
CalculatorApp.Window.SendKeys(Keys.Control + "v" + Keys.Control);
|
|
||||||
Assert.AreEqual("-9,223,372,036,854,775,808", page.CalculatorResults.GetCalculatorResultText());
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
[Priority(1)]
|
|
||||||
public void Copy_And_Paste_Big_DWord_Number()
|
|
||||||
{
|
|
||||||
page.ProgrammerOperators.QWordButton.Click();
|
|
||||||
page.ProgrammerOperators.BitFlip.Click();
|
|
||||||
page.ProgrammerOperators.Bit31.Click();
|
|
||||||
CalculatorApp.Window.SendKeys(Keys.Control + "c" + Keys.Control);
|
|
||||||
page.ProgrammerOperators.FullKeypad.Click();
|
|
||||||
page.StandardOperators.ClearEntryButton.Click();
|
|
||||||
CalculatorApp.Window.SendKeys(Keys.Control + "v" + Keys.Control);
|
|
||||||
Assert.AreEqual("-2,147,483,648", page.CalculatorResults.GetCalculatorResultText());
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
[Priority(1)]
|
|
||||||
public void Copy_And_Paste_Big_Word_Number()
|
|
||||||
{
|
|
||||||
page.ProgrammerOperators.QWordButton.Click();
|
|
||||||
page.ProgrammerOperators.DWordButton.Click();
|
|
||||||
page.ProgrammerOperators.BitFlip.Click();
|
|
||||||
page.ProgrammerOperators.Bit15.Click();
|
|
||||||
CalculatorApp.Window.SendKeys(Keys.Control + "c" + Keys.Control);
|
|
||||||
page.ProgrammerOperators.FullKeypad.Click();
|
|
||||||
page.StandardOperators.ClearEntryButton.Click();
|
|
||||||
CalculatorApp.Window.SendKeys(Keys.Control + "v" + Keys.Control);
|
|
||||||
Assert.AreEqual("-32,768", page.CalculatorResults.GetCalculatorResultText());
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
[Priority(1)]
|
|
||||||
public void Copy_And_Paste_Big_Byte_Number()
|
|
||||||
{
|
|
||||||
page.ProgrammerOperators.QWordButton.Click();
|
|
||||||
page.ProgrammerOperators.DWordButton.Click();
|
|
||||||
page.ProgrammerOperators.WordButton.Click();
|
|
||||||
page.ProgrammerOperators.BitFlip.Click();
|
|
||||||
page.ProgrammerOperators.Bit7.Click();
|
|
||||||
CalculatorApp.Window.SendKeys(Keys.Control + "c" + Keys.Control);
|
|
||||||
page.ProgrammerOperators.FullKeypad.Click();
|
|
||||||
page.StandardOperators.ClearEntryButton.Click();
|
|
||||||
CalculatorApp.Window.SendKeys(Keys.Control + "v" + Keys.Control);
|
|
||||||
Assert.AreEqual("-128", page.CalculatorResults.GetCalculatorResultText());
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue