Editing collaborators

BDD file with acceptance criteria for editing collaborators on a project.
Feature: As a user with edit access I want to add or remove a collaborator

Scenario Outline: Initial load
 Then  I should see a loading state on a <itemType> until collaborators loaded

Examples:
| itemType |
| project |
| folder |
| user test |

Scenario Outline: Searching for existing collaborators
 Given  I search for collaborators on a <itemType>
 Then  I should see the collaborator(s) whose name match my search term

Examples:
| itemType |
| project |
| folder |
| user test |

Scenario Outline: Searching for a collaborator who isn't part of the company
 Given  I search for a collaborator on a <itemType> that isn't part of the company
 Then  I should see a CTA linking to the invite modal

Examples:
| itemType |
| project |
| folder |
| user test |

Scenario Outline: Adding a collaborator
 Given  I have searched for a collaborator on a <itemType>
 When  I add that collaborator
 Then  I should see the collaborator successfully added
 And  the collaborator should be displayed in collaborators list

Examples:
| itemType |
| project |
| folder |
| user test |

Scenario Outline: Adding a collaborator that has already been added
 Given  I have searched for a collaborator on a <itemType>
 And  that collaborator has already been added
 Then  I should see the collaborator is already added
 And  I should not be able to add them again

Examples:
| itemType |
| project |
| folder |
| user test |

Scenario Outline: Removing a collaborator
 Given  I can see the list of collaborators added to a <itemType>
 When  I remove one of these collaborators
 Then  the collaborator should be removed

Examples:
| itemType |
| project |
| folder |
| user test |

Scenario Outline: Adding a collaborator fails
 Given  I attempt to add a collaborator to a <itemType> and it fails
 Then  I should see an explanatory error
 And  it should ask me to try again

Examples:
| itemType |
| project |
| folder |
| user test |

Scenario Outline: Removing a collaborator fails
 Given  I have attempted to remove a collaborator from a <itemType> and it fails
 Then  I should see an explanatory error
 And  it should ask me to try again

Examples:
| itemType |
| project |
| folder |
| user test |

Scenario: Order of collaborators in the list on share modal
 Given  I am viewing the collaborators list
 Then  I should see them ordered by last added

Scenario: The collaborators' avatars in UNB on a folder, project or usertest list page should be updated
 Given  I have added a collaborator
 Then  the avatars in the UNB on the item dashboard should be updated