Improve window_open.html tests

This commit is contained in:
Florian Bruhin 2018-03-25 19:56:48 +02:00
parent 91ca7d0911
commit d4ea1df232
2 changed files with 12 additions and 2 deletions

View File

@ -3,10 +3,10 @@
<head>
<script type="text/javascript">
var my_window;
let my_window;
function open_modal() {
window.open('about:blank', 'window', 'modal');
my_window = window.open('about:blank', 'window', 'modal');
}
function open_normal() {
@ -19,11 +19,13 @@
function close_normal() {
my_window.close();
console.log("window closed");
}
function close_twice() {
my_window.close();
my_window.close();
console.log("window closed");
}
</script>
</head>

View File

@ -15,7 +15,10 @@ Feature: Javascript stuff
And I wait for "Changing title for idx 1 to 'about:blank'" in the log
And I run :tab-focus 1
And I run :click-element id close-normal
And I wait for "[*] window closed" in the log
Then "Focus object changed: *" should be logged
And the following tabs should be open:
- data/javascript/window_open.html (active)
@qtwebkit_skip
Scenario: Opening/closing a modal window via JS
@ -25,8 +28,11 @@ Feature: Javascript stuff
And I wait for "Changing title for idx 1 to 'about:blank'" in the log
And I run :tab-focus 1
And I run :click-element id close-normal
And I wait for "[*] window closed" in the log
Then "Focus object changed: *" should be logged
And "Web*Dialog requested, but we don't support that!" should be logged
And the following tabs should be open:
- data/javascript/window_open.html (active)
# https://github.com/qutebrowser/qutebrowser/issues/906
@ -39,6 +45,7 @@ Feature: Javascript stuff
And I wait for "Changing title for idx 2 to 'about:blank'" in the log
And I run :tab-focus 2
And I run :click-element id close-twice
And I wait for "[*] window closed" in the log
Then "Requested to close * which does not exist!" should be logged
@qtwebkit_skip @flaky
@ -51,6 +58,7 @@ Feature: Javascript stuff
And I run :buffer window_open.html
And I run :click-element id close-twice
And I wait for "Focus object changed: *" in the log
And I wait for "[*] window closed" in the log
Then no crash should happen
@flaky