@@ -32,7 +32,7 @@ module Chrome
32
32
end
33
33
34
34
def expect_request ( body : nil , endpoint : nil )
35
- body = ( body || { capabilities : { firstMatch : [ browserName : "chrome" ] } } ) . to_json
35
+ body = ( body || { capabilities : { alwaysMatch : { browserName : "chrome" } } } ) . to_json
36
36
endpoint ||= "#{ service_manager . uri } /session"
37
37
stub_request ( :post , endpoint ) . with ( body : body ) . to_return ( valid_response )
38
38
end
@@ -49,7 +49,7 @@ def expect_request(body: nil, endpoint: nil)
49
49
50
50
context 'with :desired capabilities' do
51
51
it 'accepts value as a Symbol' do
52
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" ] } } )
52
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" } } } )
53
53
54
54
expect {
55
55
expect { Driver . new ( desired_capabilities : :chrome ) } . to have_deprecated ( :desired_capabilities )
@@ -58,7 +58,7 @@ def expect_request(body: nil, endpoint: nil)
58
58
59
59
it 'accepts Capabilities.chrome' do
60
60
capabilities = Remote ::Capabilities . chrome ( invalid : 'foobar' )
61
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
61
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
62
62
63
63
expect {
64
64
expect { Driver . new ( desired_capabilities : capabilities ) } . to have_deprecated ( :desired_capabilities )
@@ -67,7 +67,7 @@ def expect_request(body: nil, endpoint: nil)
67
67
68
68
it 'accepts constructed Capabilities with Snake Case as Symbols' do
69
69
capabilities = Remote ::Capabilities . new ( browser_name : 'chrome' , invalid : 'foobar' )
70
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
70
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
71
71
72
72
expect {
73
73
expect { Driver . new ( desired_capabilities : capabilities ) } . to have_deprecated ( :desired_capabilities )
@@ -76,7 +76,7 @@ def expect_request(body: nil, endpoint: nil)
76
76
77
77
it 'accepts constructed Capabilities with Camel Case as Symbols' do
78
78
capabilities = Remote ::Capabilities . new ( browserName : 'chrome' , invalid : 'foobar' )
79
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
79
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
80
80
81
81
expect {
82
82
expect { Driver . new ( desired_capabilities : capabilities ) } . to have_deprecated ( :desired_capabilities )
@@ -85,7 +85,7 @@ def expect_request(body: nil, endpoint: nil)
85
85
86
86
it 'accepts constructed Capabilities with Camel Case as Strings' do
87
87
capabilities = Remote ::Capabilities . new ( 'browserName' => 'chrome' , 'invalid' => 'foobar' )
88
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
88
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
89
89
90
90
expect {
91
91
expect { Driver . new ( desired_capabilities : capabilities ) } . to have_deprecated ( :desired_capabilities )
@@ -94,7 +94,7 @@ def expect_request(body: nil, endpoint: nil)
94
94
95
95
it 'accepts Hash with Camel Case keys as Symbols' do
96
96
capabilities = { browserName : 'chrome' , invalid : 'foobar' }
97
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
97
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
98
98
99
99
expect {
100
100
expect { Driver . new ( desired_capabilities : capabilities ) } . to have_deprecated ( :desired_capabilities )
@@ -103,7 +103,7 @@ def expect_request(body: nil, endpoint: nil)
103
103
104
104
it 'accepts Hash with Camel Case keys as Strings' do
105
105
capabilities = { "browserName" => 'chrome' , "invalid" => 'foobar' }
106
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
106
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
107
107
108
108
expect {
109
109
expect { Driver . new ( desired_capabilities : capabilities ) } . to have_deprecated ( :desired_capabilities )
@@ -113,7 +113,7 @@ def expect_request(body: nil, endpoint: nil)
113
113
114
114
it 'accepts provided Options as sole parameter' do
115
115
opts = { invalid : 'foobar' , args : [ '-f' ] }
116
- expect_request ( body : { capabilities : { firstMatch : [ "browserName" : "chrome" , "goog:chromeOptions" : opts ] } } )
116
+ expect_request ( body : { capabilities : { alwaysMatch : { "browserName" : "chrome" , "goog:chromeOptions" : opts } } } )
117
117
118
118
expect {
119
119
expect { Driver . new ( options : Options . new ( **opts ) ) } . to have_deprecated ( :browser_options )
@@ -123,9 +123,9 @@ def expect_request(body: nil, endpoint: nil)
123
123
it 'accepts combination of Options and Capabilities' do
124
124
caps = Remote ::Capabilities . chrome ( invalid : 'foobar' )
125
125
browser_opts = { args : [ '-f' ] }
126
- expect_request ( body : { capabilities : { firstMatch : [ "browserName" : "chrome" ,
127
- "invalid" : "foobar" ,
128
- "goog:chromeOptions" : browser_opts ] } } )
126
+ expect_request ( body : { capabilities : { alwaysMatch : { "browserName" : "chrome" ,
127
+ "invalid" : "foobar" ,
128
+ "goog:chromeOptions" : browser_opts } } } )
129
129
130
130
expect {
131
131
expect {
@@ -141,41 +141,41 @@ def expect_request(body: nil, endpoint: nil)
141
141
142
142
context 'with :capabilities' do
143
143
it 'accepts value as a Symbol' do
144
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" ] } } )
144
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" } } } )
145
145
expect { Driver . new ( capabilities : :chrome ) } . not_to raise_exception
146
146
end
147
147
148
148
it 'accepts Capabilities.chrome' do
149
149
capabilities = Remote ::Capabilities . chrome ( invalid : 'foobar' )
150
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
150
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
151
151
152
152
expect { Driver . new ( capabilities : capabilities ) } . not_to raise_exception
153
153
end
154
154
155
155
it 'accepts constructed Capabilities with Snake Case as Symbols' do
156
156
capabilities = Remote ::Capabilities . new ( browser_name : 'chrome' , invalid : 'foobar' )
157
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
157
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
158
158
159
159
expect { Driver . new ( capabilities : capabilities ) } . not_to raise_exception
160
160
end
161
161
162
162
it 'accepts constructed Capabilities with Camel Case as Symbols' do
163
163
capabilities = Remote ::Capabilities . new ( browserName : 'chrome' , invalid : 'foobar' )
164
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
164
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
165
165
166
166
expect { Driver . new ( capabilities : capabilities ) } . not_to raise_exception
167
167
end
168
168
169
169
it 'accepts constructed Capabilities with Camel Case as Strings' do
170
170
capabilities = Remote ::Capabilities . new ( 'browserName' => 'chrome' , 'invalid' => 'foobar' )
171
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
171
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
172
172
173
173
expect { Driver . new ( capabilities : capabilities ) } . not_to raise_exception
174
174
end
175
175
176
176
it 'accepts Hash with Camel Case keys as Symbols but is deprecated' do
177
177
capabilities = { browserName : 'chrome' , invalid : 'foobar' }
178
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
178
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
179
179
180
180
expect {
181
181
expect { Driver . new ( capabilities : capabilities ) } . to have_deprecated ( :capabilities_hash )
@@ -184,7 +184,7 @@ def expect_request(body: nil, endpoint: nil)
184
184
185
185
it 'accepts Hash with Camel Case keys as Strings but is deprecated' do
186
186
capabilities = { "browserName" => 'chrome' , "invalid" => 'foobar' }
187
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
187
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
188
188
189
189
expect {
190
190
expect { Driver . new ( capabilities : capabilities ) } . to have_deprecated ( :capabilities_hash )
@@ -202,8 +202,8 @@ def as_json(*)
202
202
203
203
it 'with Options instance' do
204
204
options = Options . new ( args : [ '-f' ] )
205
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" ,
206
- 'goog:chromeOptions' : { 'args' : [ '-f' ] } ] } } )
205
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" ,
206
+ 'goog:chromeOptions' : { 'args' : [ '-f' ] } } } } )
207
207
208
208
expect { Driver . new ( capabilities : [ options ] ) } . not_to raise_exception
209
209
end
@@ -214,32 +214,32 @@ def as_json(*)
214
214
options = Options . new ( profile : profile )
215
215
216
216
expect_request ( body : { capabilities :
217
- { firstMatch : [ browserName : "chrome" ,
218
- 'goog:chromeOptions' : { "args" : [ "--user-data-dir=PROF_DIR" ] } ] } } )
217
+ { alwaysMatch : { browserName : "chrome" ,
218
+ 'goog:chromeOptions' : { "args" : [ "--user-data-dir=PROF_DIR" ] } } } } )
219
219
220
220
expect { Driver . new ( capabilities : [ options ] ) } . not_to raise_exception
221
221
end
222
222
223
223
it 'with Capabilities instance' do
224
224
capabilities = Remote ::Capabilities . new ( browser_name : 'chrome' , invalid : 'foobar' )
225
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ] } } )
225
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' } } } )
226
226
227
227
expect { Driver . new ( capabilities : [ capabilities ] ) } . not_to raise_exception
228
228
end
229
229
230
230
it 'with Options instance and an instance of a custom object responding to #as_json' do
231
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" ,
232
- 'goog:chromeOptions' : { } ,
233
- 'company:key' : 'value' ] } } )
231
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" ,
232
+ 'goog:chromeOptions' : { } ,
233
+ 'company:key' : 'value' } } } )
234
234
expect { Driver . new ( capabilities : [ Options . new , as_json_object . new ] ) } . not_to raise_exception
235
235
end
236
236
237
237
it 'with Options instance, Capabilities instance and instance of a custom object responding to #as_json' do
238
238
capabilities = Remote ::Capabilities . new ( browser_name : 'chrome' , invalid : 'foobar' )
239
239
options = Options . new ( args : [ '-f' ] )
240
- expect_request ( body : { capabilities : { firstMatch : [ browserName : "chrome" , invalid : 'foobar' ,
241
- 'goog:chromeOptions' : { 'args' : [ '-f' ] } ,
242
- 'company:key' : 'value' ] } } )
240
+ expect_request ( body : { capabilities : { alwaysMatch : { browserName : "chrome" , invalid : 'foobar' ,
241
+ 'goog:chromeOptions' : { 'args' : [ '-f' ] } ,
242
+ 'company:key' : 'value' } } } )
243
243
244
244
expect { Driver . new ( capabilities : [ capabilities , options , as_json_object . new ] ) } . not_to raise_exception
245
245
end
0 commit comments