diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 614428cb0c3..f1b61b320eb 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -325,6 +325,12 @@ def __init__(self, tab, parent=None): super().__init__(parent) self._tab = tab self._widget = None + self.perc_changed.connect(self._log_scroll_pos_change) + + @pyqtSlot() + def _log_scroll_pos_change(self): + log.webview.vdebug("Scroll position changed to {}".format( + self.pos_px())) def _init_widget(self, widget): self._widget = widget diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index 62af27eaa4e..100c15f0c73 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -526,6 +526,7 @@ def _get_scroll_values(quteproc): @bdd.then(bdd.parsers.re(r"the page should be scrolled " r"(?Phorizontally|vertically)")) def check_scrolled(request, quteproc, direction): + quteproc.wait_for(message='Scroll position changed to *') x, y = _get_scroll_values(quteproc) if direction == 'horizontally': assert x != 0 diff --git a/tests/end2end/features/marks.feature b/tests/end2end/features/marks.feature index af09187bbcb..4df92423bb4 100644 --- a/tests/end2end/features/marks.feature +++ b/tests/end2end/features/marks.feature @@ -8,40 +8,55 @@ Feature: Setting positional marks Scenario: Setting and jumping to a local mark When I run :scroll-px 5 10 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log And I run :set-mark a And I run :scroll-px 0 20 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 30)" in the log And I run :jump-mark a + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log Then the page should be scrolled to 5 10 Scenario: Jumping back after jumping to a particular percentage When I run :scroll-px 10 20 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 20)" in the log And I run :scroll-perc 100 + And I wait for "Scroll position changed to *" in the log And I run :jump-mark "'" + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 20)" in the log Then the page should be scrolled to 10 20 Scenario: Setting the same local mark on another page When I run :scroll-px 5 10 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log And I run :set-mark a And I open data/marks.html And I run :scroll-px 0 20 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(0, 20)" in the log And I run :set-mark a And I run :jump-mark a Then the page should be scrolled to 0 20 Scenario: Jumping to a local mark after returning to a page When I run :scroll-px 5 10 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log And I run :set-mark a + And I run :scroll-px 0 20 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 30)" in the log And I open data/numbers/1.txt And I run :set-mark a And I open data/marks.html And I run :jump-mark a + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log Then the page should be scrolled to 5 10 Scenario: Setting and jumping to a global mark When I run :scroll-px 5 20 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 20)" in the log And I run :set-mark A And I open data/numbers/1.txt + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log And I run :jump-mark A + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 20)" in the log Then data/marks.html should be loaded And the page should be scrolled to 5 20 @@ -59,10 +74,13 @@ Feature: Setting positional marks Scenario: Jumping to a local mark after changing fragments When I open data/marks.html#top And I run :scroll 'top' + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log And I run :scroll-px 10 10 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 10)" in the log And I run :set-mark a When I open data/marks.html#bottom And I run :jump-mark a + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 10)" in the log Then the page should be scrolled to 10 10 @qtwebengine_todo: Does not emit loaded signal for fragments? @@ -70,23 +88,32 @@ Feature: Setting positional marks When I hint with args "links normal" and follow s And I wait until data/marks.html#bottom is loaded And I run :jump-mark "'" + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should be scrolled to 0 0 Scenario: Jumping back after searching When I run :scroll-px 20 15 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(20, 15)" in the log And I run :search Waldo + And I wait for "Scroll position changed to *" in the log And I run :jump-mark "'" + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(20, 15)" in the log Then the page should be scrolled to 20 15 Scenario: Jumping back after search-next When I run :search Grail And I run :search-next + And I wait for "Scroll position changed to *" in the log And I run :jump-mark "'" + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should be scrolled to 0 0 Scenario: Hovering a hint does not set the ' mark When I run :scroll-px 30 20 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(30, 20)" in the log And I run :scroll-perc 0 + And I wait for "Scroll position changed to *" in the log And I hint with args "links hover" and follow s And I run :jump-mark "'" + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(30, 20)" in the log Then the page should be scrolled to 30 20 diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 85c5f63c361..157fc15b792 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -537,15 +537,20 @@ Feature: Various utility commands. Given I open data/scroll/simple.html And I run :tab-only When I run :scroll down with count 3 + And I wait for "Scroll position changed to *" in the log And I run :scroll up + And I wait for "Scroll position changed to *" in the log And I run :repeat-command with count 2 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: :repeat-command with not-normal command inbetween Given I open data/scroll/simple.html And I run :tab-only When I run :scroll down with count 3 + And I wait for "Scroll position changed to *" in the log And I run :scroll up + And I wait for "Scroll position changed to *" in the log And I run :prompt-accept And I run :repeat-command with count 2 Then the page should not be scrolled diff --git a/tests/end2end/features/scroll.feature b/tests/end2end/features/scroll.feature index 6b50a552245..f62b5ad0fef 100644 --- a/tests/end2end/features/scroll.feature +++ b/tests/end2end/features/scroll.feature @@ -17,24 +17,32 @@ Feature: Scrolling Scenario: Scrolling down and up When I run :scroll-px 10 0 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 0)" in the log And I run :scroll-px -10 0 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling right and left When I run :scroll-px 0 10 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(0, 10)" in the log And I run :scroll-px 0 -10 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling down and up with count When I run :scroll-px 0 10 with count 2 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(0, 20)" in the log When I run :scroll-px 0 -10 When I run :scroll-px 0 -10 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling left and right with count When I run :scroll-px 10 0 with count 2 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(20, 0)" in the log When I run :scroll-px -10 0 When I run :scroll-px -10 0 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: :scroll-px with a very big value @@ -44,7 +52,7 @@ Feature: Scrolling Scenario: :scroll-px on a page without scrolling When I open data/hello.txt And I run :scroll-px 10 10 - Then no crash should happen + Then the page should not be scrolled Scenario: :scroll-px with floats # This used to be allowed, but doesn't make much sense. @@ -60,7 +68,9 @@ Feature: Scrolling Scenario: Scrolling down and up When I run :scroll down + And I wait for "Scroll position changed to *" in the log And I run :scroll up + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling right @@ -69,7 +79,9 @@ Feature: Scrolling Scenario: Scrolling right and left When I run :scroll right + And I wait for "Scroll position changed to *" in the log And I run :scroll left + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled # causes segfault with postEvent instead of sendEvent @@ -83,7 +95,9 @@ Feature: Scrolling Scenario: Scrolling with page down and page up When I run :scroll page-down + And I wait for "Scroll position changed to *" in the log And I run :scroll page-up + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling to bottom @@ -92,7 +106,9 @@ Feature: Scrolling Scenario: Scrolling to bottom and to top When I run :scroll bottom + And I wait for "Scroll position changed to *" in the log And I run :scroll top + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: :scroll with invalid argument @@ -102,8 +118,10 @@ Feature: Scrolling Scenario: Scrolling down and up with count When I run :scroll down with count 2 + And I wait for "Scroll position changed to *" in the log And I run :scroll up And I run :scroll up + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling right @@ -112,13 +130,17 @@ Feature: Scrolling Scenario: Scrolling right and left When I run :scroll right + And I wait for "Scroll position changed to *" in the log And I run :scroll left + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling right and left with count When I run :scroll right with count 2 + And I wait for "Scroll position changed to *" in the log And I run :scroll left And I run :scroll left + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled @qtwebengine_skip: Causes memory leak... @@ -127,11 +149,12 @@ Feature: Scrolling # Make sure it doesn't hang And I run :message-info "Still alive!" Then the message "Still alive!" should be shown + And "Scroll position changed to *" should be logged Scenario: :scroll on a page without scrolling When I open data/hello.txt And I run :scroll down - Then no crash should happen + Then the page should not be scrolled ## :scroll-perc @@ -141,7 +164,9 @@ Feature: Scrolling Scenario: Scrolling to bottom and to top with :scroll-perc When I run :scroll-perc 100 + And I wait for "Scroll position changed to *" in the log And I run :scroll-perc 0 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling to middle with :scroll-perc @@ -154,7 +179,9 @@ Feature: Scrolling Scenario: Scrolling to middle and to top with :scroll-perc When I run :scroll-perc 50 + And I wait for "Scroll position changed to *" in the log And I run :scroll-perc 0 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling to right with :scroll-perc @@ -163,7 +190,9 @@ Feature: Scrolling Scenario: Scrolling to right and to left with :scroll-perc When I run :scroll-perc --horizontal 100 + And I wait for "Scroll position changed to *" in the log And I run :scroll-perc --horizontal 0 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling to middle (horizontally) with :scroll-perc @@ -172,7 +201,9 @@ Feature: Scrolling Scenario: Scrolling to middle and to left with :scroll-perc When I run :scroll-perc --horizontal 50 + And I wait for "Scroll position changed to *" in the log And I run :scroll-perc --horizontal 0 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: :scroll-perc without argument @@ -195,7 +226,7 @@ Feature: Scrolling Scenario: :scroll-perc on a page without scrolling When I open data/hello.txt And I run :scroll-perc 20 - Then no crash should happen + Then the page should not be scrolled Scenario: :scroll-perc with count and argument When I run :scroll-perc 0 with count 50 @@ -219,7 +250,9 @@ Feature: Scrolling Scenario: Scrolling down and up with :scroll-page When I run :scroll-page 0 1 + And I wait for "Scroll position changed to *" in the log And I run :scroll-page 0 -1 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling right with :scroll-page @@ -232,18 +265,24 @@ Feature: Scrolling Scenario: Scrolling right and left with :scroll-page When I run :scroll-page 1 0 + And I wait for "Scroll position changed to *" in the log And I run :scroll-page -1 0 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled Scenario: Scrolling right and left with :scroll-page and count When I run :scroll-page 1 0 with count 2 + And I wait for "Scroll position changed to *" in the log And I run :scroll-page -1 0 + And I wait for "Scroll position changed to *" in the log And I run :scroll-page -1 0 + And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log Then the page should not be scrolled @qtwebengine_todo: at_bottom is not implemented yet Scenario: :scroll-page with --bottom-navigate When I run :scroll-perc 100 + And I wait for "Scroll position changed to *" in the log And I run :scroll-page --bottom-navigate next 0 1 Then data/hello2.txt should be loaded @@ -259,4 +298,4 @@ Feature: Scrolling Scenario: :scroll-page on a page without scrolling When I open data/hello.txt And I run :scroll-page 1 1 - Then no crash should happen + Then the page should not be scrolled diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index 778ae732f20..f3c4ffb6212 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -262,7 +262,8 @@ def _executable_args(self): def _default_args(self): backend = 'webengine' if self.request.config.webengine else 'webkit' return ['--debug', '--no-err-windows', '--temp-basedir', - '--json-logging', '--backend', backend, 'about:blank'] + '--json-logging', '--loglevel', 'vdebug', + '--backend', backend, 'about:blank'] def path_to_url(self, path, *, port=None, https=False): """Get a URL based on a filename for the localhost webserver.