diff options
Diffstat (limited to 'qa/qa/page/project/settings/common.rb')
-rw-r--r-- | qa/qa/page/project/settings/common.rb | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index 5d1d5120929..319cb1045b6 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -3,11 +3,29 @@ module QA module Project module Settings module Common - def expand(selector) + 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 - find(selector).click + 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 + yield if block_given? + end end end end |