Browse Source

fix(TestAutomation) Fixed missing driver

main
Jonathan McCaffrey 4 years ago
parent
commit
d2c8c2db74
  1. 4
      TestAutomation/TestAutomation.csproj
  2. 22
      TestAutomation/UnitTest1.cs

4
TestAutomation/TestAutomation.csproj

@ -9,12 +9,14 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetSeleniumExtras.PageObjects" Version="3.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.2.0" />
<PackageReference Include="coverlet.collector" Version="3.1.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.1.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="101.0.4951.4100" />
<PackageReference Include="Selenium.WebDriver.GeckoDriver" Version="0.31.0" />
</ItemGroup>
<ItemGroup>

22
TestAutomation/UnitTest1.cs

@ -4,12 +4,10 @@ namespace TestAutomation;
public class Tests
{
private IWebDriver _webDriver = default!;
private readonly string localhost = "https://localhost:7234";
private readonly string develop = "https://calm-mud-04916b210.1.azurestaticapps.net/";
private Website Website { get; }
public Tests() {
@ -17,23 +15,21 @@ public class Tests
var options = new ChromeOptions();
options.AcceptInsecureCertificates = true;
#if !DEBUG
options.AddArgument("--headless");
#endif
options.AddArgument("--headless");
options.AddArgument("--start-maximized");
//_webDriver = new FirefoxDriver(options);
_webDriver = new ChromeDriver(options);
_webDriver = new ChromeDriver(Environment.CurrentDirectory, options);
//_webDriver = new FirefoxDriver(Environment.CurrentDirectory, options);
Website = new Website(_webDriver);
}
[OneTimeSetUp]
public void Setup()
{
_webDriver.Navigate().GoToUrl(localhost);
_webDriver.Navigate().GoToUrl(develop);
_webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15);
}
@ -46,7 +42,7 @@ public class Tests
[Test]
public void HarassCalculator()
{
_webDriver.Navigate().GoToUrl(localhost + "/harass-calculator");
_webDriver.Navigate().GoToUrl(develop + "/harass-calculator");
int expectedTotalAlloyHarassment = 240;
@ -66,7 +62,7 @@ public class Tests
[Test]
public void HarassCalculatorInformation()
{
_webDriver.Navigate().GoToUrl(localhost + "/harass-calculator");
_webDriver.Navigate().GoToUrl(develop + "/harass-calculator");
int expectedExampleTotalAlloyLoss = 720;
int expectedExampleWorkerCost = 300;

Loading…
Cancel
Save