17
17
18
18
package org .openqa .selenium .ie ;
19
19
20
- import static org .assertj .core .api .Assertions .assertThat ;
21
- import static org .assertj .core .api .InstanceOfAssertFactories .LIST ;
22
- import static org .assertj .core .api .InstanceOfAssertFactories .MAP ;
23
- import static org .openqa .selenium .ie .InternetExplorerDriver .FORCE_CREATE_PROCESS ;
24
- import static org .openqa .selenium .ie .InternetExplorerDriver .IE_SWITCHES ;
25
- import static org .openqa .selenium .ie .InternetExplorerDriver .INITIAL_BROWSER_URL ;
26
- import static org .openqa .selenium .ie .InternetExplorerDriver .INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS ;
27
- import static org .openqa .selenium .ie .InternetExplorerOptions .IE_OPTIONS ;
28
-
29
- import org .junit .jupiter .api .Test ;
30
20
import org .junit .jupiter .api .Tag ;
21
+ import org .junit .jupiter .api .Test ;
31
22
import org .openqa .selenium .Capabilities ;
32
23
import org .openqa .selenium .ImmutableCapabilities ;
33
24
import org .openqa .selenium .Platform ;
36
27
37
28
import java .util .Map ;
38
29
30
+ import static org .assertj .core .api .Assertions .assertThat ;
31
+ import static org .assertj .core .api .InstanceOfAssertFactories .MAP ;
32
+ import static org .openqa .selenium .ie .InternetExplorerDriver .FORCE_CREATE_PROCESS ;
33
+ import static org .openqa .selenium .ie .InternetExplorerDriver .IE_SWITCHES ;
34
+ import static org .openqa .selenium .ie .InternetExplorerDriver .INITIAL_BROWSER_URL ;
35
+ import static org .openqa .selenium .ie .InternetExplorerDriver .INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS ;
36
+ import static org .openqa .selenium .ie .InternetExplorerOptions .IE_OPTIONS ;
37
+
39
38
@ Tag ("UnitTests" )
40
39
public class InternetExplorerOptionsTest {
41
40
@@ -51,26 +50,27 @@ public void shouldAllowACapabilityToBeSet() {
51
50
public void shouldMirrorCapabilitiesForIeProperly () {
52
51
String expected = "http://cheese.example.com" ;
53
52
InternetExplorerOptions options = new InternetExplorerOptions ()
54
- .withInitialBrowserUrl (expected );
53
+ .withInitialBrowserUrl (expected );
55
54
56
55
Map <String , Object > map = options .asMap ();
57
56
58
- assertThat (map ).containsEntry (INITIAL_BROWSER_URL , expected );
59
- assertThat (map ).containsKey ("se:ieOptions" );
60
- assertThat (map .get ("se:ieOptions" )).asInstanceOf (MAP )
61
- .containsEntry (INITIAL_BROWSER_URL , expected );
57
+ assertThat (map ).containsKey (IE_OPTIONS );
58
+ assertThat (map .get (IE_OPTIONS )).asInstanceOf (MAP )
59
+ .containsEntry (INITIAL_BROWSER_URL , expected );
62
60
}
63
61
64
62
@ Test
65
63
public void shouldMirrorCapabilitiesFromPassedInIeOptions () {
66
64
InternetExplorerOptions toMirror = new InternetExplorerOptions ()
67
- .introduceFlakinessByIgnoringSecurityDomains ();
65
+ .introduceFlakinessByIgnoringSecurityDomains ();
68
66
69
67
// This is damn weird.
70
68
InternetExplorerOptions options = new InternetExplorerOptions ();
71
- options .setCapability ("se:ieOptions" , toMirror );
69
+ options .setCapability (IE_OPTIONS , toMirror );
72
70
73
- assertThat (options .is (INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS )).isTrue ();
71
+ Map <String , Object > map = options .asMap ();
72
+ assertThat (map .get (IE_OPTIONS )).asInstanceOf (MAP )
73
+ .containsEntry (INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS , true );
74
74
}
75
75
76
76
@ Test
@@ -80,8 +80,7 @@ public void shouldPopulateIeOptionsFromExistingCapabilitiesWhichLackThem() {
80
80
81
81
InternetExplorerOptions options = new InternetExplorerOptions (caps );
82
82
83
- assertThat (options .is (INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS )).isTrue ();
84
- assertThat (options .getCapability ("se:ieOptions" )).asInstanceOf (MAP )
83
+ assertThat (options .getCapability (IE_OPTIONS )).asInstanceOf (MAP )
85
84
.containsEntry (INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS , true );
86
85
}
87
86
@@ -116,15 +115,13 @@ public void shouldSetIeOptionsCapabilityWhenConstructedFromExistingCapabilities(
116
115
117
116
@ Test
118
117
public void mergingOptionsMergesArguments () {
119
- InternetExplorerOptions one = new InternetExplorerOptions ().useCreateProcessApiToLaunchIe ().addCommandSwitches ("-private" );
118
+ InternetExplorerOptions one = new InternetExplorerOptions ()
119
+ .useCreateProcessApiToLaunchIe ()
120
+ .addCommandSwitches ("-private" );
120
121
InternetExplorerOptions two = new InternetExplorerOptions ();
121
- InternetExplorerOptions merged = one .merge (two );
122
+ InternetExplorerOptions merged = two .merge (one );
122
123
123
124
Map <String , Object > asMap = merged .asMap ();
124
- assertThat (asMap )
125
- .containsEntry (FORCE_CREATE_PROCESS , true )
126
- .extractingByKey (IE_SWITCHES ).asInstanceOf (LIST )
127
- .containsExactly ("-private" );
128
125
assertThat (asMap )
129
126
.extractingByKey (IE_OPTIONS ).asInstanceOf (MAP )
130
127
.containsEntry (FORCE_CREATE_PROCESS , true )
0 commit comments