Inviting users via projects

BDD file with acceptance criteria for inviting users to a workspace via projects.
Feature: As a user I want to add a non-company member to an item

Scenario Outline: Successful invite and add
 Given  I am trying to add users to <itemType>
 When  I invite some users
 And  the invite is successful
 Then  I should go back to <itemType> share modal
 And  I should see a success message
 And  the users should get added to the <itemType>
 And  they should show up when searching for them in collaborators search

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

Scenario Outline: Provided emails belong to users already on a workspace
 Given  I am trying to add users to a <itemType>
 When  I invite users that are <reason>
 Then  I should see an error message telling me they're <reason>
 And  I should see a form error
 And  the email addresses should stay in the input field

Examples:
| itemType | reason |
| project | already on workspace |
| project | not on whitelisted domain |
| folder | already on workspace |
| folder | not on whitelisted domain |
| user test | already on workspace |
| user test | not on whitelisted domain |

Scenario Outline: Failed add to user test
 Given  I am trying to add users to <itemType>
 When  I invite users
 And  adding them to the <itemType> is unsuccessful
 Then  I should see visual feedback explaining there was an issue
 And  the email addresses should stay in the input field

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

Scenario Outline: Partial fail
 Given  I am trying to add users to <itemType>
 When  I invite multiple users
 And  some of the invites are unsuccessful
 Then  I should see a form error
 And  I should see success message for successful users
 And  I should see error message for failed users
 And  only the failed emails should remain in the input field

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

Scenario: Successfully added user email notification
 When  users have successfully been added to an item
 Then  they should receive an email notification informing them of it