20
20
import static org .assertj .core .api .Assertions .assertThat ;
21
21
import static org .junit .Assume .assumeTrue ;
22
22
23
+ import org .junit .After ;
23
24
import org .junit .Before ;
24
25
import org .junit .Test ;
25
26
import org .openqa .selenium .print .PageSize ;
26
27
import org .openqa .selenium .print .PrintOptions ;
27
28
import org .openqa .selenium .testing .JUnit4TestBase ;
29
+ import org .openqa .selenium .testing .NoDriverAfterTest ;
30
+ import org .openqa .selenium .testing .NoDriverBeforeTest ;
28
31
29
32
public class PrintPageTest extends JUnit4TestBase {
30
33
private static final String MAGIC_STRING = "JVBER" ;
31
34
private PrintsPage printer ;
32
35
33
36
@ Before
34
37
public void setUp () {
38
+ System .setProperty ("webdriver.chrome.headless" , "true" );
39
+ createNewDriver (new ImmutableCapabilities ());
35
40
assumeTrue (driver instanceof PrintsPage );
36
41
printer = (PrintsPage ) driver ;
37
42
driver .get (pages .printPage );
38
43
}
39
44
45
+ @ After
46
+ public void tearDown () {
47
+ System .clearProperty ("webdriver.chrome.headless" );
48
+ }
49
+
40
50
@ Test
51
+ @ NoDriverBeforeTest
52
+ @ NoDriverAfterTest
41
53
public void canPrintPage () {
42
54
PrintOptions printOptions = new PrintOptions ();
43
55
@@ -46,7 +58,9 @@ public void canPrintPage() {
46
58
}
47
59
48
60
@ Test
49
- public void canPrintwoPages () {
61
+ @ NoDriverBeforeTest
62
+ @ NoDriverAfterTest
63
+ public void canPrintTwoPages () {
50
64
PrintOptions printOptions = new PrintOptions ();
51
65
printOptions .setPageRanges ("1-2" );
52
66
@@ -55,6 +69,8 @@ public void canPrintwoPages() {
55
69
}
56
70
57
71
@ Test
72
+ @ NoDriverBeforeTest
73
+ @ NoDriverAfterTest
58
74
public void canPrintWithValidParams () {
59
75
PrintOptions printOptions = new PrintOptions ();
60
76
PageSize pageSize = new PageSize ();
0 commit comments