diff options
Diffstat (limited to 'qa/qa/page/search')
-rw-r--r-- | qa/qa/page/search/results.rb | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/qa/qa/page/search/results.rb b/qa/qa/page/search/results.rb index 85f1d224935..55477db8804 100644 --- a/qa/qa/page/search/results.rb +++ b/qa/qa/page/search/results.rb @@ -1,53 +1,55 @@ # frozen_string_literal: true -module QA::Page - module Search - class Results < QA::Page::Base - view 'app/views/search/_category.html.haml' do - element :code_tab - element :projects_tab - end +module QA + module Page + module Search + class Results < QA::Page::Base + view 'app/views/search/_category.html.haml' do + element :code_tab + element :projects_tab + end - view 'app/views/search/results/_blob_data.html.haml' do - element :result_item_content - element :file_title_content - element :file_text_content - end + view 'app/views/search/results/_blob_data.html.haml' do + element :result_item_content + element :file_title_content + element :file_text_content + end - view 'app/views/shared/projects/_project.html.haml' do - element :project - end + view 'app/views/shared/projects/_project.html.haml' do + element :project + end - def switch_to_code - switch_to_tab(:code_tab) - end + def switch_to_code + switch_to_tab(:code_tab) + end - def switch_to_projects - switch_to_tab(:projects_tab) - end + def switch_to_projects + switch_to_tab(:projects_tab) + end - def has_file_in_project?(file_name, project_name) - has_element?(:result_item_content, text: "#{project_name}: #{file_name}") - end + def has_file_in_project?(file_name, project_name) + has_element?(:result_item_content, text: "#{project_name}: #{file_name}") + end - def has_file_with_content?(file_name, file_text) - within_element_by_index(:result_item_content, 0) do - break false unless has_element?(:file_title_content, text: file_name) + def has_file_with_content?(file_name, file_text) + within_element_by_index(:result_item_content, 0) do + break false unless has_element?(:file_title_content, text: file_name) - has_element?(:file_text_content, text: file_text) + has_element?(:file_text_content, text: file_text) + end end - end - def has_project?(project_name) - has_element?(:project, project_name: project_name) - end + def has_project?(project_name) + has_element?(:project, project_name: project_name) + end - private + private - def switch_to_tab(tab) - retry_until do - click_element(tab) - has_active_element?(tab) + def switch_to_tab(tab) + retry_until do + click_element(tab) + has_active_element?(tab) + end end end end |