From 38d54cb1123683434e3bd0639c555df6ac053206 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 12 Jun 2017 18:13:17 +0200 Subject: [PATCH] Stabilize history tests Get current URL right away in :view-source, and wait until source is shown in the test. --- qutebrowser/browser/commands.py | 12 ++++++------ tests/end2end/features/history.feature | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index cfbf3e765..97a764c68 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1450,14 +1450,14 @@ class CommandDispatcher: if tab.data.viewing_source: raise cmdexc.CommandError("Already viewing source!") + try: + current_url = self._current_url() + except cmdexc.CommandError as e: + message.error(str(e)) + return + def show_source_cb(source): """Show source as soon as it's ready.""" - try: - current_url = self._current_url() - except cmdexc.CommandError as e: - message.error(str(e)) - return - lexer = pygments.lexers.HtmlLexer() formatter = pygments.formatters.HtmlFormatter( full=True, linenos='table', diff --git a/tests/end2end/features/history.feature b/tests/end2end/features/history.feature index 113cce7e7..2d02c518a 100644 --- a/tests/end2end/features/history.feature +++ b/tests/end2end/features/history.feature @@ -67,6 +67,7 @@ Feature: Page history Scenario: History with view-source URL When I open data/title.html And I run :view-source + And I wait for "Changing title for idx * to 'Source for http://localhost:*/data/title.html'" in the log Then the history file should contain: http://localhost:(port)/data/title.html Test title