Commit ca425ff2 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Refactored view/element definition to dry up

parent 81f4eb36
...@@ -4,6 +4,7 @@ module QA ...@@ -4,6 +4,7 @@ module QA
class Side < Page::Base class Side < Page::Base
view 'app/views/layouts/nav/sidebar/_project.html.haml' do view 'app/views/layouts/nav/sidebar/_project.html.haml' do
element :settings_item element :settings_item
element :settings_link, 'link_to edit_project_path'
element :repository_link, "title: 'Repository'" element :repository_link, "title: 'Repository'"
element :top_level_items, '.sidebar-top-level-items' element :top_level_items, '.sidebar-top-level-items'
end end
......
...@@ -3,6 +3,14 @@ module QA ...@@ -3,6 +3,14 @@ module QA
module Project module Project
module Settings module Settings
module Common 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
def expand_section(selector) def expand_section(selector)
page.within(selector) do page.within(selector) do
find_button('Expand').click find_button('Expand').click
......
...@@ -7,7 +7,6 @@ module QA ...@@ -7,7 +7,6 @@ module QA
view 'app/views/projects/edit.html.haml' do view 'app/views/projects/edit.html.haml' do
element :advanced_settings_section, '%section.settings.advanced-settings' element :advanced_settings_section, '%section.settings.advanced-settings'
element :advanced_settings_expand, "= expanded ? 'Collapse' : 'Expand'"
end end
def expand_advanced_settings(&block) def expand_advanced_settings(&block)
......
...@@ -7,7 +7,6 @@ module QA ...@@ -7,7 +7,6 @@ module QA
view 'app/views/projects/deploy_keys/_index.html.haml' do view 'app/views/projects/deploy_keys/_index.html.haml' do
element :expand_deploy_keys_section, '.repository-deploy-keys' element :expand_deploy_keys_section, '.repository-deploy-keys'
element :expand_deploy_keys_button, "= expanded ? 'Collapse' : 'Expand'"
end end
def expand_deploy_keys(&block) def expand_deploy_keys(&block)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment