File tree 5 files changed +46
-4
lines changed
5 files changed +46
-4
lines changed Original file line number Diff line number Diff line change 8
8
build-and-test :
9
9
runs-on : ubuntu-latest
10
10
11
+ env :
12
+ CI : true
13
+
11
14
steps :
12
15
- name : Checkout code
13
16
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 ;
2
2
3
3
public static class Config
4
4
{
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
+
6
11
public static string ApiUrl => "https://demoqa.com" ;
12
+
7
13
}
Original file line number Diff line number Diff line change 1
- using lib . config ;
1
+ using SeleniumTests . lib . config ;
2
2
3
3
namespace SeleniumTests . lib . helpers ;
4
4
Original file line number Diff line number Diff line change 1
- using lib . config ;
1
+ using SeleniumTests . lib . config ;
2
2
using OpenQA . Selenium . Chrome ;
3
3
using SeleniumTests . lib . pages ;
4
4
You can’t perform that action at this time.
0 commit comments