summaryrefslogtreecommitdiff
path: root/qa/qa/page/settings/common.rb
blob: a683a6829d56e973ce677b30d151a8e1c41b4dfa (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
module QA
  module Page
    module Settings
      module Common
        # 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
              # Because it is possible to click the button before the JS toggle code is bound
              wait(reload: false) do
                click_button 'Expand' unless first('button', text: 'Collapse')

                page.has_content?('Collapse')
              end

              yield if block_given?
            end
          end
        end
      end
    end
  end
end