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

common.rb « settings « page « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 229218ffaf4bd4e3b6b7156461d9d7f983cadf03 (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
# frozen_string_literal: true

module QA
  module Page
    module Settings
      module Common
        # Click the Expand button present in the specified section
        #
        # @param [Symbol|String] element_name `element` name defined in a `view` block
        def expand_content(element_name)
          within_element(element_name) do
            # Because it is possible to click the button before the JS toggle code is bound
            wait_until(reload: false, message: "Waiting until content is expanded") do
              click_button 'Expand' unless has_css?('button', text: 'Collapse', wait: 1)

              has_content?('Collapse')
            end

            yield if block_given?
          end
        end
      end
    end
  end
end