/ src / nested_workspaces.feature
nested_workspaces.feature
  1  Feature: Nested Workspaces (Parent-Child Workspace Hierarchy)
  2    As a user managing multiple related browser sessions
  3    I want to organize workspaces into parent-child hierarchies
  4    So that I can efficiently manage complex projects with multiple contexts
  5  
  6    Background:
  7      Given the chrome-edge-workspaces extension is installed
  8      And the user has opened the extension popup
  9  
 10    # ==========================================
 11    # Parent Workspace Creation
 12    # ==========================================
 13  
 14    Scenario: Create a new parent workspace
 15      Given I am viewing the workspace list
 16      When I click the "New Parent Workspace" button
 17      And I enter "Python Research" as the parent workspace name
 18      And I click "Create"
 19      Then a new parent workspace named "Python Research" should be created
 20      And the parent workspace should be displayed with a distinctive parent icon
 21      And the parent workspace should show "0 child workspaces"
 22  
 23    Scenario: Create parent workspace with initial child workspaces
 24      Given I am viewing the workspace list
 25      And the following workspaces exist:
 26        | name                    | type  |
 27        | metaProgramming         | child |
 28        | generatorExpressions    | child |
 29        | asyncIO                 | child |
 30      When I click the "New Parent Workspace" button
 31      And I enter "Python Research" as the parent workspace name
 32      And I select the following child workspaces:
 33        | metaProgramming       |
 34        | generatorExpressions  |
 35        | asyncIO               |
 36      And I click "Create"
 37      Then a new parent workspace named "Python Research" should be created
 38      And the parent workspace should contain 3 child workspaces
 39      And the selected child workspaces should be nested under "Python Research"
 40  
 41    # ==========================================
 42    # Adding Children to Parent Workspaces
 43    # ==========================================
 44  
 45    Scenario: Add existing workspace to parent via drag and drop
 46      Given the following workspaces exist:
 47        | name              | type   |
 48        | Python Research   | parent |
 49        | asyncIO           | child  |
 50      When I drag the workspace "asyncIO"
 51      And I drop it onto the parent workspace "Python Research"
 52      Then "asyncIO" should be nested under "Python Research"
 53      And the parent workspace should show "1 child workspace"
 54  
 55    Scenario: Add multiple workspaces to parent via drag and drop
 56      Given the following workspaces exist:
 57        | name                    | type   |
 58        | Python Research         | parent |
 59        | metaProgramming         | child  |
 60        | generatorExpressions    | child  |
 61        | asyncIO                 | child  |
 62      When I select multiple workspaces:
 63        | metaProgramming       |
 64        | generatorExpressions  |
 65        | asyncIO               |
 66      And I drag the selected workspaces
 67      And I drop them onto the parent workspace "Python Research"
 68      Then all selected workspaces should be nested under "Python Research"
 69      And the parent workspace should show "3 child workspaces"
 70  
 71    Scenario: Add workspace to parent via context menu
 72      Given the following workspaces exist:
 73        | name              | type   |
 74        | Python Research   | parent |
 75        | asyncIO           | child  |
 76      When I right-click on the workspace "asyncIO"
 77      And I select "Add to Parent Workspace"
 78      And I choose "Python Research" from the parent list
 79      Then "asyncIO" should be nested under "Python Research"
 80  
 81    Scenario: Prevent circular nesting
 82      Given the following workspace hierarchy exists:
 83        | Python Research (parent)  |
 84        |   - asyncIO (child)       |
 85      When I attempt to drag "Python Research" onto "asyncIO"
 86      Then the operation should be prevented
 87      And an error message should display "Cannot nest a parent workspace inside its own child"
 88  
 89    # ==========================================
 90    # Removing Children from Parent Workspaces
 91    # ==========================================
 92  
 93    Scenario: Remove child workspace from parent via drag and drop
 94      Given the following workspace hierarchy exists:
 95        | Python Research (parent)  |
 96        |   - asyncIO (child)       |
 97        |   - metaProgramming       |
 98      When I drag "asyncIO" out of "Python Research"
 99      And I drop it onto the main workspace list
