Merge pull request #857 from mlorb/ml-sci-1575

Implement login feature integration tests [SCI-1575]
This commit is contained in:
mlorb 2017-11-09 13:48:57 +01:00 committed by GitHub
commit b3e39697d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 74 additions and 52 deletions

View file

@ -32,7 +32,7 @@ class AlertsContainer extends Component {
render() {
return (
<Wrapper id="alert-flash">
<Wrapper>
<TransitionGroup>
{this.props.alerts.map((alert) =>
<CSSTransition key={alert.id}

View file

@ -1,47 +0,0 @@
# feature/login.feature
Feature: Log in / Log out
As a user with account
I want to Log in with my account
So that I can use sciNote
I want to Log out
Background:
Given the following users is registered:
| email | password | team
| nonadmin@myorg.com | mypassword1234 | BioSistemika Process
Scenario: Log in successfully
Given I am on Log in page
Then I fill in Email "nonadmin@myorg.com" and Password "mypassword1234"
And I click on "Log in" button
Then I should see "BioSistemika Process"
Scenario: Unsuccessful Log in
Given I am on Log in page
Then I do not fill in Email and Password
And I click on button "Log in"
Then I should see error message "Invalid email or password"
Scenario: Unsuccessful Log in
Given I am on Log in page
Then I fill in Email "monday@myorg.com" and Password "monday1234"
And I click on button "Log in"
Then I should see error message "Invalid email or password"
Scenario: Unsuccessful Log in
Given I am on Log in page
Then I fill in Email "nonadmin@myorg.com" and Password "mypassword123344"
And I click on button "Log in"
Then I should see error message "Invalid email or password"
Scenario: Unsuccessful Log in
Given I am on Log in page
Then I fill in Email "monday@myorg.com" and Password "mypassword1234"
And I click on button "Log in"
Then I should see error message "Invalid email or password"
Scenario: Successful Log out
Given home page of a Karli Novak user
Then I click to avatar
And I click on "Settings"
Then I should see message "Logged out successfully."

View file

@ -0,0 +1,53 @@
Feature: Log in
As an existing User
I want to Log in with my account
So that I can use sciNote
Background:
Given the "BioSistemika Process" team exists
Given the following users are registered
| email | password | password_confirmation |
| night.slarker@gmail.com | mypassword1234 | mypassword1234 |
And "night.slarker@gmail.com" is in "BioSistemika Process" team as a "admin"
@javascript
Scenario: Successful Log in
Given I am on Log in page
Then I fill in Email "night.slarker@gmail.com" and Password "mypassword1234"
And I click "Log in" button
Then I should see "BioSistemika Process"
@javascript
Scenario: Unsuccessful Log in
Given I am on Log in page
And I click "Log in" button
Then I should see "Invalid Email or password." flash message
@javascript
Scenario: Unsuccessful Log in
Given I am on Log in page
Then I fill in Email "monday@myorg.com" and Password "monday1234"
And I click "Log in" button
Then I should see "Invalid Email or password." flash message
@javascript
Scenario: Unsuccessful Log in
Given I am on Log in page
Then I fill in Email "night.slarker@gmail.com" and Password "mypassword123455"
And I click "Log in" button
Then I should see "Invalid Email or password." flash message
@javascript
Scenario: Unsuccessful Log in
Given I am on Log in page
Then I fill in Email "monday@myorg.com" and Password "mypassword1234"
And I click "Log in" button
Then I should see "Invalid Email or password." flash message
@javascript
Scenario: Successful Log out
Given "night.slarker@gmail.com" is signed in with "mypassword1234"
And I'm on the home page of "BioSistemika Process" team
Then I click on "#user-account-dropdown" element
And I click "Log out" link within dropdown menu
Then I should see "Logged out successfully." flash message

View file

@ -19,6 +19,7 @@ Feature: Sign up
And I click "Sign up" button
Then I should see "has already been taken"
@javascript
Scenario: Sign up for an non-existent user
Given I visit the sign up page
Then I fill the sign up form with

View file

@ -9,7 +9,7 @@ Background:
| email | password | password_confirmation | full_name | initials |
| nonadmin@myorg.com | mypassword1234 | mypassword1234 | Karli Novak | KN |
And "nonadmin@myorg.com" is in "BioSistemika Process" team as a "normal_user"
And is signed in with "nonadmin@myorg.com", "mypassword1234"
And "nonadmin@myorg.com" is signed in with "mypassword1234"
@javascript
Scenario: Successful navigate to profile page

View file

@ -13,7 +13,7 @@ Feature: Team settings
And "karli@myorg.com" is in "BioSistemika Process" team as a "admin"
And "marija@myorg.com" is in "BioSistemika Process" team as a "normal_user"
And "suazana@myorg.com" is in "BioSistemika Process" team as a "guest"
And is signed in with "karli@myorg.com", "mypassword1234"
And "karli@myorg.com" is signed in with "mypassword1234"
@javascript
Scenario: Successfully changes team name

View file

@ -20,6 +20,12 @@ Given(/^I click "(.+)" link within "(.+)"$/) do |link, element|
end
end
Then(/^I click "(.+)" link within dropdown menu$/) do |link|
within('.dropdown-menu') do
click_link link
end
end
Then(/^I should see "(.+)"$/) do |text|
wait_for_ajax
expect(page).to have_content(text)
@ -74,7 +80,7 @@ end
Then(/^I should see "([^"]*)" flash message$/) do |message|
wait_for_ajax
expect(find_by_id('alert-flash')).to have_content(message)
expect(find('.alert')).to have_content(message)
end
Then(/^I click on Edit on "([^"]*)" input field$/) do |container_id|

View file

@ -17,10 +17,19 @@ Then(/^I fill the sign up form with$/) do |table|
end
end
Given(/^is signed in with "([^"]*)", "([^"]*)"$/) do |email, password|
Given(/^"([^"]*)" is signed in with "([^"]*)"$/) do |email, password|
visit '/users/sign_in'
fill_in 'user_email', with: email
fill_in 'user_password', with: password
click_button 'Log in'
@current_user = User.find_by_email(email)
end
Given(/^I am on Log in page$/) do
visit '/users/sign_in'
end
Then(/^I fill in Email "([^"]*)" and Password "([^"]*)"$/) do |email, password|
fill_in 'user_email', with: email
fill_in 'user_password', with: password
end