mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-20 21:33:10 -07:00
test
This commit is contained in:
parent
a4b09e02dd
commit
6370f28f8e
1 changed files with 9 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Threading;
|
||||||
using CalculatorUITestFramework;
|
using CalculatorUITestFramework;
|
||||||
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
@ -25,6 +26,7 @@ namespace CalculatorUITests
|
||||||
{
|
{
|
||||||
// Create session to launch a Calculator window
|
// Create session to launch a Calculator window
|
||||||
_currencyServer = new MockedCurrencyServer();
|
_currencyServer = new MockedCurrencyServer();
|
||||||
|
Thread.Sleep(5000);
|
||||||
CalculatorDriver.Instance.SetupCalculatorSession(context);
|
CalculatorDriver.Instance.SetupCalculatorSession(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +47,10 @@ namespace CalculatorUITests
|
||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void TestInit()
|
public void TestInit()
|
||||||
{
|
{
|
||||||
VerifyConnection();
|
VerifyConnection("http://localhost/calctesting/file/?id=currency+converter+data&localCurrency=en-US");
|
||||||
|
VerifyConnection("http://localhost/calctesting/file/?id=currency+static+data&localizeFor=en-US");
|
||||||
CalculatorApp.EnsureCalculatorHasFocus();
|
CalculatorApp.EnsureCalculatorHasFocus();
|
||||||
|
Thread.Sleep(5000);
|
||||||
page.EnsureCalculatorIsCurrencyMode();
|
page.EnsureCalculatorIsCurrencyMode();
|
||||||
page.EnsureCalculatorResultTextIsZero();
|
page.EnsureCalculatorResultTextIsZero();
|
||||||
page.EnsureSameUnitsAreSelected();
|
page.EnsureSameUnitsAreSelected();
|
||||||
|
@ -58,14 +62,15 @@ namespace CalculatorUITests
|
||||||
page.ClearAll();
|
page.ClearAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void VerifyConnection()
|
private static void VerifyConnection(string url)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"VerifyConnection begins: url: {url}");
|
||||||
var process = new Process();
|
var process = new Process();
|
||||||
var startInfo = new ProcessStartInfo
|
var startInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
FileName = "cmd.exe",
|
FileName = "cmd.exe",
|
||||||
Arguments = @"/C curl ""http://localhost/calctesting/file/?id=currency+converter+data&localCurrency=""",
|
Arguments = @$"/C curl ""{url}""",
|
||||||
RedirectStandardOutput = true, // Redirect the standard output
|
RedirectStandardOutput = true, // Redirect the standard output
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
CreateNoWindow = true
|
CreateNoWindow = true
|
||||||
|
@ -74,7 +79,7 @@ namespace CalculatorUITests
|
||||||
process.Start();
|
process.Start();
|
||||||
var debug = process.StandardOutput.ReadToEnd();
|
var debug = process.StandardOutput.ReadToEnd();
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
Console.WriteLine($"----------- exitcode: {process.ExitCode}, curl result: {debug}");
|
Console.WriteLine($"VerifyConnection ends: exitcode: {process.ExitCode}, curl result: {debug}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private string NormalizeCurrencyText(string realValue, int fractionDigits)
|
private string NormalizeCurrencyText(string realValue, int fractionDigits)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue