Project search

BDD file with acceptance criteria for searching in a list of projects.
Feature: As a user I want to search in a list of projects

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

Scenario: No projects in list
 Given  I have no projects 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

Scenario: The search bar is active
 Given  I enter a string in the search bar
 Then  the list is filtered after entering the string
 And  I will only see projects containing the string

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

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

Scenario: Projects successfully loaded
 Given  the query returns a match
 And  the projects have loaded
 Then  I should see the projects filtered by search query

Scenario: Clearing selected projects on closing search
 Given  I remove the search query
 Then  the project list should return to the default state
 And  the projects will be deselected

Scenario: Projects failed to load
 Given  there is an error with search
 Then  I should see an error notification

Scenario: Projects did not match search query
 Given  the search query returns no projects
 Then  I should see an empty state
 And  the search bar will stay enabled

Scenario: Clicking outside and 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: 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