mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-06 05:04:35 +08:00
add integration tests for single team feature
This commit is contained in:
parent
460bcd4980
commit
21e3c653eb
8 changed files with 139 additions and 62 deletions
|
@ -47,7 +47,7 @@ class RemoveUserModal extends Component<Props> {
|
|||
/>
|
||||
</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
<Modal.Body className="remove-user-modal-body">
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="settings_page.remove_user_modal.subtitle"
|
||||
|
|
|
@ -77,6 +77,7 @@ class UpdateTeamDescriptionModal extends Component<Props, State> {
|
|||
<FormattedMessage id="settings_page.update_team_description_modal.label" />
|
||||
</ControlLabel>
|
||||
<ValidatedFormControl
|
||||
id="teamDescription"
|
||||
componentClass="textarea"
|
||||
tag="description"
|
||||
defaultValue={this.props.team.description}
|
||||
|
|
|
@ -60,7 +60,11 @@ class UpdateTeamNameModal extends Component<Props, State> {
|
|||
|
||||
render(): Node {
|
||||
return (
|
||||
<Modal show={this.props.showModal} onHide={this.onCloseModal}>
|
||||
<Modal
|
||||
id="settings_page.update_team_name_modal"
|
||||
show={this.props.showModal}
|
||||
onHide={this.onCloseModal}
|
||||
>
|
||||
<ValidatedForm
|
||||
ref={f => {
|
||||
(this: any).form = f;
|
||||
|
|
|
@ -177,12 +177,12 @@ class SettingsTeam extends Component<Props, State> {
|
|||
<FormattedMessage id="settings_page.all_teams" />
|
||||
</Breadcrumb.Item>
|
||||
</LinkContainer>
|
||||
<Breadcrumb.Item active={true}>
|
||||
<Breadcrumb.Item active>
|
||||
{this.state.team.name}
|
||||
</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
<TabTitle>
|
||||
<StyledH3 onClick={this.showNameModal}>
|
||||
<StyledH3 className="team-name-title" onClick={this.showNameModal}>
|
||||
{this.state.team.name}
|
||||
</StyledH3>
|
||||
</TabTitle>
|
||||
|
@ -228,7 +228,7 @@ class SettingsTeam extends Component<Props, State> {
|
|||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col sm={12} onClick={this.showDescriptionModal}>
|
||||
<Col className="team-description" sm={12} onClick={this.showDescriptionModal}>
|
||||
<BadgeWrapper>
|
||||
<Glyphicon glyph="info-sign" />
|
||||
</BadgeWrapper>
|
||||
|
|
70
features/settings_page/team.feature
Normal file
70
features/settings_page/team.feature
Normal file
|
@ -0,0 +1,70 @@
|
|||
Feature: Team settings
|
||||
As a creator of a team
|
||||
I want to be able to change team name, team description and user roles
|
||||
So that I can manage my team
|
||||
|
||||
Background:
|
||||
Given the "BioSistemika Process" team exists
|
||||
Given the following users are registered
|
||||
| email | password | password_confirmation | full_name | initials |
|
||||
| karli@myorg.com | mypassword1234 | mypassword1234 | Karli Novak | KN |
|
||||
| marija@myorg.com | mypassword5555 | mypassword5555 | Marija Novak | MN |
|
||||
| suazana@myorg.com | mypassword6666 | mypassword6666 | Suazana Novak | SN |
|
||||
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"
|
||||
|
||||
@javascript
|
||||
Scenario: Successfully changes team name
|
||||
Given I'm on "BioSistemika Process" team settings page
|
||||
Then I click on ".team-name-title" element
|
||||
And I change "BioSistemika Process" with "BioSistemika Process Company" in "settings_page.update_team_name_modal" input field
|
||||
Then I click "Update" button
|
||||
And I should see "BioSistemika Process Company" on ".team-name-title" element
|
||||
|
||||
@javascript
|
||||
Scenario: Successfully adds team description
|
||||
Given I'm on "BioSistemika Process" team settings page
|
||||
Then I click on ".team-description" element
|
||||
And I fill in "I was on Triglav one summer." in "teamDescription" textarea field
|
||||
Then I click "Update" button
|
||||
And I should see "I was on Triglav one summer." on ".team-description" element
|
||||
|
||||
@javascript
|
||||
Scenario: Successfully changes team description
|
||||
Given I'm on "BioSistemika Process" team settings page
|
||||
Then I click on ".team-description" element
|
||||
And I change "Lorem ipsum dolor sit amet, consectetuer adipiscing eli." with "I was on Triglav one summer." in "teamDescription" textarea field
|
||||
Then I click "Update" button
|
||||
And I should see "I was on Triglav one summer." on ".team-description" element
|
||||
|
||||
@javascript
|
||||
Scenario: Successfully changes user role
|
||||
Given I'm on "BioSistemika Process" team settings page
|
||||
Then I click on "marija@myorg.com" action button within Team members table
|
||||
And I click "Guest" link within "marija@myorg.com" actions dropdown within Team members table
|
||||
Then I should see "Guest" in Role column of "marija@myorg.com" within Team members table
|
||||
|
||||
@javascript
|
||||
Scenario: Successfully changes user role
|
||||
Given I'm on "BioSistemika Process" team settings page
|
||||
Then I click on "suazana@myorg.com" action button within Team members table
|
||||
And I click "Normal user" link within "suazana@myorg.com" actions dropdown within Team members table
|
||||
Then I should see "Normal user" in Role column of "suazana@myorg.com" within Team members table
|
||||
|
||||
@javascript
|
||||
Scenario: Successfully changes user role
|
||||
Given I'm on "BioSistemika Process" team settings page
|
||||
Then I click on "marija@myorg.com" action button within Team members table
|
||||
And I click "Administrator" link within "marija@myorg.com" actions dropdown within Team members table
|
||||
Then I should see "Administrator" in Role column of "marija@myorg.com" within Team members table
|
||||
|
||||
@javascript
|
||||
Scenario: Successfully removes user
|
||||
Given I'm on "BioSistemika Process" team settings page
|
||||
Then I click on "suazana@myorg.com" action button within Team members table
|
||||
And I click "Remove" link within "suazana@myorg.com" actions dropdown within Team members table
|
||||
And I should see "Are you sure you wish to remove user Suazana Novak from team BioSistemika Process?" on ".remove-user-modal-body" element
|
||||
Then I click "Remove user" button
|
||||
Then I should not see "suazana@myorg.com" in Team members table
|
|
@ -2,6 +2,12 @@ When(/^I click "(.+)" button$/) do |button|
|
|||
click_on(button)
|
||||
end
|
||||
|
||||
When(/^I click "(.+)" button within "(.+)"$/) do |button, container|
|
||||
within(find(container)) do
|
||||
click_on button
|
||||
end
|
||||
end
|
||||
|
||||
Given(/^Show me the page$/) do
|
||||
save_and_open_page
|
||||
end
|
||||
|
@ -93,3 +99,28 @@ Then(/^I should see "([^"]*)" in "([^"]*)" input field$/) do |text, container_id
|
|||
container = page.find_by_id(container_id)
|
||||
expect(container).to have_xpath("//input[@value='#{text}']")
|
||||
end
|
||||
|
||||
Then(/^(?:|I )click on "([^"]*)" element$/) do |selector|
|
||||
find(selector).click
|
||||
end
|
||||
|
||||
Then(/^I change "([^"]*)" with "([^"]*)" in "([^"]*)" input field$/) do |old_text, new_text, container_id|
|
||||
container = page.find_by_id(container_id)
|
||||
expect(container).to have_xpath("//input[@value='#{old_text}']")
|
||||
container.find('input').set(new_text)
|
||||
end
|
||||
|
||||
Then(/^I fill in "([^"]*)" in "([^"]*)" textarea field$/) do |text, textarea_id|
|
||||
textarea = page.find_by_id(textarea_id)
|
||||
textarea.set(text)
|
||||
end
|
||||
|
||||
Then(/^I change "([^"]*)" with "([^"]*)" in "([^"]*)" textarea field$/) do |old_text, new_text, textarea_id|
|
||||
textarea = page.find_by_id(textarea_id)
|
||||
expect(textarea).to have_content(old_text)
|
||||
textarea.set(new_text)
|
||||
end
|
||||
|
||||
Then(/^I should see "([^"]*)" on "([^"]*)" element$/) do |text, element|
|
||||
expect(find(element)).to have_content(text)
|
||||
end
|
||||
|
|
28
features/step_definitions/team_steps.rb
Normal file
28
features/step_definitions/team_steps.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
Given(/^I'm on "([^"]*)" team settings page$/) do |team_name|
|
||||
team = Team.find_by_name(team_name)
|
||||
visit '/settings/teams/' + team.id.to_s
|
||||
end
|
||||
|
||||
Then(/^I click on "(.+)" action button within Team members table$/) do |email|
|
||||
mail_td = find('td', text: /\A#{email}\z/)
|
||||
parent = mail_td.first(:xpath, './/..')
|
||||
parent.find_by_id('actions-dropdown').click
|
||||
end
|
||||
|
||||
Then(/^I click "(.+)" link within "(.+)" actions dropdown within Team members table$/) do |role, email|
|
||||
mail_td = find('td', text: /\A#{email}\z/)
|
||||
parent = mail_td.first(:xpath, './/..')
|
||||
within(parent) do
|
||||
click_link role
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I should see "(.+)" in Role column of "(.+)" within Team members table$/) do |role, email|
|
||||
mail_td = find('td', text: /\A#{email}\z/)
|
||||
parent = mail_td.first(:xpath, './/..')
|
||||
expect(parent).to have_css('td', text: /\A#{role}\z/)
|
||||
end
|
||||
|
||||
Then(/^I should not see "([^"]*)" in Team members table$/) do |email|
|
||||
expect(page).to have_no_css('td', text: /\A#{email}\z/)
|
||||
end
|
|
@ -12,63 +12,6 @@ Given the following users is registered:
|
|||
|Marija Novak | marija@myorg.com | mypassword5555 | BioSistemika Process | Normal user |
|
||||
|Suazana Novak | suazana@myorg.com | mypassword6666 | BioSistemika Process | Guest user |
|
||||
|
||||
Scenario: Add team description
|
||||
Given team BioSistemika Process settings page of a Karli Novak user
|
||||
And I click to "i" blue button
|
||||
Then I fill in "I was on Triglav one summer." to Description field of "Edit team description" modal window
|
||||
And I click on "Update" button
|
||||
Then I should see "I was on Triglav one summer." in team description field
|
||||
|
||||
Scenario: Change team name
|
||||
Given team BioSistemika Process settings page of a Karli Novak user
|
||||
And I click to "BioSistemika Process Company" team name link
|
||||
Then I change "BioSistemika Process Company" description with "BioSistemika Process" description to Name field of "Edit team name" modal window
|
||||
And I click on "Update" button
|
||||
Then I should see "BioSistemika Process" in team name field
|
||||
|
||||
Scenario: Change team description
|
||||
Given team BioSistemika Process settings page of a Karli Novak user
|
||||
And I click to "i" blue button
|
||||
Then I change "I was on Triglav one summer." description with "I want to go to Nanos." description to Description field of "Edit team description" modal window
|
||||
And I click on "Update" button
|
||||
Then I should see "I want to go to Nanos." in team description field
|
||||
|
||||
Scenario: Change user role
|
||||
Given team BioSistemika Process settings page of a Karli Novak user
|
||||
And I click to Action button of a Marija Novak user in Team members table
|
||||
Then I click to "Guest" in User role modal window
|
||||
Then I should see "Guest" in Role column of a Marija Novak user in Team members table
|
||||
|
||||
Scenario: Change user role
|
||||
Given team BioSistemika Process settings page of a Karli Novak user
|
||||
And I click to Action button of a Suazana Novak user in Team members table
|
||||
Then I click to "Normal user" in User role modal window
|
||||
Then I should see "Normal user" in Role column of a Suazana Novak user in Team members table
|
||||
|
||||
Scenario: Change user role
|
||||
Given team BioSistemika Process settings page of a Karli Novak user
|
||||
And I click to Action button of a Marija Novak user in Team members table
|
||||
Then I click to "Administrator" in User role modal window
|
||||
Then I should see "Administrator" in Role column of a Marija Novak user in Team members table
|
||||
|
||||
Scenario: Change user role
|
||||
Given team BioSistemika Process settings page of a Karli Novak user
|
||||
And I click to Action button of a Suazana Novak user in Team members table
|
||||
Then I click to "Administrator" in User role modal window
|
||||
Then I should see "Administratorr" in Role column of a Suazana Novak user in Team members table
|
||||
|
||||
Scenario: Change user role
|
||||
Given team BioSistemika Process settings page of a Karli Novak user
|
||||
And I click to Action button of a Suazana Novak user in Team members table
|
||||
Then I click to "Normal user" in User role modal window
|
||||
Then I should see "Normal user" in Role column of a Suazana Novak user in Team members table
|
||||
|
||||
Scenario: User is removed
|
||||
Given team BioSistemika Process settings page of a Karli Novak user
|
||||
And I click to Action button of a Suazana Novak user in Team members table
|
||||
Then I click to "Remove" in User role modal window
|
||||
Then I should not see Suazana Novak user in Team members table
|
||||
|
||||
Scenario: User left a team
|
||||
Given team BioSistemika Process settings page of a Marija Novak user
|
||||
And I click to Leave team button of BioSistemika Process team in Team table
|
||||
|
|
Loading…
Add table
Reference in a new issue