Welcome to mirror list, hosted at ThFree Co, Russian Federation.

invite_members_modal_helper.rb « features « helpers « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7b8cd6963c096008234215a6f0554b2cf8107f3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
              find('[data-testid="members-token-select-input"]').set(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