2021-06-08 01:23:25 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Spec
|
|
|
|
module Support
|
|
|
|
module Helpers
|
|
|
|
module Features
|
|
|
|
module InviteMembersModalHelper
|
2021-10-27 15:23:28 +05:30
|
|
|
def invite_member(name, role: 'Guest', expires_at: nil, area_of_focus: false)
|
2021-06-08 01:23:25 +05:30
|
|
|
click_on 'Invite members'
|
|
|
|
|
|
|
|
page.within '#invite-members-modal' do
|
2021-09-30 23:02:18 +05:30
|
|
|
find('[data-testid="members-token-select-input"]').set(name)
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
click_button name
|
|
|
|
choose_options(role, expires_at)
|
2021-10-27 15:23:28 +05:30
|
|
|
choose_area_of_focus if area_of_focus
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
click_button 'Invite'
|
|
|
|
|
|
|
|
page.refresh
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def invite_group(name, role: 'Guest', expires_at: nil)
|
|
|
|
click_on 'Invite a group'
|
|
|
|
|
|
|
|
click_on 'Select a group'
|
|
|
|
wait_for_requests
|
|
|
|
click_button name
|
|
|
|
choose_options(role, expires_at)
|
|
|
|
|
|
|
|
click_button 'Invite'
|
|
|
|
|
|
|
|
page.refresh
|
|
|
|
end
|
|
|
|
|
|
|
|
def choose_options(role, expires_at)
|
|
|
|
unless role == 'Guest'
|
|
|
|
click_button 'Guest'
|
|
|
|
wait_for_requests
|
|
|
|
click_button role
|
|
|
|
end
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
fill_in 'YYYY-MM-DD', with: expires_at.strftime('%Y-%m-%d') if expires_at
|
|
|
|
end
|
|
|
|
|
|
|
|
def choose_area_of_focus
|
|
|
|
page.within '[data-testid="area-of-focus-checks"]' do
|
|
|
|
check 'Contribute to the codebase'
|
|
|
|
check 'Collaborate on open issues and merge requests'
|
|
|
|
end
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|