Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: taf adjustments for CI run #4

Merged
8 changes: 8 additions & 0 deletions .github/workflows/TestProjectWorkflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'

- name: Install Chrome dependencies
run: |
sudo apt-get update
sudo apt-get install -y wget unzip xvfb libxi6 libgconf-2-4
sudo apt-get install -y google-chrome-stable
google-chrome --version
which google-chrome

- name: Restore dependencies
run: dotnet restore
Expand Down
14 changes: 12 additions & 2 deletions TestProject/TestProject/Core/WebDriver/WebDriverFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Firefox;
using TestProject.Core;

namespace TestProject.WebDriver
{
Expand All @@ -14,9 +15,17 @@ public static IWebDriver CreateWebDriver(BrowserType browserType)
case BrowserType.Chrome:
{
var service = ChromeDriverService.CreateDefaultService();
ChromeOptions options = new ChromeOptions();
ChromeOptions options = new();
options.AddArgument("--no-sandbox");
options.AddArgument("disable-infobars");
options.AddArgument("--incognito");
options.AddArgument("--disable-dev-shm-usage");

// Add headless run option
if (Configuration.Headless)
{
options.AddArgument("--headless");
}
return new ChromeDriver(service, options, TimeSpan.FromSeconds(30));
}
case BrowserType.Edge:
Expand All @@ -28,10 +37,11 @@ public static IWebDriver CreateWebDriver(BrowserType browserType)
}
}
}

public enum BrowserType
{
Chrome,
Edge,
Firefox
}
}
}
1 change: 0 additions & 1 deletion TestProject/TestProject/TestProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Selenium.Support" Version="4.22.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.22.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="126.0.6478.12600" />
<PackageReference Include="Serilog" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion TestProject/TestProject/Tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
{
public abstract class BaseTest
{
protected WebDriverWrapper WebDriverWrapper { get; private set; }

Check warning on line 10 in TestProject/TestProject/Tests/BaseTest.cs

View workflow job for this annotation

GitHub Actions / Build and tests

Non-nullable property 'WebDriverWrapper' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
protected Logger Logger { get; private set; }

Check warning on line 11 in TestProject/TestProject/Tests/BaseTest.cs

View workflow job for this annotation

GitHub Actions / Build and tests

Non-nullable property 'Logger' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[SetUp]
public virtual void SetUp()
Expand All @@ -20,7 +20,7 @@
WebDriverWrapper.StartBrowser();
WebDriverWrapper.NavigateTo(Configuration.AppUrl);

Logger = Logger ?? new Logger();
Logger ??= new Logger();
}

[TearDown]
Expand Down
3 changes: 2 additions & 1 deletion TestProject/TestProject/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"BrowserType": "Chrome",
"ApplicationUrl": "https://www.epam.com",
"TestDataPath": "Data/TestData.json"
"TestDataPath": "Data/TestData.json",
"Headless": true
}
Loading