Skip to content

Commit

Permalink
try this (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
agray authored Jan 17, 2025
1 parent 738a212 commit 685fbb0
Show file tree
Hide file tree
Showing 22 changed files with 238 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@

<ItemGroup>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Saucery" Version="4.5.9" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Saucery.Tests.Common\Saucery.Tests.Common.csproj" />
<PackageReference Include="Saucery" Version="4.5.10" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions ExternalMerlin.NUnit.RealDevices/NuGetIntegrationTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using NUnit.Framework;
using ExternalMerlin.NUnit.RealDevices.PageObjects;
using NUnit.Framework;
using Saucery;
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using Shouldly;

[assembly: LevelOfParallelism(4)]
Expand Down
36 changes: 36 additions & 0 deletions ExternalMerlin.NUnit.RealDevices/PageObjects/GuineaPigPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using Saucery.Core.PageObjects;
using SeleniumExtras.PageObjects;

namespace ExternalMerlin.NUnit.RealDevices.PageObjects;

public class GuineaPigPage : PageObjectBase {
public GuineaPigPage(WebDriver driver, string urlRoot)
: base(urlRoot + "test/guinea-pig", "GuineaPig", "I am a page title - Sauce Labs") {
GetPage(driver);
PageFactory.InitElements(driver, this);
}

public GuineaPigPage ClickLink(WebDriver driver) {
//Could also use a "Selectors" class here.
var link = driver.FindElement(By.Id("i am a link"));
link.Click();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
wait.Until(d => d.Url.Contains("guinea-pig2"));
return this;
}

public IWebElement GetField(WebDriver driver, string fieldId) => driver.FindElement(By.Id(fieldId));

public string GetUserAgent(WebDriver driver) =>
//Could also use a "Selectors" class here.
driver.FindElement(By.Id("useragent")).Text;

public GuineaPigPage TypeField(WebDriver driver, string fieldId, string data) {
var element = GetField(driver, fieldId);
element.Clear();
element.SendKeys(data);
return this;
}
}
6 changes: 1 addition & 5 deletions ExternalMerlin.NUnit/ExternalMerlin.NUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@

<ItemGroup>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Saucery" Version="4.5.9" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Saucery.Tests.Common\Saucery.Tests.Common.csproj" />
<PackageReference Include="Saucery" Version="4.5.10" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions ExternalMerlin.NUnit/NuGetIntegrationTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using NUnit.Framework;
using ExternalMerlin.NUnit.PageObjects;
using NUnit.Framework;
using Saucery;
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using Shouldly;

[assembly: LevelOfParallelism(4)]
Expand Down
36 changes: 36 additions & 0 deletions ExternalMerlin.NUnit/PageObjects/GuineaPigPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using Saucery.Core.PageObjects;
using SeleniumExtras.PageObjects;

namespace ExternalMerlin.NUnit.PageObjects;

public class GuineaPigPage : PageObjectBase {
public GuineaPigPage(WebDriver driver, string urlRoot)
: base(urlRoot + "test/guinea-pig", "GuineaPig", "I am a page title - Sauce Labs") {
GetPage(driver);
PageFactory.InitElements(driver, this);
}

public GuineaPigPage ClickLink(WebDriver driver) {
//Could also use a "Selectors" class here.
var link = driver.FindElement(By.Id("i am a link"));
link.Click();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
wait.Until(d => d.Url.Contains("guinea-pig2"));
return this;
}

public IWebElement GetField(WebDriver driver, string fieldId) => driver.FindElement(By.Id(fieldId));

public string GetUserAgent(WebDriver driver) =>
//Could also use a "Selectors" class here.
driver.FindElement(By.Id("useragent")).Text;

public GuineaPigPage TypeField(WebDriver driver, string fieldId, string data) {
var element = GetField(driver, fieldId);
element.Clear();
element.SendKeys(data);
return this;
}
}
2 changes: 1 addition & 1 deletion ExternalMerlin.TUnit.RealDevices/ClickLinkTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ExternalMerlin.TUnit.RealDevices;
using ExternalMerlin.TUnit.RealDevices.PageObjects;
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using Saucery.TUnit;
using Shouldly;

Expand Down
4 changes: 2 additions & 2 deletions ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using ExternalMerlin.TUnit.RealDevices.PageObjects;
using Saucery.Core.Dojo;
using Saucery.TUnit;

namespace ExternalMerlin.TUnit.RealDevices;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Saucery.TUnit" Version="0.6.100" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Saucery.Tests.Common\Saucery.Tests.Common.csproj" />
<PackageReference Include="Saucery.TUnit" Version="0.6.117" />
</ItemGroup>

</Project>
36 changes: 36 additions & 0 deletions ExternalMerlin.TUnit.RealDevices/PageObjects/GuineaPigPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using Saucery.Core.PageObjects;
using SeleniumExtras.PageObjects;

namespace ExternalMerlin.TUnit.RealDevices.PageObjects;

public class GuineaPigPage : PageObjectBase {
public GuineaPigPage(WebDriver driver, string urlRoot)
: base(urlRoot + "test/guinea-pig", "GuineaPig", "I am a page title - Sauce Labs") {
GetPage(driver);
PageFactory.InitElements(driver, this);
}

public GuineaPigPage ClickLink(WebDriver driver) {
//Could also use a "Selectors" class here.
var link = driver.FindElement(By.Id("i am a link"));
link.Click();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
wait.Until(d => d.Url.Contains("guinea-pig2"));
return this;
}

public IWebElement GetField(WebDriver driver, string fieldId) => driver.FindElement(By.Id(fieldId));

public string GetUserAgent(WebDriver driver) =>
//Could also use a "Selectors" class here.
driver.FindElement(By.Id("useragent")).Text;

public GuineaPigPage TypeField(WebDriver driver, string fieldId, string data) {
var element = GetField(driver, fieldId);
element.Clear();
element.SendKeys(data);
return this;
}
}
2 changes: 1 addition & 1 deletion ExternalMerlin.TUnit/ClickLinkTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ExternalMerlin.TUnit;
using ExternalMerlin.TUnit.PageObjects;
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using Saucery.TUnit;
using Shouldly;

Expand Down
4 changes: 2 additions & 2 deletions ExternalMerlin.TUnit/DataDrivenTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using ExternalMerlin.TUnit.PageObjects;
using Saucery.Core.Dojo;
using Saucery.TUnit;

namespace ExternalMerlin.TUnit;
Expand Down
6 changes: 1 addition & 5 deletions ExternalMerlin.TUnit/ExternalMerlin.TUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Saucery.TUnit" Version="0.6.100" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Saucery.Tests.Common\Saucery.Tests.Common.csproj" />
<PackageReference Include="Saucery.TUnit" Version="0.6.117" />
</ItemGroup>

</Project>
36 changes: 36 additions & 0 deletions ExternalMerlin.TUnit/PageObjects/GuineaPigPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using Saucery.Core.PageObjects;
using SeleniumExtras.PageObjects;

namespace ExternalMerlin.TUnit.PageObjects;

public class GuineaPigPage : PageObjectBase {
public GuineaPigPage(WebDriver driver, string urlRoot)
: base(urlRoot + "test/guinea-pig", "GuineaPig", "I am a page title - Sauce Labs") {
GetPage(driver);
PageFactory.InitElements(driver, this);
}

public GuineaPigPage ClickLink(WebDriver driver) {
//Could also use a "Selectors" class here.
var link = driver.FindElement(By.Id("i am a link"));
link.Click();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
wait.Until(d => d.Url.Contains("guinea-pig2"));
return this;
}

public IWebElement GetField(WebDriver driver, string fieldId) => driver.FindElement(By.Id(fieldId));

public string GetUserAgent(WebDriver driver) =>
//Could also use a "Selectors" class here.
driver.FindElement(By.Id("useragent")).Text;

public GuineaPigPage TypeField(WebDriver driver, string fieldId, string data) {
var element = GetField(driver, fieldId);
element.Clear();
element.SendKeys(data);
return this;
}
}
2 changes: 1 addition & 1 deletion ExternalMerlin.XUnit.RealDevices/ClickLinkTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ExternalMerlin.XUnit.RealDevices.PageObjects;
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using Saucery.XUnit;
using Shouldly;
using Xunit.Abstractions;
Expand Down
4 changes: 2 additions & 2 deletions ExternalMerlin.XUnit.RealDevices/DataDrivenTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using ExternalMerlin.XUnit.RealDevices.PageObjects;
using Saucery.Core.Dojo;
using Saucery.XUnit;
using Xunit.Abstractions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Saucery.XUnit" Version="4.5.9" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Saucery.Tests.Common\Saucery.Tests.Common.csproj" />
<PackageReference Include="Saucery.XUnit" Version="4.5.10" />
</ItemGroup>

</Project>
36 changes: 36 additions & 0 deletions ExternalMerlin.XUnit.RealDevices/PageObjects/GuineaPigPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using Saucery.Core.PageObjects;
using SeleniumExtras.PageObjects;

namespace ExternalMerlin.XUnit.RealDevices.PageObjects;

public class GuineaPigPage : PageObjectBase {
public GuineaPigPage(WebDriver driver, string urlRoot)
: base(urlRoot + "test/guinea-pig", "GuineaPig", "I am a page title - Sauce Labs") {
GetPage(driver);
PageFactory.InitElements(driver, this);
}

public GuineaPigPage ClickLink(WebDriver driver) {
//Could also use a "Selectors" class here.
var link = driver.FindElement(By.Id("i am a link"));
link.Click();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
wait.Until(d => d.Url.Contains("guinea-pig2"));
return this;
}

public IWebElement GetField(WebDriver driver, string fieldId) => driver.FindElement(By.Id(fieldId));

public string GetUserAgent(WebDriver driver) =>
//Could also use a "Selectors" class here.
driver.FindElement(By.Id("useragent")).Text;

public GuineaPigPage TypeField(WebDriver driver, string fieldId, string data) {
var element = GetField(driver, fieldId);
element.Clear();
element.SendKeys(data);
return this;
}
}
2 changes: 1 addition & 1 deletion ExternalMerlin.XUnit/ClickLinkTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ExternalMerlin.XUnit.PageObjects;
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using Saucery.XUnit;
using Shouldly;
using Xunit.Abstractions;
Expand Down
4 changes: 2 additions & 2 deletions ExternalMerlin.XUnit/DataDrivenTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using ExternalMerlin.XUnit.PageObjects;
using Saucery.Core.Dojo;
using Saucery.XUnit;
using Xunit.Abstractions;

Expand Down
6 changes: 1 addition & 5 deletions ExternalMerlin.XUnit/ExternalMerlin.XUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Saucery.XUnit" Version="4.5.9" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Saucery.Tests.Common\Saucery.Tests.Common.csproj" />
<PackageReference Include="Saucery.XUnit" Version="4.5.10" />
</ItemGroup>

</Project>
36 changes: 36 additions & 0 deletions ExternalMerlin.XUnit/PageObjects/GuineaPigPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using Saucery.Core.PageObjects;
using SeleniumExtras.PageObjects;

namespace ExternalMerlin.XUnit.PageObjects;

public class GuineaPigPage : PageObjectBase {
public GuineaPigPage(WebDriver driver, string urlRoot)
: base(urlRoot + "test/guinea-pig", "GuineaPig", "I am a page title - Sauce Labs") {
GetPage(driver);
PageFactory.InitElements(driver, this);
}

public GuineaPigPage ClickLink(WebDriver driver) {
//Could also use a "Selectors" class here.
var link = driver.FindElement(By.Id("i am a link"));
link.Click();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
wait.Until(d => d.Url.Contains("guinea-pig2"));
return this;
}

public IWebElement GetField(WebDriver driver, string fieldId) => driver.FindElement(By.Id(fieldId));

public string GetUserAgent(WebDriver driver) =>
//Could also use a "Selectors" class here.
driver.FindElement(By.Id("useragent")).Text;

public GuineaPigPage TypeField(WebDriver driver, string fieldId, string data) {
var element = GetField(driver, fieldId);
element.Clear();
element.SendKeys(data);
return this;
}
}

0 comments on commit 685fbb0

Please sign in to comment.