2017-03-31 17:16:31 +02:00
|
|
|
# vim: ft=cucumber fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
2016-01-20 21:24:51 +01:00
|
|
|
Feature: Javascript stuff
|
|
|
|
|
|
|
|
Integration with javascript.
|
|
|
|
|
2016-07-13 10:25:21 +02:00
|
|
|
Scenario: Using console.log
|
2017-09-13 22:26:38 +02:00
|
|
|
When I open data/javascript/consolelog.html
|
2016-07-13 10:25:21 +02:00
|
|
|
Then the javascript message "console.log works!" should be logged
|
|
|
|
|
2018-07-03 14:15:08 +02:00
|
|
|
@skip # Too flaky
|
2016-09-05 14:34:52 +02:00
|
|
|
Scenario: Opening/Closing a window via JS
|
|
|
|
When I open data/javascript/window_open.html
|
|
|
|
And I run :tab-only
|
|
|
|
And I run :click-element id open-normal
|
|
|
|
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
|
2018-03-25 19:56:48 +02:00
|
|
|
And I wait for "[*] window closed" in the log
|
2016-09-05 14:34:52 +02:00
|
|
|
Then "Focus object changed: *" should be logged
|
2018-03-25 19:56:48 +02:00
|
|
|
And the following tabs should be open:
|
|
|
|
- data/javascript/window_open.html (active)
|
2016-09-05 14:34:52 +02:00
|
|
|
|
2018-07-22 12:05:55 +02:00
|
|
|
@skip # Too flaky
|
2016-09-05 14:34:52 +02:00
|
|
|
Scenario: Opening/closing a modal window via JS
|
|
|
|
When I open data/javascript/window_open.html
|
|
|
|
And I run :tab-only
|
|
|
|
And I run :click-element id open-modal
|
|
|
|
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
|
2018-03-25 19:56:48 +02:00
|
|
|
And I wait for "[*] window closed" in the log
|
2016-09-05 14:34:52 +02:00
|
|
|
Then "Focus object changed: *" should be logged
|
2016-09-05 14:45:34 +02:00
|
|
|
And "Web*Dialog requested, but we don't support that!" should be logged
|
2018-03-25 19:56:48 +02:00
|
|
|
And the following tabs should be open:
|
|
|
|
- data/javascript/window_open.html (active)
|
2016-09-05 14:34:52 +02:00
|
|
|
|
2017-02-05 00:13:11 +01:00
|
|
|
# https://github.com/qutebrowser/qutebrowser/issues/906
|
2016-01-20 21:24:51 +01:00
|
|
|
|
2016-09-05 10:54:28 +02:00
|
|
|
@qtwebengine_skip
|
|
|
|
Scenario: Closing a JS window twice (issue 906) - qtwebkit
|
2016-01-20 21:24:51 +01:00
|
|
|
When I open about:blank
|
2016-09-05 14:34:52 +02:00
|
|
|
And I run :tab-only
|
2016-11-15 19:36:32 +01:00
|
|
|
And I open data/javascript/window_open.html in a new tab
|
2016-09-05 14:41:05 +02:00
|
|
|
And I run :click-element id open-normal
|
2016-01-24 18:43:07 +01:00
|
|
|
And I wait for "Changing title for idx 2 to 'about:blank'" in the log
|
2016-01-20 21:24:51 +01:00
|
|
|
And I run :tab-focus 2
|
2016-09-05 14:41:05 +02:00
|
|
|
And I run :click-element id close-twice
|
2018-03-25 19:56:48 +02:00
|
|
|
And I wait for "[*] window closed" in the log
|
2016-01-20 21:24:51 +01:00
|
|
|
Then "Requested to close * which does not exist!" should be logged
|
2016-09-05 15:53:31 +02:00
|
|
|
|
2016-11-15 20:17:51 +01:00
|
|
|
@qtwebkit_skip @flaky
|
2016-09-05 15:53:31 +02:00
|
|
|
Scenario: Closing a JS window twice (issue 906) - qtwebengine
|
|
|
|
When I open about:blank
|
|
|
|
And I run :tab-only
|
|
|
|
And I open data/javascript/window_open.html in a new tab
|
|
|
|
And I run :click-element id open-normal
|
|
|
|
And I wait for "Changing title for idx 2 to 'about:blank'" in the log
|
2017-06-19 15:48:17 +02:00
|
|
|
And I run :buffer window_open.html
|
2016-09-05 15:53:31 +02:00
|
|
|
And I run :click-element id close-twice
|
|
|
|
And I wait for "Focus object changed: *" in the log
|
2018-03-25 19:56:48 +02:00
|
|
|
And I wait for "[*] window closed" in the log
|
2016-09-05 15:53:31 +02:00
|
|
|
Then no crash should happen
|
2016-09-05 17:25:52 +02:00
|
|
|
|
2017-09-17 10:36:28 +02:00
|
|
|
@flaky
|
2017-07-04 15:43:54 +02:00
|
|
|
Scenario: Opening window without user interaction with content.javascript.can_open_tabs_automatically set to true
|
2016-09-05 17:25:52 +02:00
|
|
|
When I open data/hello.txt
|
2017-07-03 16:04:17 +02:00
|
|
|
And I set content.javascript.can_open_tabs_automatically to true
|
2016-09-05 17:25:52 +02:00
|
|
|
And I run :tab-only
|
|
|
|
And I run :jseval if (window.open('about:blank')) { console.log('window opened'); } else { console.log('error while opening window'); }
|
|
|
|
Then the javascript message "window opened" should be logged
|
|
|
|
|
2017-09-21 08:58:56 +02:00
|
|
|
@flaky
|
2017-07-04 15:43:54 +02:00
|
|
|
Scenario: Opening window without user interaction with javascript.can_open_tabs_automatically set to false
|
2016-09-05 17:25:52 +02:00
|
|
|
When I open data/hello.txt
|
2017-07-03 16:04:17 +02:00
|
|
|
And I set content.javascript.can_open_tabs_automatically to false
|
2016-09-05 17:25:52 +02:00
|
|
|
And I run :tab-only
|
|
|
|
And I run :jseval if (window.open('about:blank')) { console.log('window opened'); } else { console.log('error while opening window'); }
|
|
|
|
Then the javascript message "error while opening window" should be logged
|
2016-10-21 00:31:02 +02:00
|
|
|
|
|
|
|
Scenario: Executing jseval when javascript is disabled
|
2017-06-16 16:22:41 +02:00
|
|
|
When I set content.javascript.enabled to false
|
2016-10-21 00:31:02 +02:00
|
|
|
And I run :jseval console.log('jseval executed')
|
2017-06-16 18:16:19 +02:00
|
|
|
And I set content.javascript.enabled to true
|
2016-10-21 00:31:02 +02:00
|
|
|
Then the javascript message "jseval executed" should be logged
|
2017-04-28 15:16:36 +02:00
|
|
|
|
|
|
|
## webelement issues (mostly with QtWebEngine)
|
|
|
|
|
|
|
|
# https://github.com/qutebrowser/qutebrowser/issues/2569
|
|
|
|
Scenario: Clicking on form element with tagName child
|
|
|
|
When I open data/issue2569.html
|
2017-04-28 19:11:02 +02:00
|
|
|
And I run :click-element id tagnameform
|
|
|
|
And I wait for "Sending fake click to *" in the log
|
|
|
|
Then no crash should happen
|
|
|
|
|
|
|
|
Scenario: Clicking on form element with text child
|
|
|
|
When I open data/issue2569.html
|
|
|
|
And I run :click-element id textform
|
2017-04-28 17:29:19 +02:00
|
|
|
And I wait for "Sending fake click to *" in the log
|
2017-04-28 15:16:36 +02:00
|
|
|
Then no crash should happen
|
|
|
|
|
2018-01-14 20:20:51 +01:00
|
|
|
Scenario: Clicking on form element with value child
|
|
|
|
When I open data/issue2569.html
|
|
|
|
And I run :click-element id valueform
|
|
|
|
And I wait for "Sending fake click to *" in the log
|
|
|
|
Then no crash should happen
|
|
|
|
|
2017-04-28 15:16:36 +02:00
|
|
|
Scenario: Clicking on svg element
|
|
|
|
When I open data/issue2569.html
|
|
|
|
And I run :click-element id icon
|
2017-04-28 17:29:19 +02:00
|
|
|
And I wait for "Sending fake click to *" in the log
|
2017-04-28 15:16:36 +02:00
|
|
|
Then no crash should happen
|
|
|
|
|
|
|
|
Scenario: Clicking on li element
|
|
|
|
When I open data/issue2569.html
|
|
|
|
And I run :click-element id listitem
|
2017-04-28 17:29:19 +02:00
|
|
|
And I wait for "Sending fake click to *" in the log
|
2017-04-28 15:16:36 +02:00
|
|
|
Then no crash should happen
|
2017-06-11 17:45:18 +02:00
|
|
|
|
|
|
|
# We load the tab in the background, and the HTML sets the window size for
|
|
|
|
# when it's hidden.
|
|
|
|
# Then, "the window sizes should be the same" uses :jseval to set the size
|
|
|
|
# when it's shown, and compares the two.
|
|
|
|
# https://github.com/qutebrowser/qutebrowser/issues/1190
|
|
|
|
# https://github.com/qutebrowser/qutebrowser/issues/2495
|
|
|
|
|
|
|
|
Scenario: Checking visible/invisible window size
|
|
|
|
When I run :tab-only
|
|
|
|
And I open data/javascript/windowsize.html in a new background tab
|
|
|
|
And I wait for "[*/data/javascript/windowsize.html:*] loaded" in the log
|
|
|
|
And I run :tab-next
|
|
|
|
Then the window sizes should be the same
|
2017-06-16 23:00:16 +02:00
|
|
|
|
|
|
|
Scenario: Checking visible/invisible window size with vertical tabbar
|
|
|
|
When I run :tab-only
|
2017-06-16 18:16:19 +02:00
|
|
|
And I set tabs.position to left
|
2017-06-16 23:00:16 +02:00
|
|
|
And I open data/javascript/windowsize.html in a new background tab
|
|
|
|
And I wait for "[*/data/javascript/windowsize.html:*] loaded" in the log
|
|
|
|
And I run :tab-next
|
|
|
|
Then the window sizes should be the same
|
2017-10-10 09:59:27 +02:00
|
|
|
|
2018-03-11 14:29:54 +01:00
|
|
|
@flaky
|
2017-12-06 11:50:59 +01:00
|
|
|
Scenario: Have a GreaseMonkey script run at page start
|
|
|
|
When I have a GreaseMonkey file saved for document-start with noframes unset
|
2017-10-10 09:59:27 +02:00
|
|
|
And I run :greasemonkey-reload
|
2017-11-01 11:41:52 +01:00
|
|
|
And I open data/hints/iframe.html
|
2017-10-10 09:59:27 +02:00
|
|
|
# This second reload is required in webengine < 5.8 for scripts
|
|
|
|
# registered to run at document-start, some sort of timing issue.
|
|
|
|
And I run :reload
|
2017-11-01 11:41:52 +01:00
|
|
|
Then the javascript message "Script is running on /data/hints/iframe.html" should be logged
|
|
|
|
|
2017-12-06 11:50:59 +01:00
|
|
|
Scenario: Have a GreaseMonkey script running on frames
|
|
|
|
When I have a GreaseMonkey file saved for document-end with noframes unset
|
2017-11-01 11:41:52 +01:00
|
|
|
And I run :greasemonkey-reload
|
|
|
|
And I open data/hints/iframe.html
|
|
|
|
Then the javascript message "Script is running on /data/hints/html/wrapped.html" should be logged
|
|
|
|
|
2017-12-06 08:34:29 +01:00
|
|
|
@flaky
|
2017-12-06 11:50:59 +01:00
|
|
|
Scenario: Have a GreaseMonkey script running on noframes
|
|
|
|
When I have a GreaseMonkey file saved for document-end with noframes set
|
2017-11-01 11:41:52 +01:00
|
|
|
And I run :greasemonkey-reload
|
|
|
|
And I open data/hints/iframe.html
|
|
|
|
Then the javascript message "Script is running on /data/hints/html/wrapped.html" should not be logged
|
2018-02-23 15:08:07 +01:00
|
|
|
|
|
|
|
Scenario: Per-URL localstorage setting
|
|
|
|
When I set content.local_storage to false
|
|
|
|
And I run :set -u http://localhost:*/data2/* content.local_storage true
|
|
|
|
And I open data/javascript/localstorage.html
|
|
|
|
And I wait for "[*] local storage is not working" in the log
|
|
|
|
And I open data2/javascript/localstorage.html
|
|
|
|
Then the javascript message "local storage is working" should be logged
|
|
|
|
|
|
|
|
Scenario: Per-URL JavaScript setting
|
|
|
|
When I set content.javascript.enabled to false
|
|
|
|
And I run :set -u http://localhost:*/data2/* content.javascript.enabled true
|
|
|
|
And I open data2/javascript/enabled.html
|
|
|
|
And I wait for "[*] JavaScript is enabled" in the log
|
|
|
|
And I open data/javascript/enabled.html
|
|
|
|
Then the page should contain the plaintext "JavaScript is disabled"
|
2018-02-25 16:35:02 +01:00
|
|
|
|
|
|
|
@qtwebkit_skip
|
|
|
|
Scenario: Error pages without JS enabled
|
|
|
|
When I set content.javascript.enabled to false
|
2018-02-25 19:40:38 +01:00
|
|
|
And I open 500 without waiting
|
2018-02-25 16:35:02 +01:00
|
|
|
Then "Showing error page for* 500" should be logged
|
2018-03-19 17:33:02 +01:00
|
|
|
|
|
|
|
Scenario: Using JS after window.open
|
|
|
|
When I open data/hello.txt
|
|
|
|
And I set content.javascript.can_open_tabs_automatically to true
|
|
|
|
And I run :jseval window.open('about:blank')
|
|
|
|
And I open data/hello.txt
|
|
|
|
And I run :tab-only
|
|
|
|
And I open data/hints/html/simple.html
|
|
|
|
And I run :hint all
|
|
|
|
And I wait for "hints: a" in the log
|
|
|
|
And I run :leave-mode
|
|
|
|
Then "There was an error while getting hint elements" should not be logged
|