Auto formatting

This commit is contained in:
2022-05-02 02:04:40 -04:00
parent f103dc7bed
commit b2516fc80a
64 changed files with 683 additions and 548 deletions
+1 -4
View File
@@ -35,10 +35,7 @@ public class BaseTest
options.AcceptInsecureCertificates = true;
if (DeploymentType.Equals(DeploymentType.Dev))
{
options.AddArgument("--headless");
}
if (DeploymentType.Equals(DeploymentType.Dev)) options.AddArgument("--headless");
options.AddArgument("--ignore-certificate-errors");
options.AddArgument("--start-maximized");
options.AddArgument("--test-type");
+18 -16
View File
@@ -6,39 +6,41 @@ namespace TestAutomation.Pages;
public class DatabasePage : BaseElement
{
public DatabasePage(Website website) : base(website)
{
}
private IWebElement FilterNameInput => Website.Find("filterName");
private ReadOnlyCollection<IWebElement> EntityNames() =>
Website.FindAll("entityName");
private IWebElement EntityName(string entityType, string entityName) =>
Website.Find("entityName",
private ReadOnlyCollection<IWebElement> EntityNames()
{
return Website.FindAll("entityName");
}
private IWebElement EntityName(string entityType, string entityName)
{
return Website.Find("entityName",
$"{entityType.ToLower()}-{entityName.ToLower()}");
public DatabasePage(Website website) : base(website) { }
}
public DatabasePage FilterName(string name)
{
Website.EnterInput(FilterNameInput, name);
return this;
}
public DatabasePage GetEntityName(string entityType, string entityName, out string result)
{
result = EntityName(entityType, entityName).Text;
return this;
}
public DatabasePage GetEntityName(int index,out string result)
public DatabasePage GetEntityName(int index, out string result)
{
result = EntityNames()[index].Text;
return this;
}
}
+8 -7
View File
@@ -5,13 +5,15 @@ namespace TestAutomation.Pages;
public class DatabaseSinglePage : BaseElement
{
public DatabaseSinglePage(Website website) : base(website)
{
}
private IWebElement EntityName => Website.Find("entityName");
private IWebElement EntityHealth => Website.Find("entityHealth");
private IWebElement InvalidSearch => Website.Find("invalidSearch");
private IWebElement ValidSearch => Website.Find("validSearch");
public DatabaseSinglePage(Website website) : base(website) { }
public DatabaseSinglePage GetEntityName(out string result)
@@ -19,23 +21,22 @@ public class DatabaseSinglePage : BaseElement
result = EntityName.Text;
return this;
}
public DatabaseSinglePage GetEntityHealth(out string result)
{
result = EntityHealth.Text;
return this;
}
public DatabaseSinglePage GetInvalidSearch(out string result)
{
result = InvalidSearch.Text;
return this;
}
public DatabaseSinglePage GetValidSearch(out string result)
{
result = ValidSearch.Text;
return this;
}
}
+4 -4
View File
@@ -1,13 +1,13 @@
using TestAutomation.Enums;
using TestAutomation.Utils;
namespace TestAutomation.Shared;
public class NavigationBar : BaseElement
{
public NavigationBar(Website website) : base(website) { }
public NavigationBar(Website website) : base(website)
{
}
private IWebElement HomeLink => Website.FindScreenSpecific("homeLink");
private IWebElement SearchButton => Website.FindScreenSpecific("searchButton");
+1 -2
View File
@@ -1,4 +1,3 @@
using Discord.Rest;
using TestAutomation.Utils;
namespace TestAutomation.Shared;
@@ -10,7 +9,7 @@ public class WebsiteSearchDialog : BaseElement
}
public IWebElement SearchBackground => Website.Find("searchBackground");
public IWebElement SearchInput => Website.Find("searchInput");
public NavigationBar CloseDialog()
+11 -11
View File
@@ -9,20 +9,20 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Discord.Net.Webhook" Version="3.6.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0-preview.2.22152.2" />
<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" />
<PackageReference Include="Discord.Net.Webhook" Version="3.6.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0-preview.2.22152.2"/>
<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>
<Folder Include="Pages\" />
<Folder Include="Pages\"/>
</ItemGroup>
</Project>
+25 -23
View File
@@ -17,7 +17,7 @@ public class TestSearchFeatures : BaseTest
.CloseDialog()
.ClickHomeLink();
}
[Test]
public void DesktopSearchForThrone()
{
@@ -31,56 +31,58 @@ public class TestSearchFeatures : BaseTest
.SelectSearchEntity("Throne")
.GetEntityName(out var name)
.GetEntityHealth(out var health);
TestReport.CheckPassed(name.Equals("Throne"), new TestMessage(){ Description = "Couldn't find Throne via search."});
TestReport.CheckPassed(!health.Trim().Equals(""), new TestMessage(){ Description = "Throne has no visible health!"});
TestReport.CheckPassed(name.Equals("Throne"),
new TestMessage { Description = "Couldn't find Throne via search." });
TestReport.CheckPassed(!health.Trim().Equals(""),
new TestMessage { Description = "Throne has no visible health!" });
}
[Test]
public void DesktopFilterForThrone()
{
TestReport.CreateTest();
Website.WebDriver.Navigate().GoToUrl(WebsiteUrl + "/database");
Website.DatabasePage
.FilterName("Throne")
.GetEntityName(0, out var name);
TestReport.CheckPassed(name.Equals("Throne"),
new TestMessage(){ Description = "Couldn't find Throne via filter."});
TestReport.CheckPassed(name.Equals("Throne"),
new TestMessage { Description = "Couldn't find Throne via filter." });
}
[Test]
public void SeeThroneByDefault()
{
TestReport.CreateTest();
Website.WebDriver.Navigate().GoToUrl(WebsiteUrl + "/database");
Website.DatabasePage
.GetEntityName( "army", "throne", out var name);
TestReport.CheckPassed(name.Equals("Throne"),
new TestMessage(){ Description = "Couldn't find Throne on the page by default."});
.GetEntityName("army", "throne", out var name);
TestReport.CheckPassed(name.Equals("Throne"),
new TestMessage { Description = "Couldn't find Throne on the page by default." });
}
[Test]
public void DirectLinkNotThroneFailure()
{
TestReport.CreateTest();
Website.WebDriver.Navigate().GoToUrl(WebsiteUrl + "/database/not throne");
Website.DatabaseSinglePage
.GetInvalidSearch(out var invalidSearch)
.GetValidSearch(out var validSearch);
TestReport.CheckPassed(invalidSearch.Equals("not throne"),
new TestMessage(){ Description = "Couldn't find invalid search text on the page."});
TestReport.CheckPassed(validSearch.Equals("Throne"),
new TestMessage(){ Description = "Couldn't find valid search text on the page."});
TestReport.CheckPassed(invalidSearch.Equals("not throne"),
new TestMessage { Description = "Couldn't find invalid search text on the page." });
TestReport.CheckPassed(validSearch.Equals("Throne"),
new TestMessage { Description = "Couldn't find valid search text on the page." });
Website.WebDriver.Navigate().GoToUrl(WebsiteUrl + "/database/not throne");
}
}
+16 -16
View File
@@ -8,7 +8,7 @@ namespace TestAutomation.Utils;
public class Website
{
public readonly ScreenType ScreenType = ScreenType.Desktop;
public Website(IWebDriver webDriver)
{
WebDriver = webDriver;
@@ -17,10 +17,10 @@ public class Website
HarassCalculatorPage = new HarassCalculatorPage(this);
DatabasePage = new DatabasePage(this);
DatabaseSinglePage = new DatabaseSinglePage(this);
// Navigation
NavigationBar = new NavigationBar(this);
// Dialogs
WebsiteSearchDialog = new WebsiteSearchDialog(this);
}
@@ -36,7 +36,7 @@ public class Website
public IWebElement FindScreenSpecific(string byId)
{
var screenSpecificId = $"{ScreenType.ToString().ToLower()}-{byId}";
try
{
return WebDriver.FindElement(By.Id(screenSpecificId));
@@ -44,11 +44,11 @@ public class Website
catch (Exception e)
{
throw new Exception($"Couldn't find {screenSpecificId}. Element does not exist on current page. " +
$"\n\nPerhaps an Id is missing.");
"\n\nPerhaps an Id is missing.");
}
}
public IWebElement Find(string byId, string withParentId)
{
IWebElement parent;
@@ -60,9 +60,9 @@ public class Website
catch (Exception e)
{
throw new Exception($"Couldn't find parent {withParentId}. Element does not exist on current page. " +
$"\n\nPerhaps an Id is missing.");
"\n\nPerhaps an Id is missing.");
}
try
{
return parent.FindElement(By.Id(byId));
@@ -70,10 +70,10 @@ public class Website
catch (Exception e)
{
throw new Exception($"Couldn't find {byId}. Element does not exist on current page. " +
$"\n\nPerhaps an Id is missing.");
"\n\nPerhaps an Id is missing.");
}
}
public IWebElement Find(string byId)
{
try
@@ -83,10 +83,10 @@ public class Website
catch (Exception e)
{
throw new Exception($"Couldn't find {byId}. Element does not exist on current page. " +
$"\n\nPerhaps an Id is missing.");
"\n\nPerhaps an Id is missing.");
}
}
public ReadOnlyCollection<IWebElement> FindAll(string byId)
{
try
@@ -96,11 +96,11 @@ public class Website
catch (Exception e)
{
throw new Exception($"Couldn't find {byId}. Element does not exist on current page. " +
$"\n\nPerhaps an Id is missing.");
"\n\nPerhaps an Id is missing.");
}
}
public IWebElement FindButtonWithLabel(string label)
{
try
@@ -112,7 +112,7 @@ public class Website
throw new Exception($"Couldn't find with label: {label}. Element does not exist on current page. ");
}
}
//@FindBy(xpath = "//div[@label='First Name']")
public IList<IWebElement> FindChildren(string ofId, string tagname)
@@ -139,7 +139,7 @@ public class Website
.Click()
.Perform();
}
public IWebElement Click(IWebElement element)
{
try