diff options
Diffstat (limited to 'spec/support/helpers/features/invite_members_modal_helper.rb')
-rw-r--r-- | spec/support/helpers/features/invite_members_modal_helper.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/support/helpers/features/invite_members_modal_helper.rb b/spec/support/helpers/features/invite_members_modal_helper.rb new file mode 100644 index 00000000000..1127c817656 --- /dev/null +++ b/spec/support/helpers/features/invite_members_modal_helper.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module Spec + module Support + module Helpers + module Features + module InviteMembersModalHelper + def invite_member(name, role: 'Guest', expires_at: nil) + click_on 'Invite members' + + page.within '#invite-members-modal' do + fill_in 'Select members or type email addresses', with: name + + wait_for_requests + click_button name + choose_options(role, expires_at) + + 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 + + fill_in 'YYYY-MM-DD', with: expires_at.try(:strftime, '%Y-%m-%d') + end + end + end + end + end +end |