45
45
'accuracy' : ANOTHER_ACCURACY ,
46
46
}
47
47
48
+ # Geolocation permissions require secure context (either `Secure` or `SecureLocalhost`).
49
+ pytestmark = pytest .mark .parametrize ('capabilities' , [{
50
+ 'acceptInsecureCerts' : True
51
+ }],
52
+ indirect = True )
53
+
48
54
49
55
async def get_geolocation (websocket , context_id ):
50
56
"""
@@ -73,11 +79,11 @@ async def get_geolocation(websocket, context_id):
73
79
74
80
75
81
@pytest .mark .asyncio
76
- async def test_geolocation_set_and_clear (websocket , context_id , url_example ,
82
+ async def test_geolocation_set_and_clear (websocket , context_id , url_bad_ssl ,
77
83
snapshot ):
78
- await goto_url (websocket , context_id , url_example )
84
+ await goto_url (websocket , context_id , url_bad_ssl )
79
85
80
- await set_permission (websocket , get_origin (url_example ),
86
+ await set_permission (websocket , get_origin (url_bad_ssl ),
81
87
{'name' : 'geolocation' }, 'granted' )
82
88
83
89
initial_geolocation = await get_geolocation (websocket , context_id )
@@ -125,10 +131,10 @@ async def test_geolocation_set_and_clear(websocket, context_id, url_example,
125
131
126
132
@pytest .mark .asyncio
127
133
async def test_geolocation_emulate_unavailable (websocket , context_id ,
128
- url_example , snapshot ):
129
- await goto_url (websocket , context_id , url_example )
134
+ url_bad_ssl , snapshot ):
135
+ await goto_url (websocket , context_id , url_bad_ssl )
130
136
131
- await set_permission (websocket , get_origin (url_example ),
137
+ await set_permission (websocket , get_origin (url_bad_ssl ),
132
138
{'name' : 'geolocation' }, 'granted' )
133
139
134
140
initial_geolocation = await get_geolocation (websocket , context_id )
@@ -165,12 +171,12 @@ async def test_geolocation_emulate_unavailable(websocket, context_id,
165
171
166
172
167
173
@pytest .mark .asyncio
168
- async def test_geolocation_per_user_context (websocket , url_example ,
174
+ async def test_geolocation_per_user_context (websocket , url_bad_ssl ,
169
175
user_context_id , create_context ,
170
176
snapshot ):
171
- await set_permission (websocket , get_origin (url_example ),
177
+ await set_permission (websocket , get_origin (url_bad_ssl ),
172
178
{'name' : 'geolocation' }, 'granted' , "default" )
173
- await set_permission (websocket , get_origin (url_example ),
179
+ await set_permission (websocket , get_origin (url_bad_ssl ),
174
180
{'name' : 'geolocation' }, 'granted' , user_context_id )
175
181
176
182
# Set different geolocation overrides for different user contexts.
@@ -193,13 +199,13 @@ async def test_geolocation_per_user_context(websocket, url_example,
193
199
194
200
# Assert the overrides applied for the right contexts.
195
201
browsing_context_id_1 = await create_context ()
196
- await goto_url (websocket , browsing_context_id_1 , url_example )
202
+ await goto_url (websocket , browsing_context_id_1 , url_bad_ssl )
197
203
emulated_geolocation_1 = await get_geolocation (websocket ,
198
204
browsing_context_id_1 )
199
205
assert emulated_geolocation_1 == snapshot ()
200
206
201
207
browsing_context_id_2 = await create_context (user_context_id )
202
- await goto_url (websocket , browsing_context_id_2 , url_example )
208
+ await goto_url (websocket , browsing_context_id_2 , url_bad_ssl )
203
209
emulated_geolocation_2 = await get_geolocation (websocket ,
204
210
browsing_context_id_2 )
205
211
assert emulated_geolocation_2 == snapshot ()
0 commit comments