@@ -13,17 +13,37 @@ RSpec.describe 'Groups > Members > Manage members', :saas, :js do
...
@@ -13,17 +13,37 @@ RSpec.describe 'Groups > Members > Manage members', :saas, :js do
let_it_be(:group){create(:group)}
let_it_be(:group){create(:group)}
let(:premium_plan){create(:premium_plan)}
let(:premium_plan){create(:premium_plan)}
let(:ultimate_plan){create(:ultimate_plan)}
shared_examples"adding one user doesn't trigger an overage modal"do
shared_examples"adding one user with a given role doesn't trigger an overage modal"do|role|
itdo
itdo
group.add_owner(user1)
group.add_owner(user1)
add_user_by_name(user2.name,'Developer')
add_user_by_name(user2.name,role)
expect(page).not_tohave_content("You are about to incur additional charges")
expect(page).not_tohave_content("You are about to incur additional charges")
wait_for_requests
wait_for_requests
page.refresh
page.refresh
page.within(second_row)do
expect(page).tohave_content(user2.name)
expect(page).tohave_button(role)
end
end
end
shared_examples"shows an overage for one Developer added and invites them to a group if confirmed"do
itdo
group.add_owner(user1)
add_user_by_name(user2.name,'Developer')
expect(page).tohave_content("You are about to incur additional charges")
expect(page).tohave_content("Your subscription includes 1 seat. If you continue, the #{group.name} group will have 2 seats in use and will be billed for the overage. Learn more.")
click_button'Continue'
page.refresh
page.within(second_row)do
page.within(second_row)do
expect(page).tohave_content(user2.name)
expect(page).tohave_content(user2.name)
expect(page).tohave_button('Developer')
expect(page).tohave_button('Developer')
...
@@ -41,7 +61,7 @@ RSpec.describe 'Groups > Members > Manage members', :saas, :js do
...
@@ -41,7 +61,7 @@ RSpec.describe 'Groups > Members > Manage members', :saas, :js do
it'invites a member to a group if confirmed',:aggregate_failuresdo
it_behaves_like"shows an overage for one Developer added and invites them to a group if confirmed"
group.add_owner(user1)
add_user_by_name(user2.name,'Developer')
expect(page).tohave_content("You are about to incur additional charges")
expect(page).tohave_content("Your subscription includes 1 seat. If you continue, the #{group.name} group will have 2 seats in use and will be billed for the overage. Learn more.")
click_button'Continue'
page.refresh
page.within(second_row)do
expect(page).tohave_content(user2.name)
expect(page).tohave_button('Developer')
end
end
it'get back to initial modal if not confirmed',:aggregate_failuresdo
it'get back to initial modal if not confirmed',:aggregate_failuresdo
group.add_owner(user1)
group.add_owner(user1)
...
@@ -113,6 +118,15 @@ RSpec.describe 'Groups > Members > Manage members', :saas, :js do
...
@@ -113,6 +118,15 @@ RSpec.describe 'Groups > Members > Manage members', :saas, :js do
end
end
end
end
context'when adding a member to a ultimate group with no places left'do