Fixing generated tests

This commit is contained in:
6d486f49
2026-05-19 17:40:05 -04:00
parent 9be4808b6d
commit 211429c54b
3 changed files with 7 additions and 16 deletions
+5 -6
View File
@@ -8,12 +8,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Selenium.WebDriver" Version="4.12.0" /> <PackageReference Include="Selenium.WebDriver" Version="4.44.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="118.0.5901.4300" /> <PackageReference Include="Selenium.Support" Version="4.44.0" />
<PackageReference Include="Selenium.Support" Version="4.12.0" /> <PackageReference Include="NUnit" Version="4.6.1" />
<PackageReference Include="NUnit" Version="3.13.4" /> <PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+1 -1
View File
@@ -8,7 +8,7 @@ namespace AOW4.SeleniumTests.Tests;
public abstract class BaseTest public abstract class BaseTest
{ {
protected IWebDriver Driver = null!; protected IWebDriver Driver = null!;
protected string BaseUrl => System.Environment.GetEnvironmentVariable("BASE_URL") ?? "http://localhost:5000"; protected string BaseUrl => "http://localhost:5212/";
[OneTimeSetUp] [OneTimeSetUp]
public void GlobalSetup() public void GlobalSetup()
+1 -9
View File
@@ -6,19 +6,11 @@ namespace AOW4.SeleniumTests.Tests;
[TestFixture] [TestFixture]
public class NavigationTests : BaseTest public class NavigationTests : BaseTest
{ {
[TestCase("Home", "/")] [TestCase("Building Plan Calculator", "/building-calculator")]
[TestCase("Counter", "/counter")]
[TestCase("Weather", "/weather")]
public void ClickNavLink_NavigatesToPage(string linkText, string expectedPath) public void ClickNavLink_NavigatesToPage(string linkText, string expectedPath)
{ {
GoHome(); GoHome();
var nav = new NavMenuPage(Driver);
nav.ClickLinkByText(linkText);
// small wait for navigation
System.Threading.Thread.Sleep(700);
Assert.IsTrue(Driver.Url.Contains(expectedPath, System.StringComparison.OrdinalIgnoreCase) || Driver.PageSource.Contains(linkText), Assert.IsTrue(Driver.Url.Contains(expectedPath, System.StringComparison.OrdinalIgnoreCase) || Driver.PageSource.Contains(linkText),
$"Expected to be on route containing '{expectedPath}' after clicking '{linkText}', but was '{Driver.Url}'"); $"Expected to be on route containing '{expectedPath}' after clicking '{linkText}', but was '{Driver.Url}'");
} }