From fb9415a80903738e29456a2d77370bb992ed3475 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 4 Nov 2016 07:20:48 +0100 Subject: [PATCH] bdd: Allow multiple "When I open" suffixes --- tests/end2end/features/conftest.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index 3eb4daf0d..9b7a9e2d5 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -188,19 +188,21 @@ def open_path(quteproc, path): do_not_wait_suffix = ' without waiting' as_url_suffix = ' as a URL' - if path.endswith(new_tab_suffix): - path = path[:-len(new_tab_suffix)] - new_tab = True - elif path.endswith(new_window_suffix): - path = path[:-len(new_window_suffix)] - new_window = True - elif path.endswith(as_url_suffix): - path = path[:-len(as_url_suffix)] - as_url = True - - if path.endswith(do_not_wait_suffix): - path = path[:-len(do_not_wait_suffix)] - wait = False + while True: + if path.endswith(new_tab_suffix): + path = path[:-len(new_tab_suffix)] + new_tab = True + elif path.endswith(new_window_suffix): + path = path[:-len(new_window_suffix)] + new_window = True + elif path.endswith(as_url_suffix): + path = path[:-len(as_url_suffix)] + as_url = True + elif path.endswith(do_not_wait_suffix): + path = path[:-len(do_not_wait_suffix)] + wait = False + else: + break quteproc.open_path(path, new_tab=new_tab, new_window=new_window, as_url=as_url, wait=wait)