From cfaff206ea8cc1c369b2bd9c0d525c9933b80ff2 Mon Sep 17 00:00:00 2001 From: toofar Date: Fri, 9 Feb 2024 14:11:42 +1300 Subject: Add some more end2end tests for tree tabs The first three tests make sure that the "collapsed" attribute makes it through the session machinery and behaves as expected. Third one is a bit sneaky because it tests a case that was causing issues, but this test couldn't actually reproduce. The problem was that before we were passing `related=False` to `tabopen()` the tab after a collapsed group would be loaded hidden when it wasn't supposed to be. This was only in the UI though, if you saved a session it would be correct, so we can't test it in these e2e tests currently... --- tests/end2end/features/treetabs.feature | 61 +++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/end2end/features/treetabs.feature b/tests/end2end/features/treetabs.feature index f32ff3d07..898f9e21a 100644 --- a/tests/end2end/features/treetabs.feature +++ b/tests/end2end/features/treetabs.feature @@ -25,3 +25,64 @@ Feature: Tree tab management Then the following tabs should be open: - data/numbers/1.txt - data/numbers/2.txt (active) + + Scenario: Collapse a subtree + When I open data/numbers/1.txt + And I open data/numbers/2.txt in a new related tab + And I open data/numbers/3.txt in a new related tab + And I run :tab-focus 2 + And I run :tree-tab-toggle-hide + Then the following tabs should be open: + - data/numbers/1.txt + - data/numbers/2.txt (active) (collapsed) + - data/numbers/3.txt + + Scenario: Load a collapsed subtree + # Same setup as above + When I open data/numbers/1.txt + And I open data/numbers/2.txt in a new related tab + And I open data/numbers/3.txt in a new related tab + And I run :tab-focus 2 + And I run :tree-tab-toggle-hide + # Now actually load the saved session + And I run :session-save foo + And I run :session-load -c foo + And I wait until data/numbers/3.txt is loaded + # And of course the same assertion as above too + Then the following tabs should be open: + - data/numbers/1.txt + - data/numbers/2.txt (active) (collapsed) + - data/numbers/3.txt + + Scenario: Uncollapse a subtree + When I open data/numbers/1.txt + And I open data/numbers/2.txt in a new related tab + And I open data/numbers/3.txt in a new related tab + And I run :tab-focus 2 + And I run :tree-tab-toggle-hide + And I run :tree-tab-toggle-hide + Then the following tabs should be open: + - data/numbers/1.txt + - data/numbers/2.txt (active) + - data/numbers/3.txt + + # Same as a test in sessions.feature but tree tabs and the related + # settings. + Scenario: TreeTabs: Loading a session with tabs.new_position.related=prev + When I open data/numbers/1.txt + And I open data/numbers/2.txt in a new related tab + And I open data/numbers/3.txt in a new related tab + And I open data/numbers/4.txt in a new tab + And I run :tab-focus 2 + And I run :tree-tab-toggle-hide + And I run :session-save foo + And I set tabs.new_position.related to prev + And I set tabs.new_position.tree.new_child to last + And I set tabs.new_position.tree.new_toplevel to prev + And I run :session-load -c foo + And I wait until data/numbers/4.txt is loaded + Then the following tabs should be open: + - data/numbers/1.txt + - data/numbers/2.txt (active) (collapsed) + - data/numbers/3.txt + - data/numbers/4.txt -- cgit v1.2.3-54-g00ecf