summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/pipeline_editor/show.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/page/project/pipeline_editor/show.rb')
-rw-r--r--qa/qa/page/project/pipeline_editor/show.rb60
1 files changed, 41 insertions, 19 deletions
diff --git a/qa/qa/page/project/pipeline_editor/show.rb b/qa/qa/page/project/pipeline_editor/show.rb
index 38c87c8daa1..e430884ea08 100644
--- a/qa/qa/page/project/pipeline_editor/show.rb
+++ b/qa/qa/page/project/pipeline_editor/show.rb
@@ -6,37 +6,59 @@ module QA
module PipelineEditor
class Show < QA::Page::Base
view 'app/assets/javascripts/pipeline_editor/components/file_nav/branch_switcher.vue' do
- element :branch_selector_button
- element :menu_branch_button
+ element :branch_selector_button, require: true
+ element :branch_menu_item_button
+ element :branch_menu_container
end
view 'app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue' do
- element :target_branch_field
+ element :target_branch_field, require: true
end
- def has_branch_selector_button?
- has_element? :branch_selector_button
+ view 'app/assets/javascripts/pipeline_editor/components/drawer/pipeline_editor_drawer.vue' do
+ element :toggle_sidebar_collapse_button
+ element :drawer_content
end
- def click_branch_selector_button
- wait_until(reload: false) do
- has_element?(:branch_selector_button)
- end
- click_element(:branch_selector_button, skip_finished_loading_check: true)
+ view 'app/assets/javascripts/vue_shared/components/source_editor.vue' do
+ element :source_editor_container, require: true
end
- def select_branch_from_dropdown(branch_to_switch_to)
- wait_until(reload: false) do
- has_element?(:menu_branch_button)
- end
- click_element(:menu_branch_button, text: branch_to_switch_to, skip_finished_loading_check: true)
+ def initialize
+ super
+
+ wait_for_requests
+ close_toggle_sidebar
+ end
+
+ def open_branch_selector_dropdown
+ click_element(:branch_selector_button)
+ end
+
+ def select_branch_from_dropdown(branch_name)
+ wait_for_animated_element(:branch_menu_container)
+ click_element(:branch_menu_item_button, text: branch_name)
+
+ wait_for_requests
end
def target_branch_name
- wait_until(reload: false) do
- has_element?(:target_branch_field)
- end
- find_element(:target_branch_field, skip_finished_loading_check: true).value
+ find_element(:target_branch_field).value
+ end
+
+ def editing_content
+ find_element(:source_editor_container).text
+ end
+
+ private
+
+ # If the page thinks user has never opened pipeline editor before
+ # It will expand pipeline editor sidebar by default
+ # Collapse the sidebar if it is expanded
+ def close_toggle_sidebar
+ return unless has_element?(:drawer_content)
+
+ click_element(:toggle_sidebar_collapse_button)
end
end
end