mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-09 05:18:47 +00:00
Run ChromeDriver in headless mode if in a CI environment
This commit is contained in:
parent
281be33640
commit
f36038910a
1 changed files with 10 additions and 1 deletions
|
@ -19,7 +19,7 @@ namespace ProjectLighthouse.Tests.WebsiteTests
|
||||||
public readonly IWebHost WebHost = new WebHostBuilder().UseKestrel().UseStartup<TestStartup>().UseWebRoot("StaticFiles").Build();
|
public readonly IWebHost WebHost = new WebHostBuilder().UseKestrel().UseStartup<TestStartup>().UseWebRoot("StaticFiles").Build();
|
||||||
public readonly string BaseAddress;
|
public readonly string BaseAddress;
|
||||||
|
|
||||||
public readonly IWebDriver Driver = new ChromeDriver();
|
public readonly IWebDriver Driver;
|
||||||
|
|
||||||
public AuthenticationTests()
|
public AuthenticationTests()
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,15 @@ namespace ProjectLighthouse.Tests.WebsiteTests
|
||||||
if (serverAddressesFeature == null) throw new ArgumentNullException();
|
if (serverAddressesFeature == null) throw new ArgumentNullException();
|
||||||
|
|
||||||
this.BaseAddress = serverAddressesFeature.Addresses.First();
|
this.BaseAddress = serverAddressesFeature.Addresses.First();
|
||||||
|
|
||||||
|
ChromeOptions chromeOptions = new();
|
||||||
|
if (Convert.ToBoolean(Environment.GetEnvironmentVariable("CI") ?? "false"))
|
||||||
|
{
|
||||||
|
chromeOptions.AddArgument("headless");
|
||||||
|
Console.WriteLine("We are in a CI environment, so chrome headless mode has been enabled.");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Driver = new ChromeDriver(chromeOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DatabaseFact]
|
[DatabaseFact]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue