Folder dashboard search

BDD file with acceptance criteria for searching on a folders dashboard, describing each step of the feature.
Feature: As a user I want to search in a list of folders

Scenario: No search active
 Given  I have not made a search
 Then  the search should not be active

Scenario: No folders list
 Given  I have no folders in my dashboard
 Then  search will be disabled

Scenario: Opening search
 Given  I have clicked the search icon
 Then  I should see a focussed search bar appear
 And  I should be able to enter a search query

Scenario: Clearing selection on search
 Given  I have folders selected when I start a new search
 Then  the selection should be cleared

Scenario: Search folders loading
 Given  the search is in progress
 Then  I should see a loading state in place of a list of folders

Scenario: Folders successfully loaded
 Given  there is a query match
 And  the folders have loaded
 Then  I should see the folders filtered by search query

Scenario: Clearing search
 Given  I remove the search query
 Then  the folder list should return to the default state
 And  any previous selection will be cleared

Scenario: Folders failed to load
 Given  the search query fails
 Then  I should see an error notification

Scenario: No folders returned from search query
 Given  the search query returns no folders
 Then  I should see an empty state
 And  the search bar will stay enabled

Scenario: Clicking outside an empty search bar
 Given  the search bar is empty
 And  I have clicked on an area outside the foccussed search bar
 Then  I should see the search bar close

Scenario: Clicking outside a non-empty search bar
 Given  the search bar has a query
 And  I have clicked on an area outside the search bar
 Then  the search bar should stay open
 And  it should unfocus

Scenario: Trying to close non-empty search bar
 Given  I have clicked on the search icon
 And  there is a search query
 Then  search bar should not close

Scenario: Closed search
 Given  I have clicked on the X close icon
 And  there is a search query
 Then  the search should be cleared
 Then  search bar should close