2015-12-23 02:04:40 +05:30
|
|
|
class Spinach::Features::GroupMembers < Spinach::FeatureSteps
|
2017-09-10 17:25:29 +05:30
|
|
|
include WaitForRequests
|
2015-12-23 02:04:40 +05:30
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedGroup
|
|
|
|
include SharedUser
|
|
|
|
|
|
|
|
step 'I should see user "John Doe" in team list' do
|
|
|
|
expect(group_members_list).to have_content("John Doe")
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see user "Mary Jane" in team list' do
|
|
|
|
expect(group_members_list).not_to have_content("Mary Jane")
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on the "Remove User From Group" button for "John Doe"' do
|
2017-08-17 22:00:37 +05:30
|
|
|
find(:css, '.project-members-page li', text: "John Doe").find(:css, 'a.btn-remove').click
|
2015-12-23 02:04:40 +05:30
|
|
|
# poltergeist always confirms popups.
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on the "Remove User From Group" button for "Mary Jane"' do
|
|
|
|
find(:css, 'li', text: "Mary Jane").find(:css, 'a.btn-remove').click
|
|
|
|
# poltergeist always confirms popups.
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the "Remove User From Group" button for "John Doe"' do
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(find(:css, '.project-members-page li', text: "John Doe")).not_to have_selector(:css, 'a.btn-remove')
|
2015-12-23 02:04:40 +05:30
|
|
|
# poltergeist always confirms popups.
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the "Remove User From Group" button for "Mary Jane"' do
|
|
|
|
expect(find(:css, 'li', text: "Mary Jane")).not_to have_selector(:css, 'a.btn-remove')
|
|
|
|
# poltergeist always confirms popups.
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I change the "Mary Jane" role to "Developer"' do
|
|
|
|
member = mary_jane_member
|
|
|
|
|
|
|
|
page.within "#group_member_#{member.id}" do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button member.human_access
|
|
|
|
|
|
|
|
page.within '.dropdown-menu' do
|
|
|
|
click_link 'Developer'
|
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "Mary Jane" as "Developer"' do
|
|
|
|
member = mary_jane_member
|
|
|
|
|
|
|
|
page.within "#group_member_#{member.id}" do
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).to have_content "Developer"
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def mary_jane_member
|
|
|
|
user = User.find_by(name: "Mary Jane")
|
|
|
|
owned_group.members.find_by(user_id: user.id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def group_members_list
|
|
|
|
find(".panel .content-list")
|
|
|
|
end
|
|
|
|
end
|