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

general.rb « settings « group « page « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 86585eee1217a526d6166380c954c307922e23c4 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# frozen_string_literal: true

module QA
  module Page
    module Group
      module Settings
        class General < QA::Page::Base
          include ::QA::Page::Settings::Common
          include Page::Component::VisibilitySetting
          include Page::Component::ConfirmModal
          include Page::Component::NamespaceSelect

          view 'app/views/groups/edit.html.haml' do
            element :permission_lfs_2fa_content
            element :advanced_settings_content
          end

          view 'app/views/groups/settings/_permissions.html.haml' do
            element :save_permissions_changes_button
          end

          view 'app/views/groups/settings/_general.html.haml' do
            element :group_name_field
            element :save_name_visibility_settings_button
          end

          view 'app/views/groups/settings/_lfs.html.haml' do
            element :lfs_checkbox
          end

          view 'app/views/shared/_allow_request_access.html.haml' do
            element :request_access_checkbox
          end

          view 'app/views/groups/settings/_two_factor_auth.html.haml' do
            element :require_2fa_checkbox
          end

          view 'app/views/groups/settings/_project_creation_level.html.haml' do
            element :project_creation_level_dropdown
          end

          def set_group_name(name)
            find_element(:group_name_field).send_keys([:command, 'a'], :backspace)
            find_element(:group_name_field).set name
          end

          def click_save_name_visibility_settings_button
            click_element(:save_name_visibility_settings_button)
          end

          def set_lfs_enabled
            expand_content(:permission_lfs_2fa_content)
            check_element(:lfs_checkbox, true)
            click_element(:save_permissions_changes_button)
          end

          def set_lfs_disabled
            expand_content(:permission_lfs_2fa_content)
            uncheck_element(:lfs_checkbox, true)
            click_element(:save_permissions_changes_button)
          end

          def set_request_access_enabled
            expand_content(:permission_lfs_2fa_content)
            check_element(:request_access_checkbox, true)
            click_element(:save_permissions_changes_button)
          end

          def set_request_access_disabled
            expand_content(:permission_lfs_2fa_content)
            uncheck_element(:request_access_checkbox, true)
            click_element(:save_permissions_changes_button)
          end

          def set_require_2fa_enabled
            expand_content(:permission_lfs_2fa_content)
            check_element(:require_2fa_checkbox, true)
            click_element(:save_permissions_changes_button)
          end

          def set_require_2fa_disabled
            expand_content(:permission_lfs_2fa_content)
            uncheck_element(:require_2fa_checkbox, true)
            click_element(:save_permissions_changes_button)
          end

          def set_project_creation_level(value)
            expand_content(:permission_lfs_2fa_content)
            select_element(:project_creation_level_dropdown, value)
            click_element(:save_permissions_changes_button)
          end

          def toggle_request_access
            expand_content(:permission_lfs_2fa_content)

            if find_element(:request_access_checkbox, visible: false).checked?
              uncheck_element(:request_access_checkbox, true)
            else
              check_element(:request_access_checkbox, true)
            end

            click_element(:save_permissions_changes_button)
          end
        end
      end
    end
  end
end

QA::Page::Group::Settings::General.prepend_mod_with('Page::Group::Settings::General', namespace: QA)