From a6a2210ce86993a9921170f0eee09a158d09ed28 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 30 Mar 2016 22:16:36 +0200 Subject: [PATCH] Add tests for #879 --- .../data/sessions/history_replace_state.html | 16 ++++++++++ tests/integration/features/sessions.feature | 31 +++++++++++++++++++ tests/integration/features/test_sessions.py | 21 +++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 tests/integration/data/sessions/history_replace_state.html create mode 100644 tests/integration/features/sessions.feature create mode 100644 tests/integration/features/test_sessions.py diff --git a/tests/integration/data/sessions/history_replace_state.html b/tests/integration/data/sessions/history_replace_state.html new file mode 100644 index 000000000..c221187ae --- /dev/null +++ b/tests/integration/data/sessions/history_replace_state.html @@ -0,0 +1,16 @@ + + + + + Test title + + + + This page calls history.replaceState() via JS. + + diff --git a/tests/integration/features/sessions.feature b/tests/integration/features/sessions.feature new file mode 100644 index 000000000..9815a5da1 --- /dev/null +++ b/tests/integration/features/sessions.feature @@ -0,0 +1,31 @@ +Feature: Saving and loading sessions + + # https://github.com/The-Compiler/qutebrowser/issues/879 + + Scenario: Saving a session with a page using history.replaceState() + When I open data/sessions/history_replace_state.html + Then the javascript message "Calling history.replaceState" should be logged + And the session should look like: + windows: + - tabs: + - history: + - url: about:blank + - active: true + url: http://localhost:*/data/sessions/history_replace_state.html?state=2 + title: Test title + + Scenario: Saving a session with a page using history.replaceState() and navigating away + When I open data/sessions/history_replace_state.html + And I open data/hello.txt + Then the javascript message "Calling history.replaceState" should be logged + And the session should look like: + windows: + - tabs: + - history: + - url: about:blank + - url: http://localhost:*/data/sessions/history_replace_state.html?state=2 + # What we'd *really* expect here is "Test title", but that + # workaround is the best we can do. + title: http://localhost:*/data/sessions/history_replace_state.html?state=2 + - active: true + url: http://localhost:*/data/hello.txt diff --git a/tests/integration/features/test_sessions.py b/tests/integration/features/test_sessions.py new file mode 100644 index 000000000..0af29f414 --- /dev/null +++ b/tests/integration/features/test_sessions.py @@ -0,0 +1,21 @@ +# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: + +# Copyright 2016 Florian Bruhin (The Compiler) +# +# This file is part of qutebrowser. +# +# qutebrowser is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# qutebrowser is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with qutebrowser. If not, see . + +import pytest_bdd as bdd +bdd.scenarios('sessions.feature')