test(SearchTest) Added a test for opening and closing search dialog

This commit is contained in:
2022-04-30 00:50:46 -04:00
parent 06c0a976e8
commit 51e5bd8185
24 changed files with 476 additions and 154 deletions
+97
View File
@@ -0,0 +1,97 @@
using TestAutomation.Utils;
namespace TestAutomation;
[TestFixture]
public class TestHarassCalculator : BaseTest
{
[Test]
public void CalculatorInput()
{
TestReport.CreateTest();
Website.WebDriver.Navigate().GoToUrl(WebsiteUrl + "/harass-calculator");
var expectedTotalAlloyHarassment = 240;
try
{
Website.HarassCalculatorPage
.SetWorkersLostToHarass(3)
.SetNumberOfTownHallsExisting(2)
.SetTownHallTravelTime(0, 30)
.GetTotalAlloyHarassment(out var foundTotalAlloyHarassment);
TestReport.CheckPassed(expectedTotalAlloyHarassment.Equals(foundTotalAlloyHarassment),
TestMessage.CreateFailedMessage($"expectTotalAlloyHarassment of {expectedTotalAlloyHarassment} " +
"does not equal " +
$"foundTotalAlloyHarassment of {foundTotalAlloyHarassment} "));
}
catch (Exception e)
{
TestReport.CheckPassed(false,
TestMessage.CreateFailedMessage(e.StackTrace!));
}
}
[Test]
public void CalculatedExampleInformation()
{
TestReport.CreateTest();
Website.WebDriver.Navigate().GoToUrl(WebsiteUrl + "/harass-calculator");
var expectedExampleTotalAlloyLoss = 720;
var expectedExampleWorkerCost = 300;
var expectedExampleMiningTimeCost = 420;
var expectedExampleTotalAlloyLossDifference = 300;
var expectedExampleTotalAlloyLossAccurate = 450;
var expectedExampleTotalAlloyLossAccurateDifference = 270;
Website.HarassCalculatorPage
.GetExampleTotalAlloyLoss(out var foundTotalAlloyLoss)
.GetExampleWorkerCost(out var foundExampleWorkerCost)
.GetExampleMiningTimeCost(out var foundExampleMiningTimeCost)
.GetExampleTotalAlloyLossAccurate(out var foundExampleTotalAlloyLossAccurate)
.GetExampleTotalAlloyLossDifference(out var foundGetExampleTotalAlloyLossDifference)
.GetExampleTotalAlloyLossAccurateDifference(out var foundExampleTotalAlloyLossAccurateDifference);
TestReport.CheckPassed(expectedExampleTotalAlloyLoss.Equals(foundTotalAlloyLoss),
TestMessage.CreateFailedMessage($"expectedExampleTotalAlloyLoss of {expectedExampleTotalAlloyLoss} " +
"does not equal " +
$"foundTotalAlloyLoss of {foundTotalAlloyLoss} "));
TestReport.CheckPassed(expectedExampleWorkerCost.Equals(foundExampleWorkerCost),
TestMessage.CreateFailedMessage($"expectedExampleWorkerCost of {expectedExampleWorkerCost} " +
"does not equal " +
$"foundExampleWorkerCost of {foundExampleWorkerCost} "));
TestReport.CheckPassed(expectedExampleMiningTimeCost.Equals(foundExampleMiningTimeCost),
TestMessage.CreateFailedMessage($"expectedExampleMiningTimeCost of {expectedExampleMiningTimeCost} " +
"does not equal " +
$"foundExampleMiningTimeCost of {foundExampleMiningTimeCost} "));
TestReport.CheckPassed(expectedExampleTotalAlloyLossAccurate.Equals(foundExampleTotalAlloyLossAccurate),
TestMessage.CreateFailedMessage(
$"expectedExampleTotalAlloyLossAccurate of {expectedExampleTotalAlloyLossAccurate} " +
"does not equal " +
$"foundExampleTotalAlloyLossAccurate of {foundExampleTotalAlloyLossAccurate} "));
TestReport.CheckPassed(expectedExampleTotalAlloyLossDifference.Equals(foundGetExampleTotalAlloyLossDifference),
TestMessage.CreateFailedMessage(
$"expectedExampleTotalAlloyLossDifference of {expectedExampleTotalAlloyLossDifference} " +
"does not equal " +
$"foundGetExampleTotalAlloyLossDifference of {foundGetExampleTotalAlloyLossDifference} "));
TestReport.CheckPassed(
expectedExampleTotalAlloyLossAccurateDifference.Equals(foundExampleTotalAlloyLossAccurateDifference),
TestMessage.CreateFailedMessage(
$"expectedExampleTotalAlloyLossAccurateDifference of {expectedExampleTotalAlloyLossAccurateDifference} " +
"does not equal " +
$"foundExampleTotalAlloyLossAccurateDifference of {foundExampleTotalAlloyLossAccurateDifference} "));
}
}