summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/settings/common.rb
blob: 7fa04b62fdecfa949e848a322844d1b73dcedcdf (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
module QA
  module Page
    module Project
      module Settings
        module Common
          def expand(element_name)
            page.within('#content-body') do
              click_element(element_name)

              yield
            end
          end

          def expand_section(name)
            within_section(name) do
              # Don't expand if it's already expanded
              click_button 'Expand' unless first('button', text: 'Collapse')

              yield
            end
          end

          def within_section(name)
            page.within('#content-body') do
              page.within('section', text: name) do
                yield
              end
            end
          end
        end
      end
    end
  end
end