mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-09 21:36:44 +08:00
Merge pull request #857 from mlorb/ml-sci-1575
Implement login feature integration tests [SCI-1575]
This commit is contained in:
commit
b3e39697d5
8 changed files with 74 additions and 52 deletions
|
@ -32,7 +32,7 @@ class AlertsContainer extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Wrapper id="alert-flash">
|
<Wrapper>
|
||||||
<TransitionGroup>
|
<TransitionGroup>
|
||||||
{this.props.alerts.map((alert) =>
|
{this.props.alerts.map((alert) =>
|
||||||
<CSSTransition key={alert.id}
|
<CSSTransition key={alert.id}
|
||||||
|
|
|
@ -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."
|
|
53
features/sessions/log_in.feature
Normal file
53
features/sessions/log_in.feature
Normal 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
|
|
@ -19,6 +19,7 @@ Feature: Sign up
|
||||||
And I click "Sign up" button
|
And I click "Sign up" button
|
||||||
Then I should see "has already been taken"
|
Then I should see "has already been taken"
|
||||||
|
|
||||||
|
@javascript
|
||||||
Scenario: Sign up for an non-existent user
|
Scenario: Sign up for an non-existent user
|
||||||
Given I visit the sign up page
|
Given I visit the sign up page
|
||||||
Then I fill the sign up form with
|
Then I fill the sign up form with
|
|
@ -9,7 +9,7 @@ Background:
|
||||||
| email | password | password_confirmation | full_name | initials |
|
| email | password | password_confirmation | full_name | initials |
|
||||||
| nonadmin@myorg.com | mypassword1234 | mypassword1234 | Karli Novak | KN |
|
| nonadmin@myorg.com | mypassword1234 | mypassword1234 | Karli Novak | KN |
|
||||||
And "nonadmin@myorg.com" is in "BioSistemika Process" team as a "normal_user"
|
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
|
@javascript
|
||||||
Scenario: Successful navigate to profile page
|
Scenario: Successful navigate to profile page
|
||||||
|
|
|
@ -13,7 +13,7 @@ Feature: Team settings
|
||||||
And "karli@myorg.com" is in "BioSistemika Process" team as a "admin"
|
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 "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 "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
|
@javascript
|
||||||
Scenario: Successfully changes team name
|
Scenario: Successfully changes team name
|
||||||
|
|
|
@ -20,6 +20,12 @@ Given(/^I click "(.+)" link within "(.+)"$/) do |link, element|
|
||||||
end
|
end
|
||||||
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|
|
Then(/^I should see "(.+)"$/) do |text|
|
||||||
wait_for_ajax
|
wait_for_ajax
|
||||||
expect(page).to have_content(text)
|
expect(page).to have_content(text)
|
||||||
|
@ -74,7 +80,7 @@ end
|
||||||
|
|
||||||
Then(/^I should see "([^"]*)" flash message$/) do |message|
|
Then(/^I should see "([^"]*)" flash message$/) do |message|
|
||||||
wait_for_ajax
|
wait_for_ajax
|
||||||
expect(find_by_id('alert-flash')).to have_content(message)
|
expect(find('.alert')).to have_content(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then(/^I click on Edit on "([^"]*)" input field$/) do |container_id|
|
Then(/^I click on Edit on "([^"]*)" input field$/) do |container_id|
|
||||||
|
|
|
@ -17,10 +17,19 @@ Then(/^I fill the sign up form with$/) do |table|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Given(/^is signed in with "([^"]*)", "([^"]*)"$/) do |email, password|
|
Given(/^"([^"]*)" is signed in with "([^"]*)"$/) do |email, password|
|
||||||
visit '/users/sign_in'
|
visit '/users/sign_in'
|
||||||
fill_in 'user_email', with: email
|
fill_in 'user_email', with: email
|
||||||
fill_in 'user_password', with: password
|
fill_in 'user_password', with: password
|
||||||
click_button 'Log in'
|
click_button 'Log in'
|
||||||
@current_user = User.find_by_email(email)
|
@current_user = User.find_by_email(email)
|
||||||
end
|
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue