# feature/invite user.feature
Feature: Invite people to SciNote
  As an owner of a team
  I want to add new User to my team throuhout the SciNote

Background:
 Given the following users is registered:
  |name                 | email              | password        | team                 | role         |
  |Karli Novak (creator)| nonadmin@myorg.com | mypassword1234  | BioSistemika Process | Administrator|
  |Marija Novak         | marija@myorg.com   | mypassword5555  | Cell              | Administrator|
  And the following user has got SciNote - Accept Invitation email:
    | email                   |invitation team
    | karolina@myorg.com      | BioSistemika Process

Scenario: Successful Add team members
  Given Settings page of BioSistemika Process team of a Karli Novak user
  And I click on "Add team members" button
  Then I fill in "lojze@myorg.com" to Invite users to team BioSistemika Process input field
  And confirm with ENTER key
  Then I fill in "marija@myorg.com" to Invite users to team BioSistemika Process input field
  And confirm with ENTER key
  Then I fill in "nonadmin@myorg.com" to Invite users to team BioSistemika Process input field
  And confirm with ENTER key
  And I click on "Invite user/s" button
  And I click on "as Normal user/s" modal window
  Then I should see "lojze@myorg.com - User successfully invited to SciNote and team BioSistemika Process as Normal user." Invitation results in Invite users to team BioSistemika Process modal window
  Then I should see "marija@myorg.com - User was already a member of SciNote - successfully invited to team BioSistemika Process as Normal user." Invitation results in Invite users to team BioSistemika Process modal window
  Then I should see "nonadmin@myorg.com - User is already a member of SciNote and team BioSistemika Process as Administrator." Invitation results in Invite users to team BioSistemika Process modal window
  And I click on "Close" button
  And I should see "active" Status of "marija@myorg.com" user in Team members list
  And I should see "pending" Status of "lojze@myorg.com" user in Team members list

Scenario: Unsuccessful Add team member
  Given Settings page of BioSistemika Process team of a Karli Novak user
  And I click on "Add team members" button
  Then I fill in "anicamyorg.com" to Invite users to team BioSistemika Process input field
  And confirm with ENTER key
  Then I click on "Invite user/s" button
  Then I click on "as Normal user/s" modal window
  Then I should see "anicamyorg.com - Invalid email" Invitation results in Invite users to team BioSistemika Process modal window
  And I click on "Close" button

Scenario: Successful Invite people to SciNote
  Given Settings page of BioSistemika Process team of a Karli Novak user
  And I click on avatar
  And I click to "Invite people to SciNote"
  Then I fill in "janez@myorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  Then I fill in "marija@myorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  And I click on "Invite user/s" button
  Then I should see "janez@myorg.com - User successfully invited to SciNote." Invitation results in Invite people to SciNote modal window
  Then I should see "marija@myorg.com - User is already a member of SciNote." Invitation results in Invite people to SciNote modal window
  And I click on "Close" button

Scenario: Unsuccessful Invite people to SciNote
  Given Settings page of BioSistemika Process team of a Karli Novak user
  And I click to "Invite people to SciNote"
  Then I fill in "anicamyorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  And I click on "Invite user/s" button
  Then I should see "anicamyorg.com - Invalid email" Invitation results in Invite people to SciNote modal window
  And I click on "Close" button

Scenario: Successful Invite people to SciNote
  Given Settings page of BioSistemika Process team of a Karli Novak user
  And I click on avatar
  And I click to "Invite people to SciNote"
  Then I fill in "nikola@myorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  Then I fill in "marija@myorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  And I click on checkbox "Invite user to my team"
  And I click on "Invite user/s" button
  And I click on "as Normal user/s" modal window
  Then I should see "nikola@myorg.com - User successfully invited to SciNote and team BioSistemika Process as Normal user." Invitation results in Invite people to SciNote modal window
  Then I should see "marija@myorg.com - User is already a member of SciNote - successfully invited to team BioSistemika Process as Normal user." Invitation results in Invite people to SciNote modal window
  And I click on "Close" button

Scenario: Unsuccessful Invite people to SciNote
  Given Settings page of BioSistemika Process team of a Karli Novak user
  And I click to "Invite people to SciNote"
  Then I fill in "anicamyorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  And I click on checkbox "Invite user to my team"
  And I click on "Invite user/s" button
  And I click on "as Normal user/s" modal window
  Then I should see "anicamyorg.com - Invalid email" Invitation results in Invite people to SciNote modal window
  And I click on "Close" button

