2021-01-03 14:25:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.shared_examples 'issuable invite members experiments' do
|
2021-04-17 20:07:23 +05:30
|
|
|
context 'when a privileged user can invite' do
|
2021-01-03 14:25:43 +05:30
|
|
|
it 'shows a link for inviting members and follows through to the members page' do
|
|
|
|
project.add_maintainer(user)
|
|
|
|
visit issuable_path
|
|
|
|
|
|
|
|
find('.block.assignee .edit-link').click
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
page.within '.dropdown-menu-user' do
|
|
|
|
expect(page).to have_link('Invite Members', href: project_project_members_path(project))
|
|
|
|
expect(page).to have_selector('[data-track-event="click_invite_members"]')
|
|
|
|
expect(page).to have_selector('[data-track-label="edit_assignee"]')
|
|
|
|
end
|
|
|
|
|
|
|
|
click_link 'Invite Members'
|
|
|
|
|
|
|
|
expect(current_path).to eq project_project_members_path(project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when invite_members_version_b experiment is enabled' do
|
|
|
|
before do
|
2021-02-22 17:27:13 +05:30
|
|
|
stub_experiment_for_subject(invite_members_version_b: true)
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows a link for inviting members and follows through to modal' do
|
|
|
|
project.add_developer(user)
|
|
|
|
visit issuable_path
|
|
|
|
|
|
|
|
find('.block.assignee .edit-link').click
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
page.within '.dropdown-menu-user' do
|
|
|
|
expect(page).to have_link('Invite Members', href: '#')
|
|
|
|
expect(page).to have_selector('[data-track-event="click_invite_members_version_b"]')
|
|
|
|
expect(page).to have_selector('[data-track-label="edit_assignee"]')
|
|
|
|
end
|
|
|
|
|
|
|
|
click_link 'Invite Members'
|
|
|
|
|
|
|
|
expect(page).to have_content("Oops, this feature isn't ready yet")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
context 'when invite_members_version_b experiment is disabled' do
|
2021-01-03 14:25:43 +05:30
|
|
|
it 'shows author in assignee dropdown and no invite link' do
|
2021-04-17 20:07:23 +05:30
|
|
|
project.add_developer(user)
|
2021-01-03 14:25:43 +05:30
|
|
|
visit issuable_path
|
|
|
|
|
|
|
|
find('.block.assignee .edit-link').click
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
page.within '.dropdown-menu-user' do
|
|
|
|
expect(page).not_to have_link('Invite Members')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|