diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index 72074e247..80d89bd35 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -535,31 +535,47 @@ def check_open_tabs(quteproc, request, tabs): """ session = quteproc.get_session() active_suffix = ' (active)' + pinned_suffix = ' (pinned)' tabs = tabs.splitlines() assert len(session['windows']) == 1 assert len(session['windows'][0]['tabs']) == len(tabs) # If we don't have (active) anywhere, don't check it - has_active = any(line.endswith(active_suffix) for line in tabs) + has_active = any(active_suffix in line for line in tabs) + has_pinned = any(pinned_suffix in line for line in tabs) for i, line in enumerate(tabs): line = line.strip() assert line.startswith('- ') line = line[2:] # remove "- " prefix - if line.endswith(active_suffix): - path = line[:-len(active_suffix)] - active = True - else: - path = line - active = False + + path = line + active = False + pinned = False + + while line.endswith(active_suffix) or line.endswith(pinned_suffix): + if line.endswith(active_suffix): + # active + line = line[:-len(active_suffix)] + active = True + else: + # pinned + line = line[:-len(pinned_suffix)] + pinned = True session_tab = session['windows'][0]['tabs'][i] - assert session_tab['history'][-1]['url'] == quteproc.path_to_url(path) + current_page = session_tab['history'][-1] + assert current_page['url'] == quteproc.path_to_url(line) if active: assert session_tab['active'] elif has_active: assert 'active' not in session_tab + if pinned: + assert current_page['pinned'] + elif has_pinned: + assert not current_page['pinned'] + @bdd.then(bdd.parsers.re(r'the (?Pprimary selection|clipboard) should ' r'contain "(?P.*)"')) diff --git a/tests/end2end/features/sessions.feature b/tests/end2end/features/sessions.feature index eb1d81e60..5ec6e168a 100644 --- a/tests/end2end/features/sessions.feature +++ b/tests/end2end/features/sessions.feature @@ -386,5 +386,5 @@ Feature: Saving and loading sessions Then the message "Tab is pinned!" should be shown And the following tabs should be open: - data/numbers/1.txt - - data/numbers/2.txt (active) + - data/numbers/2.txt (active) (pinned) - data/numbers/3.txt diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index 3816e7f1e..bec952d48 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -1037,16 +1037,17 @@ Feature: Tab management Then the following tabs should be open: - data/numbers/1.txt - data/numbers/2.txt - - data/numbers/3.txt (active) + - data/numbers/3.txt (active) (pinned) Scenario: :tab-pin unpin When I open data/numbers/1.txt + And I run :tab-pin And I open data/numbers/2.txt in a new tab And I open data/numbers/3.txt in a new tab And I run :tab-pin And I run :tab-pin Then the following tabs should be open: - - data/numbers/1.txt + - data/numbers/1.txt (pinned) - data/numbers/2.txt - data/numbers/3.txt (active) @@ -1057,7 +1058,7 @@ Feature: Tab management And I run :tab-pin with count 2 Then the following tabs should be open: - data/numbers/1.txt - - data/numbers/2.txt + - data/numbers/2.txt (pinned) - data/numbers/3.txt (active) Scenario: Pinned :tab-close prompt yes @@ -1069,7 +1070,7 @@ Feature: Tab management And I wait for "*want to close a pinned tab*" in the log And I run :prompt-accept yes Then the following tabs should be open: - - data/numbers/1.txt (active) + - data/numbers/1.txt (active) (pinned) Scenario: Pinned :tab-close prompt no When I open data/numbers/1.txt @@ -1080,8 +1081,8 @@ Feature: Tab management And I wait for "*want to close a pinned tab*" in the log And I run :prompt-accept no Then the following tabs should be open: - - data/numbers/1.txt - - data/numbers/2.txt (active) + - data/numbers/1.txt (pinned) + - data/numbers/2.txt (active) (pinned) Scenario: Pinned :tab-only prompt yes When I open data/numbers/1.txt @@ -1093,7 +1094,7 @@ Feature: Tab management And I wait for "*want to close a pinned tab*" in the log And I run :prompt-accept yes Then the following tabs should be open: - - data/numbers/1.txt (active) + - data/numbers/1.txt (active) (pinned) Scenario: Pinned :tab-only prompt no When I open data/numbers/1.txt @@ -1105,8 +1106,8 @@ Feature: Tab management And I wait for "*want to close a pinned tab*" in the log And I run :prompt-accept no Then the following tabs should be open: - - data/numbers/1.txt (active) - - data/numbers/2.txt + - data/numbers/1.txt (active) (pinned) + - data/numbers/2.txt (pinned) Scenario: Pinned :tab-only close all but pinned tab When I open data/numbers/1.txt @@ -1114,7 +1115,7 @@ Feature: Tab management And I run :tab-pin And I run :tab-only Then the following tabs should be open: - - data/numbers/2.txt (active) + - data/numbers/2.txt (active) (pinned) Scenario: :tab-pin open url When I open data/numbers/1.txt @@ -1122,4 +1123,4 @@ Feature: Tab management And I open data/numbers/2.txt without waiting Then the message "Tab is pinned!" should be shown And the following tabs should be open: - - data/numbers/1.txt (active) + - data/numbers/1.txt (active) (pinned)