Skip to content

Commit 3c6e16a

Browse files
committed
WIP #331 - Add some suggested options
This is intended to prevent Chrome from failing to start on CI builds. I'm fine when running interactively, so I'm not changing the default config, rather introducing a new one.
1 parent a8b33c1 commit 3c6e16a

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/dotnetCi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
PullRequestParam: ${{ github.event_name == 'pull_request' && format('/d:sonar.pullrequest.key={0}', github.event.number) || '' }}
4242
DISPLAY: :99
4343
# Change selected factory to VerboseChrome to debug Chrome-related issues
44-
WebDriverFactory__SelectedConfiguration: DefaultChrome
44+
WebDriverFactory__SelectedConfiguration: CiHeadlessChrome
4545

4646
steps:
4747
- name: Checkout
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using CSF.Extensions.WebDriver.Factories;
2+
using OpenQA.Selenium.Chrome;
3+
4+
namespace CSF.Screenplay.Selenium;
5+
6+
public class CiChromeOptionsCustomizer : ICustomizesOptions<ChromeOptions>
7+
{
8+
public void CustomizeOptions(ChromeOptions options)
9+
{
10+
options.AddArguments("--disable-dev-shm-usage", "--headless", "--no-sandbox", "--window-size=1280,1024");
11+
}
12+
}

Tests/CSF.Screenplay.Selenium.Tests/appsettings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
"DriverType": "ChromeDriver",
99
"DriverFactoryType": "CSF.Screenplay.Selenium.VerboseChromeDriverFactory, CSF.Screenplay.Selenium.Tests"
1010
},
11+
"CiHeadlessChrome": {
12+
"DriverType": "ChromeDriver",
13+
"OptionsCustomizerType ": "CSF.Screenplay.Selenium.CiChromeOptionsCustomizer, CSF.Screenplay.Selenium.Tests"
14+
},
1115
"BrowserStack": {
1216
"DriverType": "RemoteWebDriver",
1317
"DriverFactoryType": "CSF.Screenplay.Selenium.BrowserStack.BrowserStackDriverFactory, CSF.Screenplay.Selenium.Tests"

0 commit comments

Comments
 (0)