diff --git a/tests/integration/data/open/1.txt b/tests/integration/data/open/1.txt new file mode 100644 index 000000000..5626abf0f --- /dev/null +++ b/tests/integration/data/open/1.txt @@ -0,0 +1 @@ +one diff --git a/tests/integration/data/open/2.txt b/tests/integration/data/open/2.txt new file mode 100644 index 000000000..f719efd43 --- /dev/null +++ b/tests/integration/data/open/2.txt @@ -0,0 +1 @@ +two diff --git a/tests/integration/data/open/3.txt b/tests/integration/data/open/3.txt new file mode 100644 index 000000000..2bdf67abb --- /dev/null +++ b/tests/integration/data/open/3.txt @@ -0,0 +1 @@ +three diff --git a/tests/integration/data/open/4.txt b/tests/integration/data/open/4.txt new file mode 100644 index 000000000..851066514 --- /dev/null +++ b/tests/integration/data/open/4.txt @@ -0,0 +1 @@ +four diff --git a/tests/integration/data/open/5.txt b/tests/integration/data/open/5.txt new file mode 100644 index 000000000..54f9d6da5 --- /dev/null +++ b/tests/integration/data/open/5.txt @@ -0,0 +1 @@ +five diff --git a/tests/integration/data/open/6.txt b/tests/integration/data/open/6.txt new file mode 100644 index 000000000..ffe2fce49 --- /dev/null +++ b/tests/integration/data/open/6.txt @@ -0,0 +1 @@ +six diff --git a/tests/integration/data/open/7.txt b/tests/integration/data/open/7.txt new file mode 100644 index 000000000..d46c3b69d --- /dev/null +++ b/tests/integration/data/open/7.txt @@ -0,0 +1 @@ +seven - diff --git a/tests/integration/features/open.feature b/tests/integration/features/open.feature new file mode 100644 index 000000000..b9f747df5 --- /dev/null +++ b/tests/integration/features/open.feature @@ -0,0 +1,101 @@ +Feature: Opening pages + + Scenario: :open with URL + Given I open about:blank + When I run :open http://localhost:(port)/data/open/1.txt + And I wait until data/open/1.txt is loaded + And I run :tab-only + Then the session should look like: + windows: + - tabs: + - active: true + history: + - url: about:blank + - active: true + url: http://localhost:*/data/open/1.txt + + Scenario: :open without URL and no -t/-b/-w + When I run :open + Then the error "No URL given, but -t/-b/-w is not set!" should be shown. + + Scenario: :open without URL and -t + When I set general -> default-page to http://localhost:(port)/data/open/2.txt + And I run :open -t + Then data/open/2.txt should be loaded + + Scenario: :open with invalid URL + When I set general -> auto-search to false + And I run :open foo! + Then the error "Invalid URL" should be shown. + + Scenario: Searching with :open + When I set general -> auto-search to naive + And I set searchengines -> DEFAULT to http://localhost:(port)/data/open/{}.txt + And I run :open 3 + Then data/open/3.txt should be loaded + + Scenario: Opening in a new tab + Given I open about:blank + When I run :tab-only + And I run :open -t http://localhost:(port)/data/open/4.txt + And I wait until data/open/4.txt is loaded + Then the session should look like: + windows: + - tabs: + - history: + - url: about:blank + - active: true + history: + - active: true + url: http://localhost:*/data/open/4.txt + + Scenario: Opening in a new background tab + Given I open about:blank + When I run :tab-only + And I run :open -b http://localhost:(port)/data/open/5.txt + And I wait until data/open/5.txt is loaded + Then the session should look like: + windows: + - tabs: + - active: true + history: + - active: true + url: about:blank + - history: + - active: true + url: http://localhost:*/data/open/5.txt + + Scenario: :open with count + Given I open about:blank + When I run :tab-only + And I open about:blank in a new tab + And I run :open http://localhost:(port)/data/open/6.txt with count 2 + And I wait until data/open/6.txt is loaded + Then the session should look like: + windows: + - tabs: + - history: + - url: about:blank + - active: true + history: + - url: about:blank + - active: true + url: http://localhost:*/data/open/6.txt + + Scenario: Opening in a new window + Given I open about:blank + When I run :tab-only + And I run :open -w http://localhost:(port)/data/open/7.txt + And I wait until data/open/7.txt is loaded + Then the session should look like: + windows: + - tabs: + - active: true + history: + - active: true + url: about:blank + - tabs: + - active: true + history: + - active: true + url: http://localhost:*/data/open/7.txt diff --git a/tests/integration/features/test_open.py b/tests/integration/features/test_open.py new file mode 100644 index 000000000..3502ec1e2 --- /dev/null +++ b/tests/integration/features/test_open.py @@ -0,0 +1,21 @@ +# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: + +# Copyright 2015 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('open.feature')