Skip to content

Commit cd46bc7

Browse files
committed
Resolve #49 - Add test for customization in options
1 parent afaa8ea commit cd46bc7

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using OpenQA.Selenium.Chrome;
2+
3+
namespace CSF.Extensions.WebDriver.Factories;
4+
5+
public class SampleCustomizer : ICustomizesOptions<ChromeOptions>
6+
{
7+
public void CustomizeOptions(ChromeOptions options) { /* Intentional no-op */ }
8+
}

CSF.Extensions.WebDriver.Tests/Factories/WebDriverCreationConfigureOptionsTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,19 @@ public async Task ConfigureShouldBeAbleToGetSelectedConfigWhenThereIsOnlyOnePres
121121

122122
Assert.That(options.GetSelectedConfiguration()?.DriverType, Is.EqualTo("ChromeDriver"));
123123
}
124+
125+
[Test,AutoMoqData]
126+
public async Task ConfigureShouldBeAbleToAddACustomizerToSomeOptions([StandardTypes] IGetsWebDriverAndOptionsTypes typeProvider)
127+
{
128+
var options = await GetOptionsAsync(typeProvider,
129+
@"{
130+
""DriverConfigurations"": {
131+
""Test"": { ""DriverType"": ""ChromeDriver"", ""OptionsCustomizerType"": ""CSF.Extensions.WebDriver.Factories.SampleCustomizer, CSF.Extensions.WebDriver.Tests"" }
132+
}
133+
}");
134+
135+
Assert.That(options.GetSelectedConfiguration()?.OptionsCustomizer, Is.InstanceOf<SampleCustomizer>());
136+
}
124137

125138
[Test,AutoMoqData]
126139
public async Task ConfigureShouldBeAbleToGetSelectedConfigWhenASelectedConfigIsNamed([StandardTypes] IGetsWebDriverAndOptionsTypes typeProvider)

0 commit comments

Comments
 (0)