File tree Expand file tree Collapse file tree 5 files changed +46
-4
lines changed Expand file tree Collapse file tree 5 files changed +46
-4
lines changed Original file line number Diff line number Diff line change 88 build-and-test :
99 runs-on : ubuntu-latest
1010
11+ env :
12+ CI : true
13+
1114 steps :
1215 - name : Checkout code
1316 uses : actions/checkout@v3
Original file line number Diff line number Diff line change 1+ using SeleniumTests . lib . config ;
2+ using OpenQA . Selenium . Chrome ;
3+
4+ namespace SeleniumTests . lib . Base ;
5+
6+ public abstract class UiTestBase
7+ {
8+ private ChromeDriver ? _driver ;
9+
10+ [ SetUp ]
11+ public void Setup ( )
12+ {
13+ var options = new ChromeOptions ( ) ;
14+
15+ if ( Config . IsCi )
16+ {
17+ options . AddArgument ( "--headless=new" ) ;
18+ options . AddArgument ( "--disable-gpu" ) ;
19+ options . AddArgument ( "--no-sandbox" ) ;
20+ options . AddArgument ( "--disable-dev-shm-usage" ) ;
21+ }
22+
23+ _driver = new ChromeDriver ( options ) ;
24+ _driver . Manage ( ) . Window . Maximize ( ) ;
25+ }
26+
27+ [ TearDown ]
28+ public void Teardown ( )
29+ {
30+ _driver ? . Quit ( ) ;
31+ _driver ? . Dispose ( ) ;
32+ }
33+ }
Original file line number Diff line number Diff line change 1- namespace lib . config ;
1+ namespace SeleniumTests . lib . config ;
22
33public static class Config
44{
5- public static string BaseUrl => "https://demoqa.com" ;
5+ public static string BaseUrl =>
6+ Environment . GetEnvironmentVariable ( "BASE_URL" ) ?? "https://demoqa.com" ;
7+
8+ public static bool IsCi =>
9+ Environment . GetEnvironmentVariable ( "CI" ) ? . ToLower ( ) == "true" ;
10+
611 public static string ApiUrl => "https://demoqa.com" ;
12+
713}
Original file line number Diff line number Diff line change 1- using lib . config ;
1+ using SeleniumTests . lib . config ;
22
33namespace SeleniumTests . lib . helpers ;
44
Original file line number Diff line number Diff line change 1- using lib . config ;
1+ using SeleniumTests . lib . config ;
22using OpenQA . Selenium . Chrome ;
33using SeleniumTests . lib . pages ;
44
You can’t perform that action at this time.
0 commit comments