File tree Expand file tree Collapse file tree 2 files changed +10
-26
lines changed Expand file tree Collapse file tree 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;
55
66public abstract class UiTestBase
77{
8- private ChromeDriver ? _driver ;
8+ protected ChromeDriver ? Driver ;
99
1010 [ SetUp ]
1111 public void Setup ( )
@@ -18,17 +18,16 @@ public void Setup()
1818 options . AddArgument ( "--disable-gpu" ) ;
1919 options . AddArgument ( "--no-sandbox" ) ;
2020 options . AddArgument ( "--disable-dev-shm-usage" ) ;
21- options . AddArgument ( $ "--user-data-dir=/tmp/chrome-user-data-{ Guid . NewGuid ( ) } ") ;
2221 }
2322
24- _driver = new ChromeDriver ( options ) ;
25- _driver . Manage ( ) . Window . Maximize ( ) ;
23+ Driver = new ChromeDriver ( options ) ;
24+ Driver . Manage ( ) . Window . Maximize ( ) ;
2625 }
2726
2827 [ TearDown ]
2928 public void Teardown ( )
3029 {
31- _driver ? . Quit ( ) ;
32- _driver ? . Dispose ( ) ;
30+ Driver ? . Quit ( ) ;
31+ Driver ? . Dispose ( ) ;
3332 }
3433}
Original file line number Diff line number Diff line change 1+ using NUnit . Framework ;
2+ using SeleniumTests . lib . Base ;
13using SeleniumTests . lib . config ;
2- using OpenQA . Selenium . Chrome ;
34using SeleniumTests . lib . pages ;
45
56namespace SeleniumTests . tests ;
67
7- public class UiHomePageTests
8+ public class UiHomePageTests : UiTestBase
89{
9- private ChromeDriver ? _driver ;
10-
11- [ SetUp ]
12- public void Setup ( )
13- {
14- _driver = new ChromeDriver ( ) ;
15- _driver . Manage ( ) . Window . Maximize ( ) ;
16- }
17-
1810 [ Test ]
1911 public void HomePage_ShouldDisplay_Logo ( )
2012 {
21- _driver ! . Navigate ( ) . GoToUrl ( Config . BaseUrl ) ;
22- var homePage = new HomePage ( _driver ) ;
13+ Driver ! . Navigate ( ) . GoToUrl ( Config . BaseUrl ) ;
14+ var homePage = new HomePage ( Driver ) ;
2315
2416 Assert . That ( homePage . Logo . Displayed , Is . True ) ;
2517 }
26-
27- [ TearDown ]
28- public void Teardown ( )
29- {
30- _driver ? . Quit ( ) ;
31- _driver ? . Dispose ( ) ;
32- }
3318}
You can’t perform that action at this time.
0 commit comments