Scenario: Successful Invite people to SciNote
  Given Profile page of a Karli Novak user
  And I click on avatar
  And I click to "Invite people to SciNote"
  Then I fill in "anton@myorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  Then I fill in "marija@myorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  And I click on "Invite user/s" button
  Then I should see "anton@myorg.com - User successfully invited to SciNote." Invitation results in Invite people to SciNote modal window
  Then I should see "marija@myorg.com - User is already a member of SciNote." Invitation results in Invite people to SciNote modal window
  And I click on "Close" button

Scenario: Unsuccessful Invite people to SciNote
  Given Profile page of a Karli Novak user
  And I click to "Invite people to SciNote"
  Then I fill in "anicamyorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  And I click on "Invite user/s" button
  Then I should see "anicamyorg.com - Invalid email" Invitation results in Invite people to SciNote modal window
  And I click on "Close" button

Scenario: Successful Invite people to SciNote
  Given Profile page of a Karli Novak user
  And I click on avatar
  And I click to "Invite people to SciNote"
  Then I fill in "antonio@myorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  Then I fill in "marija@myorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  And I click on checkbox "Invite user to my team"
  And I click on "Invite user/s" button
  And I click on "as Normal user/s" modal window
  Then I should see "antonio@myorg.com - User successfully invited to SciNote." Invitation results in Invite people to SciNote modal window
  Then I should see "marija@myorg.com - User is already a member of SciNote." Invitation results in Invite people to SciNote modal window
  And I click on "Close" button

Scenario: Unsuccessful Invite people to SciNote
  Given Profile page of a Karli Novak user
  And I click to "Invite people to SciNote"
  Then I fill in "anicamyorg.com" to Invite people to SciNote input field
  And confirm with ENTER key
  And I click on "Invite user/s" button
  Then I should see "anicamyorg.com - Invalid email" Invitation results in Invite people to SciNote modal window
  And I click on "Close" button

Scenario: User has got SciNote - Accept Invitation email and click to link
  Given I have "Accept Invitation" email for user "karolina@myorg.com"
  And I click to "ACCEPT INVITATION" link in email
  Then I should see "Set your full name and password" page

Scenario: Successful Sign up
  Given Set your full name and password page for user "karolina@myorg.com"
  Then I fill the Sign up form with
   | Full name |  Password       | Password confirmation | Team name   |
   | Karolina   | mypassword3333 | mypassword3333        | Circle      |
  And I click to reCAPTCHA.
  And I click on "Sign up" button
  Then I should see "Circle" team
  And I should see "Hi, Karolina" next to the avatar
  And I should get a Gamification pop up message "Welcome to SciNote."

Scenario: Verify invited user does have invitation team
  Given Settings page of BioSistemika Process team of a Karli Novak user
  And I should see "Karolina" name in column "Name"

Scenario: User has got SciNote - Accept Invitation email and click to link
  Given "Accept Invitation" email for user "karolina@myorg.com"
  And I click to "ACCEPT INVITATION" link in email
  Then I should see "The invitation token prvided is not valid" error message in Log in page

Scenario: Unsuccessful Sign up, Password confirmation does not match
  Given Set your full name and password page for user "agata@myorg.com"
  Then I fill the Sign up form with
   | Full name |  Password       | Password confirmation | Team name   |
   | Agata Novakovic| mypassword6666 | mypassword6665        | Circle      |
  And I click to reCAPTCHA.
  And I click on "Sign up" button
  Then I should see "doesn't match Password" error message under "Password confirmation" field

Scenario: Unsuccessful Sign up, Team name is missing
  Given Set your full name and password page for user "agata@myorg.com"
  Then I fill the Sign up form with
   | Full name |  Password       | Password confirmation |
   | Agata Novakovic| mypassword6666 | mypassword6666    |
  And I click to reCAPTCHA.
  And I click on "Sign up" button
  Then I should see "is too short (minimum is 2 characters)" error message under "Team name" field

Scenario: Unsuccessful Sign up, reCAPTCHA is missing
  Given Set your full name and password page for user "agata@myorg.com"
  Then I fill the Sign up form with
  | Full name |  Password       | Password confirmation | Team name   |
  | Agata Novakovic| mypassword6666 | mypassword6666        | Circle      |
  And I click on "Sign up" button
  Then I should see "reCAPTCHA verification failed, please try again." error message under "recaptcha" field
