diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index 90a41339a..0752c3ed6 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -98,17 +98,24 @@ def fresh_instance(quteproc): def open_path(quteproc, path): """Open a URL. - If used like "When I open ... in a new tab", the URL is opened ina new - tab. + If used like "When I open ... in a new tab", the URL is opened in a new + tab. With "... in a new window", it's opened in a new window. """ new_tab_suffix = ' in a new tab' + new_window_suffix = ' in a new window' if path.endswith(new_tab_suffix): path = path[:-len(new_tab_suffix)] new_tab = True + new_window = False + elif path.endswith(new_window_suffix): + path = path[:-len(new_window_suffix)] + new_tab = False + new_window = True else: new_tab = False + new_window = False - quteproc.open_path(path, new_tab=new_tab) + quteproc.open_path(path, new_tab=new_tab, new_window=new_window) @bdd.when(bdd.parsers.parse("I set {sect} -> {opt} to {value}")) diff --git a/tests/integration/quteprocess.py b/tests/integration/quteprocess.py index 5d7b150e0..b981fca7a 100644 --- a/tests/integration/quteprocess.py +++ b/tests/integration/quteprocess.py @@ -269,11 +269,16 @@ class QuteProc(testprocess.Process): yield self.set_setting(sect, opt, old_value) - def open_path(self, path, new_tab=False): + def open_path(self, path, new_tab=False, new_window=False): """Open the given path on the local webserver in qutebrowser.""" + if new_tab and new_window: + raise ValueError("new_tab and new_window given!") + url = self.path_to_url(path) if new_tab: self.send_cmd(':open -t ' + url) + elif new_window: + self.send_cmd(':open -w ' + url) else: self.send_cmd(':open ' + url) self.wait_for_load_finished(path)