100      Then "asyncIO" should become a standalone workspace
101      And "Python Research" should show "1 child workspace"
102  
103    Scenario: Remove child workspace from parent via context menu
104      Given the following workspace hierarchy exists:
105        | Python Research (parent)  |
106        |   - asyncIO (child)       |
107      When I right-click on "asyncIO"
108      And I select "Remove from Parent"
109      Then "asyncIO" should become a standalone workspace
110      And "Python Research" should show "0 child workspaces"
111  
112    # ==========================================
113    # Viewing and Expanding Parent Workspaces
114    # ==========================================
115  
116    Scenario: Expand parent workspace to view children
117      Given the following workspace hierarchy exists:
118        | Python Research (parent)  |
119        |   - asyncIO               |
120        |   - metaProgramming       |
121        |   - generatorExpressions  |
122      And the parent workspace "Python Research" is collapsed
123      When I click the expand icon on "Python Research"
124      Then the child workspaces should be displayed:
125        | asyncIO              |
126        | metaProgramming      |
127        | generatorExpressions |
128      And each child should be indented to show hierarchy
129  
130    Scenario: Collapse parent workspace to hide children
131      Given the following workspace hierarchy exists:
132        | Python Research (parent)  |
133        |   - asyncIO               |
134        |   - metaProgramming       |
135      And the parent workspace "Python Research" is expanded
136      When I click the collapse icon on "Python Research"
137      Then the child workspaces should be hidden
138      And only the parent workspace name should be visible
139  
140    # ==========================================
141    # Opening Parent Workspaces - "Open All"
142    # ==========================================
143  
144    Scenario: Open all child workspaces in new windows without closing existing windows
145      Given the following workspace hierarchy exists:
146        | Python Research (parent)  |
147        |   - asyncIO               |
148        |   - metaProgramming       |
149        |   - generatorExpressions  |
150      And I have 2 existing browser windows open
151      When I right-click on "Python Research"
152      And I select "Open All in New Windows"
153      Then 3 new browser windows should open, one for each child workspace
154      And the 2 existing browser windows should remain open
155      And each new window should contain the tabs from its respective workspace
156  
157    Scenario: Open specific child workspace from parent
158      Given the following workspace hierarchy exists:
159        | Python Research (parent)  |
160        |   - asyncIO               |
161        |   - metaProgramming       |
162      When I expand "Python Research"
163      And I click on the child workspace "asyncIO"
164      Then a new browser window should open with "asyncIO" tabs
165      And other child workspaces should not be opened
166  
167    # ==========================================
168    # Context Switching - Replace All Windows
169    # ==========================================
170  
171    Scenario: Switch to workspace context by replacing all existing windows
172      Given the following workspace hierarchy exists:
173        | Python Research (parent)      |
174        |   - asyncIO                   |
175        |   - metaProgramming           |
176        | Project Z (parent)            |
177        |   - Frontend Development      |
178        |   - Backend API               |
179      And the "Python Research" context is currently active with 2 open windows
180      When I right-click on "Project Z"
181      And I select "Switch to Context"
182      Then a confirmation dialog should appear asking "Close all existing windows and switch to Project Z context?"
183      When I confirm the context switch
184      Then all existing windows should be closed
185      And 2 new windows should open for "Frontend Development" and "Backend API"
186      And the active context should be set to "Project Z"
187  
188    Scenario: Cancel context switch
189      Given the following workspace hierarchy exists:
190        | Python Research (parent)  |
191        |   - asyncIO               |
192        | Project Z (parent)        |
193        |   - Frontend Development  |
194      And the "Python Research" context is currently active
195      When I right-click on "Project Z"
196      And I select "Switch to Context"
197      And I cancel the confirmation dialog
198      Then no windows should be closed
199      And no new windows should be opened
200      And the active context should remain "Python Research"
201  
202    # ==========================================
203    # Transcendent/Locked Workspaces
204    # ==========================================
205  
206    Scenario: Mark workspace as transcendent (persists across context switches)
207      Given the following workspaces exist:
208        | name | type  |
209        | Main | child |
210      When I right-click on "Main"
211      And I select "Mark as Transcendent"
212      Then "Main" should be marked with a lock icon
213      And "Main" should be flagged as transcendent in the workspace data
214  
215    Scenario: Transcendent workspace persists during context switch
216      Given the following workspace hierarchy exists:
217        | Python Research (parent)  |
218        |   - asyncIO               |
219        | Project Z (parent)        |
220        |   - Frontend Development  |
221      And a transcendent workspace "Main" is open in a browser window
222      And the "Python Research" context is currently active
223      When I right-click on "Project Z"
224      And I select "Switch to Context"
225      And I confirm the context switch
226      Then all non-transcendent windows should be closed
227      And the "Main" workspace window should remain open
228      And new windows for "Frontend Development" should open
229  
230    Scenario: Unmark workspace as transcendent
231      Given a workspace "Main" is marked as transcendent
232      When I right-click on "Main"
233      And I select "Unmark as Transcendent"
234      Then the lock icon should be removed from "Main"
235      And "Main" should no longer be flagged as transcendent
236  
237    Scenario: Multiple transcendent workspaces persist during context switch
238      Given the following transcendent workspaces exist:
239        | Main        |
240        | Email       |
241        | Calendar    |
242      And each transcendent workspace has an open window
243      And a non-transcendent context "Python Research" is active
244      When I switch to context "Project Z"
245      Then all 3 transcendent workspace windows should remain open
246      And only non-transcendent windows should be closed
247  
248    # ==========================================
249    # Parent Workspace Management
250    # ==========================================
251  
252    Scenario: Rename parent workspace
253      Given a parent workspace "Python Research" exists
254      When I right-click on "Python Research"
255      And I select "Rename"
256      And I enter "Python Advanced Topics" as the new name
257      And I confirm the rename
258      Then the parent workspace should be renamed to "Python Advanced Topics"
259      And all child workspaces should remain associated with it
260  
261    Scenario: Delete parent workspace with option to keep children
262      Given the following workspace hierarchy exists:
263        | Python Research (parent)  |
264        |   - asyncIO               |
265        |   - metaProgramming       |
266      When I right-click on "Python Research"
267      And I select "Delete"
268      Then a confirmation dialog should appear with options:
269        | Delete parent and all children        |
270        | Delete parent but keep children       |
271      When I select "Delete parent but keep children"
272      Then "Python Research" should be deleted
273      And "asyncIO" and "metaProgramming" should become standalone workspaces
274  
275    Scenario: Delete parent workspace with all children
276      Given the following workspace hierarchy exists:
277        | Python Research (parent)  |
278        |   - asyncIO               |
279        |   - metaProgramming       |
280      When I right-click on "Python Research"
281      And I select "Delete"
282      And I select "Delete parent and all children"
283      And I confirm the deletion
284      Then "Python Research" and all its children should be deleted
285      And no child workspaces should remain in the workspace list
286  
287    Scenario: Prevent deletion of parent with transcendent children
288      Given the following workspace hierarchy exists:
289        | Python Research (parent)  |
290        |   - asyncIO               |
291      And "asyncIO" is marked as transcendent
292      When I attempt to delete "Python Research" with all children
293      Then an error message should appear: "Cannot delete parent with transcendent children"
294      And the deletion should be prevented
295      And a suggestion should show to unmark transcendent children first
296  
297    # ==========================================
298    # Nested Workspace Display and Indicators
299    # ==========================================
300  
301    Scenario: Display active context indicator
302      Given the following parent workspaces exist:
303        | Python Research |
304        | Project Z       |
305      And "Python Research" context is currently active
306      When I open the extension popup
307      Then "Python Research" should have an "active" indicator
308      And "Project Z" should not have an active indicator
309  
310    Scenario: Display child workspace count in parent
311      Given the following workspace hierarchy exists:
312        | Python Research (parent)  |
313        |   - asyncIO               |
314        |   - metaProgramming       |
315        |   - generatorExpressions  |
316      When I view "Python Research" in the workspace list
317      Then it should display "3 child workspaces" or a badge showing "3"
318  
319    Scenario: Display nested workspace depth with visual indentation
320      Given the following workspace hierarchy exists:
321        | Python Research (parent)  |
322        |   - asyncIO               |
323        |   - metaProgramming       |
324      When the parent workspace is expanded
325      Then child workspaces should be visually indented
326      And a tree structure connector line should show the relationship
327  
328    # ==========================================
329    # Import/Export with Nested Structure
330    # ==========================================
331  
332    Scenario: Export parent workspace with nested children
333      Given the following workspace hierarchy exists:
334        | Python Research (parent)  |
335        |   - asyncIO               |
336        |   - metaProgramming       |
337      When I export all workspaces to a file
338      Then the exported file should contain:
339        | The parent-child relationship data    |
340        | All parent workspace metadata         |
341        | All child workspace metadata          |
342        | Transcendent flags for each workspace |
343  
344    Scenario: Import workspace hierarchy from file
345      Given I have an exported file with the following hierarchy:
346        | Python Research (parent)  |
347        |   - asyncIO               |
348        |   - metaProgramming       |
349      When I import the workspace file
350      Then the parent workspace "Python Research" should be created
351      And the child workspaces should be properly nested
352      And all workspace relationships should be preserved
353  
354    # ==========================================
355    # Search and Filter with Nested Workspaces
356    # ==========================================
357  
358    Scenario: Search for workspace across parent-child hierarchy
359      Given the following workspace hierarchy exists:
360        | Python Research (parent)      |
361        |   - asyncIO                   |
362        |   - metaProgramming           |
363        | JavaScript Projects (parent)  |
364        |   - React Tutorials           |
365      When I search for "async"
366      Then the search results should show:
367        | Python Research > asyncIO |
368      And the parent workspace should be shown for context
369  
370    Scenario: Filter workspaces by parent
371      Given the following workspace hierarchy exists:
372        | Python Research (parent)  |
373        |   - asyncIO               |
374        |   - metaProgramming       |
375        | Project Z (parent)        |
376        |   - Frontend Development  |
377      When I select the filter "Show only: Python Research"
378      Then only "asyncIO" and "metaProgramming" should be displayed
379      And other parent workspaces and their children should be hidden
380  
381    # ==========================================
382    # Tab Management within Nested Workspaces
383    # ==========================================
384  
385    Scenario: Auto-save tabs in child workspace while parent is active
386      Given the following workspace hierarchy exists:
387        | Python Research (parent)  |
388        |   - asyncIO               |
389      And "asyncIO" is open in a browser window
390      And the "Python Research" context is active
391      When I open a new tab "https://docs.python.org/3/library/asyncio.html" in the "asyncIO" window
392      Then the new tab should be automatically saved to the "asyncIO" workspace
393      And the parent workspace metadata should update its last modified time
394  
395    Scenario: Preserve child workspace state when switching contexts
396      Given the following workspace hierarchy exists:
397        | Python Research (parent)  |
398        |   - asyncIO               |
399        | Project Z (parent)        |
400        |   - Frontend Development  |
401      And "asyncIO" has 5 tabs open
402      And the "Python Research" context is active
403      When I switch to "Project Z" context
404      And I later switch back to "Python Research" context
405      Then "asyncIO" should reopen with all 5 original tabs
406      And tab order and states should be preserved
407  
408    # ==========================================
409    # Edge Cases and Error Handling
410    # ==========================================
411  
412    Scenario: Attempt to create parent workspace with duplicate name
413      Given a parent workspace named "Python Research" exists
414      When I attempt to create a new parent workspace named "Python Research"
415      Then an error message should display "A workspace with this name already exists"
416      And the duplicate parent workspace should not be created
417  
418    Scenario: Handle orphaned child workspace when parent is corrupted
419      Given a child workspace "asyncIO" references a non-existent parent "Python Research"
420      When I open the extension popup
421      Then "asyncIO" should be displayed as a standalone workspace
422      And a notification should suggest: "Some workspace relationships were corrupted and have been fixed"
423  
424    Scenario: Maximum nesting depth limit
425      Given nested workspaces support a maximum depth of 1 level (parent-child only)
426      And a parent workspace "Research" with child "Python" exists
427      When I attempt to create a sub-child under "Python"
428      Then the operation should be prevented
429      And an error message should display "Only one level of nesting is supported"
430  
431    Scenario: Convert standalone workspace to parent workspace
432      Given a standalone workspace "Python Research" exists with open tabs
433      When I right-click on "Python Research"
434      And I select "Convert to Parent Workspace"
435      Then "Python Research" should become a parent workspace
436      And a new child workspace should be created with the original tabs
437      And the child workspace should be named "Python Research - Tabs"
438  
439    Scenario: Empty parent workspace cannot switch context
440      Given a parent workspace "Empty Project" exists with 0 child workspaces
441      When I right-click on "Empty Project"
442      Then the "Switch to Context" option should be disabled
443      And a tooltip should display "Add child workspaces before switching context"