bdd: Add some tests for geolocation.
This commit is contained in:
parent
252dc5bf1b
commit
1ddf817f4c
34
tests/integration/data/prompt/geolocation.html
Normal file
34
tests/integration/data/prompt/geolocation.html
Normal file
@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script type="text/javascript">
|
||||
|
||||
function on_success(position) {
|
||||
console.log("geolocation permission granted");
|
||||
}
|
||||
|
||||
function on_error(error) {
|
||||
switch(error.code) {
|
||||
case error.PERMISSION_DENIED:
|
||||
console.log("geolocation permission denied");
|
||||
break;
|
||||
default:
|
||||
console.log("[FAIL] geolocation error: " + error.message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function get_location() {
|
||||
if ("geolocation" in navigator) {
|
||||
navigator.geolocation.getCurrentPosition(on_success, on_error);
|
||||
} else {
|
||||
console.log("[FAIL] geolocation unavailable");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<input type="button" onclick="get_location()" value="Get position">
|
||||
</body>
|
||||
</html>
|
@ -99,3 +99,41 @@ Feature: Prompts
|
||||
And I run :prompt-no
|
||||
Then "Error while loading *: SSL handshake failed" should be logged
|
||||
And the page should contain the plaintext "Unable to load page"
|
||||
|
||||
# Geolocation
|
||||
|
||||
Scenario: Always rejecting geolocation
|
||||
When I set content -> geolocation to false
|
||||
And I open data/prompt/geolocation.html
|
||||
And I click the button
|
||||
Then the javascript message "geolocation permission denied" should be logged
|
||||
|
||||
Scenario: Always accepting geolocation
|
||||
When I set content -> geolocation to true
|
||||
And I open data/prompt/geolocation.html
|
||||
And I click the button
|
||||
Then the javascript message "geolocation permission denied" should not be logged
|
||||
|
||||
Scenario: geolocation with ask -> true
|
||||
When I set content -> geolocation to ask
|
||||
And I open data/prompt/geolocation.html
|
||||
And I click the button
|
||||
And I wait for a prompt
|
||||
And I run :prompt-yes
|
||||
Then the javascript message "geolocation permission denied" should not be logged
|
||||
|
||||
Scenario: geolocation with ask -> false
|
||||
When I set content -> geolocation to ask
|
||||
And I open data/prompt/geolocation.html
|
||||
And I click the button
|
||||
And I wait for a prompt
|
||||
And I run :prompt-no
|
||||
Then the javascript message "geolocation permission denied" should be logged
|
||||
|
||||
Scenario: geolocation with ask -> abort
|
||||
When I set content -> geolocation to ask
|
||||
And I open data/prompt/geolocation.html
|
||||
And I click the button
|
||||
And I wait for a prompt
|
||||
And I run :leave-mode
|
||||
Then the javascript message "geolocation permission denied" should be logged
|
||||
|
Loading…
Reference in New Issue
Block a user