summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoofar <toofar@spalge.com>2024-04-06 12:05:31 +1300
committertoofar <toofar@spalge.com>2024-04-06 12:05:31 +1300
commit26dcc4a7a9d39f0bdac8828867845cfafdb1c5dd (patch)
tree0553ee560f7113439e446e613fdf0dea2a3bc2f3
parentb812ec2628cc90ea6b9f088de920a9fdad14231b (diff)
downloadqutebrowser-26dcc4a7a9d39f0bdac8828867845cfafdb1c5dd.tar.gz
qutebrowser-26dcc4a7a9d39f0bdac8828867845cfafdb1c5dd.zip
Add a :window-only for some qt5 end2end tests
A couple of tests seem to be failing because there is two windows open and they don't expect it. I haven't fixed the root cause, I looked through the logs and couldn't see why a second window was open. But if this makes the tests pass, I guess we can address that if someone reports it. Also changed `_get_scroll_values()` to handle multiple tabs/windows being open too while I was there. Example logs: https://github.com/qutebrowser/qutebrowser/actions/runs/8548730512/job/23422922448 Sessions file from the test logs: Current session data: windows: - geometry: !!binary | AdnQywADAAAAAAAyAAAAMgAAA1EAAAKJAAAAMgAAADIAAANRAAACiQAAAAAAAAAAAyAAAAAyAAAA MgAAA1EAAAKJ tabs: - active: true history: - active: true last_visited: '2024-04-04T03:21:00' pinned: false scroll-pos: x: 0 y: 0 title: about:blank url: about:blank zoom: 1.0 - active: true geometry: !!binary | AdnQywADAAAAAAAyAAAAMgAAA1EAAAKJAAAAMgAAADIAAANRAAACiQAAAAAAAAAAAyAAAAAyAAAA MgAAA1EAAAKJ tabs: - active: true history: - active: true last_visited: '2024-04-04T03:21:03' pinned: false scroll-pos: x: 0 y: 40 title: Scrolling url: http://localhost:39235/data/scroll/simple.html zoom: 1.0
-rw-r--r--tests/end2end/features/conftest.py11
-rw-r--r--tests/end2end/features/utilcmds.feature1
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py
index 089f0c42c..082b999b1 100644
--- a/tests/end2end/features/conftest.py
+++ b/tests/end2end/features/conftest.py
@@ -684,8 +684,15 @@ def should_quit(qtbot, quteproc):
def _get_scroll_values(quteproc):
data = quteproc.get_session()
- pos = data['windows'][0]['tabs'][0]['history'][-1]['scroll-pos']
- return (pos['x'], pos['y'])
+
+ def get_active(things):
+ return next(thing for thing in things if thing.get("active"))
+
+ active_window = get_active(data["windows"])
+ active_tab = get_active(active_window["tabs"])
+ current_entry = get_active(active_tab["history"])
+ pos = current_entry["scroll-pos"]
+ return (pos["x"], pos["y"])
@bdd.then(bdd.parsers.re(r"the page should be scrolled "
diff --git a/tests/end2end/features/utilcmds.feature b/tests/end2end/features/utilcmds.feature
index 1b5306adb..ebacea890 100644
--- a/tests/end2end/features/utilcmds.feature
+++ b/tests/end2end/features/utilcmds.feature
@@ -3,6 +3,7 @@ Feature: Miscellaneous utility commands exposed to the user.
Background:
Given I open data/scroll/simple.html
And I run :tab-only
+ And I run :window-only
## :cmd-later