File tree 2 files changed +10
-26
lines changed
2 files changed +10
-26
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ namespace SeleniumTests.lib.Base;
5
5
6
6
public abstract class UiTestBase
7
7
{
8
- private ChromeDriver ? _driver ;
8
+ protected ChromeDriver ? Driver ;
9
9
10
10
[ SetUp ]
11
11
public void Setup ( )
@@ -18,17 +18,16 @@ public void Setup()
18
18
options . AddArgument ( "--disable-gpu" ) ;
19
19
options . AddArgument ( "--no-sandbox" ) ;
20
20
options . AddArgument ( "--disable-dev-shm-usage" ) ;
21
- options . AddArgument ( $ "--user-data-dir=/tmp/chrome-user-data-{ Guid . NewGuid ( ) } ") ;
22
21
}
23
22
24
- _driver = new ChromeDriver ( options ) ;
25
- _driver . Manage ( ) . Window . Maximize ( ) ;
23
+ Driver = new ChromeDriver ( options ) ;
24
+ Driver . Manage ( ) . Window . Maximize ( ) ;
26
25
}
27
26
28
27
[ TearDown ]
29
28
public void Teardown ( )
30
29
{
31
- _driver ? . Quit ( ) ;
32
- _driver ? . Dispose ( ) ;
30
+ Driver ? . Quit ( ) ;
31
+ Driver ? . Dispose ( ) ;
33
32
}
34
33
}
Original file line number Diff line number Diff line change
1
+ using NUnit . Framework ;
2
+ using SeleniumTests . lib . Base ;
1
3
using SeleniumTests . lib . config ;
2
- using OpenQA . Selenium . Chrome ;
3
4
using SeleniumTests . lib . pages ;
4
5
5
6
namespace SeleniumTests . tests ;
6
7
7
- public class UiHomePageTests
8
+ public class UiHomePageTests : UiTestBase
8
9
{
9
- private ChromeDriver ? _driver ;
10
-
11
- [ SetUp ]
12
- public void Setup ( )
13
- {
14
- _driver = new ChromeDriver ( ) ;
15
- _driver . Manage ( ) . Window . Maximize ( ) ;
16
- }
17
-
18
10
[ Test ]
19
11
public void HomePage_ShouldDisplay_Logo ( )
20
12
{
21
- _driver ! . Navigate ( ) . GoToUrl ( Config . BaseUrl ) ;
22
- var homePage = new HomePage ( _driver ) ;
13
+ Driver ! . Navigate ( ) . GoToUrl ( Config . BaseUrl ) ;
14
+ var homePage = new HomePage ( Driver ) ;
23
15
24
16
Assert . That ( homePage . Logo . Displayed , Is . True ) ;
25
17
}
26
-
27
- [ TearDown ]
28
- public void Teardown ( )
29
- {
30
- _driver ? . Quit ( ) ;
31
- _driver ? . Dispose ( ) ;
32
- }
33
18
}
You can’t perform that action at this time.
0 commit comments