Code cleanup

This commit is contained in:
2026-05-27 10:51:19 -04:00
parent 5e486b0edb
commit 2423d232cf
48 changed files with 53731 additions and 46250 deletions
+7 -3
View File
@@ -5,11 +5,15 @@ namespace AOW4.SeleniumTests.Pages;
public class CounterPage
{
private readonly IWebDriver _driver;
public CounterPage(IWebDriver driver) => _driver = driver;
public CounterPage(IWebDriver driver)
{
_driver = driver;
}
public bool IsAt()
{
var url = _driver.Url ?? string.Empty;
return url.Contains("counter", System.StringComparison.OrdinalIgnoreCase) || _driver.PageSource.Contains("Counter");
return url.Contains("counter", StringComparison.OrdinalIgnoreCase) || _driver.PageSource.Contains("Counter");
}
}
}
+8 -3
View File
@@ -5,11 +5,16 @@ namespace AOW4.SeleniumTests.Pages;
public class HomePage
{
private readonly IWebDriver _driver;
public HomePage(IWebDriver driver) => _driver = driver;
public HomePage(IWebDriver driver)
{
_driver = driver;
}
public bool IsAt()
{
var url = _driver.Url ?? string.Empty;
return url.EndsWith("/") || url.Contains("/index", System.StringComparison.OrdinalIgnoreCase) || _driver.PageSource.Contains("Home");
return url.EndsWith("/") || url.Contains("/index", StringComparison.OrdinalIgnoreCase) ||
_driver.PageSource.Contains("Home");
}
}
}
+5 -7
View File
@@ -1,4 +1,3 @@
using System.Linq;
using OpenQA.Selenium;
namespace AOW4.SeleniumTests.Pages;
@@ -15,13 +14,12 @@ public class NavMenuPage
public void ClickLinkByText(string linkText)
{
var link = _driver.FindElements(By.CssSelector("a[href]"))
.FirstOrDefault(e => !string.IsNullOrWhiteSpace(e.Text) && e.Text.Trim().Equals(linkText, System.StringComparison.OrdinalIgnoreCase));
.FirstOrDefault(e =>
!string.IsNullOrWhiteSpace(e.Text) &&
e.Text.Trim().Equals(linkText, StringComparison.OrdinalIgnoreCase));
if (link == null)
{
throw new NoSuchElementException($"Link with text '{linkText}' not found in the page.");
}
if (link == null) throw new NoSuchElementException($"Link with text '{linkText}' not found in the page.");
link.Click();
}
}
}
-15
View File
@@ -1,15 +0,0 @@
using OpenQA.Selenium;
namespace AOW4.SeleniumTests.Pages;
public class WeatherPage
{
private readonly IWebDriver _driver;
public WeatherPage(IWebDriver driver) => _driver = driver;
public bool IsAt()
{
var url = _driver.Url ?? string.Empty;
return url.Contains("weather", System.StringComparison.OrdinalIgnoreCase) || _driver.PageSource.Contains("Weather");
}
}