Skip to content

Commit

Permalink
Add more test cases for browser types
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcroft committed Mar 14, 2024
1 parent 6acf4a2 commit f32288e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions tests/Legerity.Core.Tests/Legerity.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="nunit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.18.1" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="122.0.6261.11100" />
<PackageReference Include="Selenium.WebDriver.GeckoDriver" Version="0.34.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
</ItemGroup>

Expand Down
15 changes: 8 additions & 7 deletions tests/Legerity.Core.Tests/Tests/WebAppManagerOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Drawing;
using System.IO;
using Legerity.Web;
using OpenQA.Selenium.Chrome;
using Shouldly;

namespace Legerity.Core.Tests.Tests;
Expand All @@ -11,24 +10,26 @@ namespace Legerity.Core.Tests.Tests;
[Parallelizable(ParallelScope.All)]
internal class WebAppManagerOptionsTests : BaseTestClass
{
[Test]
public void ShouldLaunchBrowserAtDesiredSize()
[TestCase(WebAppDriverType.Chrome)]
[TestCase(WebAppDriverType.Firefox)]
[TestCase(WebAppDriverType.Opera)]
public void ShouldLaunchBrowserAtDesiredSize(WebAppDriverType driverType)
{
// Arrange
var options = new WebAppManagerOptions(
WebAppDriverType.Chrome,
driverType,
Path.Combine(Environment.CurrentDirectory))
{
DesiredSize = new Size(1280, 800),
Url = "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_radio",
ImplicitWait = ImplicitWait,
DriverOptions = new ChromeOptions()
ImplicitWait = ImplicitWait
};

// Act
var app = StartApp(options);

// Assert
app.Manage().Window.Size.ShouldBe(options.DesiredSize);
var size = app.Manage().Window.Size;
size.ShouldBe(options.DesiredSize);
}
}

0 comments on commit f32288e

Please sign in to comment.