summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/settings/common.rb
blob: c7955124ef3bc5333a9d1ea7db02dd9910065baf (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
module QA
  module Page
    module Project
      module Settings
        module Common
          def self.included(base)
            base.class_eval do
              view 'app/views/projects/edit.html.haml' do
                element :advanced_settings_expand, "= expanded ? 'Collapse' : 'Expand'"
              end
            end
          end

          # Click the Expand button present in the specified section
          #
          # @param [String] name present in the container in the DOM
          def expand_section(name)
            page.within('#content-body') do
              page.within('section', text: name) do
                click_button 'Expand' unless first('button', text: 'Collapse')

                yield if block_given?
              end
            end
          end
        end
      end
    end
  end
end