Add cucumber tests for projects

This commit is contained in:
aignatov-bio 2019-10-23 12:10:22 +02:00 committed by Urban Rotnik
parent 5b2993db12
commit 8fa229a0d1
3 changed files with 86 additions and 49 deletions

48
features/project.feature Normal file
View file

@ -0,0 +1,48 @@
# feature/project. feature
Feature: Project
As a creator of team
I want to navigate to other my team
I want to navigate through a SciNote
Background:
Given default screen size
Given the "BioSistemika Process" team exists
Given the "BioSistemika Path" team exists
Given the following users are registered
| name | email | password | password_confirmation |
|Karli Novak | nonadmin@myorg.com | mypassword1234 | mypassword1234 |
And "nonadmin@myorg.com" is in "BioSistemika Process" team as a "admin"
And "nonadmin@myorg.com" is in "BioSistemika Path" team as a "normal_user"
And "nonadmin@myorg.com" is signed in with "mypassword1234"
@javascript
Scenario: Successful change a team view
Given I'm on the home page of "BioSistemika Path" team
And I click on team switcher
And I click to "BioSistemika Process" in team dropdown menu
Then I should see "You are working on BioSistemika Process now!" flash message
Scenario: Successful return to Projects page
Given My profile page of current user
And I click first "Projects" link
Then I am on Projects page of "BioSistemika Process" team of current user
Scenario: Successful navigate to Protocols page
Given My profile page of current user
And I click first "Protocols" link
Then I am on Protocols page of "BioSistemika Process" team of current user
Scenario: Successful navigate to Inventories page
Given My profile page of current user
And I click first "Inventories" link
Then I am on Inventories page of "BioSistemika Process" team of current user
Scenario: Successful navigate to Reports page
Given My profile page of current user
And I click first "Reports" link
Then I am on Reports page of "BioSistemika Process" team of current user
Scenario: Successful navigate to Activities page
Given My profile page of current user
And I click first "Activities" link
Then I am on Activities page of "BioSistemika Process" team of current user

View file

@ -1,49 +0,0 @@
# feature/project. feature
Feature: Project
As a creator of team
I want to navigate to other my team
I want to navigate through a SciNote
Background:
Given the following users is registered:
| name | email | password | team | role |
|Karli Novak (creator)| nonadmin@myorg.com | mypassword1234 | BioSistemika Process | Administrator|
|Karli Novak | nonadmin@myorg.com | mypassword1234 | BioSistemika Path | Normal user |
Scenario: Successful change a team view
Given home page of BioSistemika Path team of a Karli Novak user
And I click to "BioSistemika Path" name
And I click to "BioSistemika Process" in team dropdown menu
Then I should see "You are working on BioSistemika Process now!" flash message
Scenario: Successful return to home page
Given My profile page of a Karli Novak user
And I click to "Home" icon
Then I am on home page of BioSistemika Process team of a Karli Novak user
Scenario: Successful navigate to Protocol management page
Given My profile page of a Karli Novak user
And I click to "Protocol management" icon
Then I am on Protocol management page of BioSistemika Process team of a Karli Novak user
Scenario: Successful navigate to Repositories page
Given My profile page of a Karli Novak user
And I click to "Repositories" icon
Then I am on Repositories page of BioSistemika Process team of a Karli Novak user
Scenario: Successful navigate to Activities page
Given My profile page of a Karli Novak user
And I click to "Activities" icon
Then I am on Activities page of BioSistemika Process team of a Karli Novak user
Scenario: Successful navigate to Premium page
Given My profile page of a Karli Novak user
And I click to "i" icon
And I click to "Premium" in "i" menu
Then I am on "https://scinote.net/premium/" page
Scenario: Successful navigate to Premium page
Given My profile page of a Karli Novak user
And I click to "i" icon
And I click to "About SciNote" in "i" menu
Then I should see "About SciNote" modal window

View file

@ -0,0 +1,38 @@
# frozen_string_literal: true
Given(/^I click on team switcher$/) do
find('#team-switch').click
end
Given('I click to {string} in team dropdown menu') do |team|
find('#team-switch .change-team', text: team).click
end
Given('My profile page of current user') do
visit(edit_user_registration_path)
end
Then('I am on Projects page of {string} team of current user') do |team|
check_active_team(team)
expect(page).to have_selector '.nav-name', text: team
end
Then('I am on Protocols page of {string} team of current user') do |team|
check_active_team(team)
expect(page).to have_selector 'a', text: 'Team protocols'
end
Then('I am on Inventories page of {string} team of current user') do |team|
check_active_team(team)
expect(page).to have_selector 'a', text: 'New Inventory'
end
Then('I am on Reports page of {string} team of current user') do |team|
check_active_team(team)
expect(page).to have_selector 'a', text: 'New report'
end
Then('I am on Activities page of {string} team of current user') do |team|
check_active_team(team)
expect(page).to have_selector '.ga-title', text: 'Global activities'
end