# feature/home page. feature
Feature: Home page
  As a creator of team
  I want to create a project
  I want to edit, archive project
  I want to add user, comment to a project

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  | BioSistemika Process |  Normal user |

 Scenario: Successful create new project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to "New project" button
   Then I fill in "Mangart" to Project name field of "Create new project" modal window
   And I click to "Public" button
   And I click on "Create project" button
   Then I should see "Project Mangart successfully created." flash message
   Then I should see "Golica" public project card in "BioSistemika Process" team page

 Scenario: Unsuccessful create new project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to "New project" button
   And I click on "Create project" button
   Then I should see "is too short (minimum is 2 charaacters)" red Project name error message of "Create new project" modal window
   Then I fill in "Golica" to Project name field of "Create new project" modal window
   And I click on "Create project" button
   Then I should see "This project name has to be unique inside a team (this includes the archive)" red Project name error message of "Create new project" modal window
   And I click on "Cancel" button

 Scenario: Successful edit project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to down arrow of a "Mangart" project card
   And I click to "Edit" of a Options modal window
   Then I change "Mangart" Project name with "Golica" Project name of "Edit project Mangart" modal window
   And I click to "Privat" button
   And I click on "Update project" button
   Then I should see "Golica" privat project card in "BioSistemika Process" team page

 Scenario: Successful add user to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to avatar of a "Golica" project card
   Then I click to "Manage users" on "Golica" project card
   And I click to "Marija Novak" in users dropdown menu of a "Manage users for Golica" modal window
   And I click to "User" in Select Role dropdown menu of a "Manage users for Golica" modal window
   And I click to "Add" button of a "Manage users for Golica" modal window
   And I click to "Close" button
   Then I should see "Marija Novak" in Users list of "Golica" project card

  Scenario: Successful change user role to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to avatar of a "Golica" project card
   Then I click to "Manage users" on "Golica" project card
   And I click to "Owner" in Change Role dropdown menu of a "Manage users for Golica" modal window
   And I click to "Close" button
   Then I should see "Owner" under Marija Novak in Users list of "Golica" project card

  Scenario: Successful add new SciNote user to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to avatar of a "Golica" project card
   Then I click to "Manage users" on "Golica" project card
   And I click to "Invite users" link of a "Manage users for Golica" modal window
   Then I should see team BioSistemika Process settings page of a Karli Novak user

 Scenario: Unsuccessful adding user to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to avatar of a "Golica" project card
   Then I click to "Manage users" on "Golica" project card
   And I click to "Marija Novak" in users dropdown menu of a "Manage users for Golica" modal window
   And I click to "Add" button of a "Manage users for Golica" modal window
   Then I should see error message "Plese select a user role."
   And I click to "Close" button

 Scenario: Removing user from a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to avatar of a "Golica" project card
   Then I click to "Manage users" on "Golica" project card
   And I click to "X" sign at "Marija Novak" user in dropdown menu of a "Manage users for Golica" modal window
   Then "Marija Novak" user is removed from a list in dropdown menu of a "Manage users for Golica" modal window
   And I click to "Close" button

 Scenario: Successful add comment to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to Comments of a "Golica" project card
   Then I add "I was on Triglav one summer." in comment field
   And I click to "+" sign
   Then I should see "I was on Triglav one summer." in Comments list of "Golica" project card

 Scenario: Unsuccessful add comment to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to Comments of a "Golica" project card
   And I click to "+" sign
   Then I should see "Message can't be blank" red error message under comment field in Comments list of "Golica" project card

 Scenario: Successful edit comment to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to Comments of a "Golica" project card
   And I click to down arrow of a "I was on Triglav one summer." comment
   And I click to "Edit" in Comment options modal window
   Then I change "I was on Triglav one summer." comment with "I was on Triglav one summer and I do not have plans to go once more." comment
   And I click to "OK" sign
   Then I should see "I was on Triglav one summer and I do not have plans to go once more." in Comments list of "Golica" project card

 Scenario: Unsuccessful edit comment to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to Comments of a "Golica" project card
   And I click to down arrow of a "I was on Triglav one summer." comment
   And I click to "Edit" in Comment options modal window
   Then I change "I was on Triglav one summer." comment with "I was on Triglav one summer and I do not have plans to go once more." comment
   And I click to "Cancel" sign
   Then I should see "I was on Triglav one summer." in Comments list of "Golica" project card

 Scenario: Unsuccessful delete comment to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to Comments of a "Golica" project card
   And I click to down arrow of a "I was on Triglav one summer." comment
   And I click to "Delete" in Comment options modal window
   And I click to "Cancel" button in "Are you sure you wish to delete this comment" modal window
   Then I should see "I was on Triglav one summer." in Comments list of "Golica" project card

 Scenario: Successful delete comment to a project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to Comments of a "Golica" project card
   And I click to down arrow of a "I was on Triglav one summer." comment
   And I click to "Delete" in Comment options modal window
   And I click to "OK" button in "Are you sure you wish to delete this comment" modal window
   Then "I was on Triglav one summer." comment is removed from Comments list of "Golica" project card

 Scenario: Unsuccessful archived project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to down arrow of a "Mangart" project card
   And I click to "Archive" of a Options modal window
   And I click to "Cancel" button in "Are you sure to archive project?" modal window
   Then I should see "Golica" privat project card in "BioSistemika Process" team page

 Scenario: Successful archived project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to down arrow of a "Mangart" project card
   And I click to "Archive" of a Options modal window
   And I click to "OK" button in "Are you sure to archive project?" modal window
   Then I should see "Project Golica successfully archived." flash message

 Scenario: Restore archived project
   Given home page of BioSistemika Process team of a Karli Novak user
   And I click to "Archive" icon
   Then I should see "Golica" project
   And I click to down arrow of a "Golica" project card
   And I click to "Restore" of a Options modal window
   Then I should see "Project Golica successfully restored." flash message
