diff options
author | Tomislav Nikic <tnikic@gitlab.com> | 2019-07-30 08:04:26 +0000 |
---|---|---|
committer | Mark Lapierre <mlapierre@gitlab.com> | 2019-07-30 08:04:26 +0000 |
commit | 7906503d97b8481cf2be1331cb4479fef3806973 (patch) | |
tree | fbeb7b2f43edda17cd2c9f88d92e30add23c6805 | |
parent | 14e7cbe5813db792a4591565ea872745937e8406 (diff) | |
download | gitlab-ce-7906503d97b8481cf2be1331cb4479fef3806973.tar.gz |
Getting on par with EE
This commit covers all the files that where changed in the
identically named branch on EE that is creating an elasticsearch
test case.
-rw-r--r-- | app/views/layouts/_search.html.haml | 3 | ||||
-rw-r--r-- | app/views/layouts/nav/sidebar/_admin.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/_category.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/results/_blob_data.html.haml | 6 | ||||
-rw-r--r-- | qa/qa.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/admin/menu.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/main/menu.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/search/results.rb | 33 |
8 files changed, 64 insertions, 6 deletions
diff --git a/app/views/layouts/_search.html.haml b/app/views/layouts/_search.html.haml index 9cac8266eaf..bc900992cb0 100644 --- a/app/views/layouts/_search.html.haml +++ b/app/views/layouts/_search.html.haml @@ -13,7 +13,8 @@ tabindex: '1', autocomplete: 'off', data: { issues_path: issues_dashboard_path, - mr_path: merge_requests_dashboard_path }, + mr_path: merge_requests_dashboard_path, + qa_selector: 'search_term_field' }, aria: { label: _('Search or jump to…') } %button.hidden.js-dropdown-search-toggle{ type: 'button', data: { toggle: 'dropdown' } } .dropdown-menu.dropdown-select.js-dashboard-search-options diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index 87133c7ba22..cb39c830170 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -236,7 +236,7 @@ %span = _('General') = nav_link(path: 'application_settings#integrations') do - = link_to integrations_admin_application_settings_path, title: _('Integrations') do + = link_to integrations_admin_application_settings_path, title: _('Integrations'), data: { qa_selector: 'integration_settings_link' } do %span = _('Integrations') = nav_link(path: 'application_settings#repository') do diff --git a/app/views/search/_category.html.haml b/app/views/search/_category.html.haml index ee7d89a9bd8..18613ff4c16 100644 --- a/app/views/search/_category.html.haml +++ b/app/views/search/_category.html.haml @@ -12,7 +12,7 @@ %ul.nav-links.search-filter.scrolling-tabs.nav.nav-tabs - if @project - if project_search_tabs?(:blobs) - %li{ class: active_when(@scope == 'blobs') } + %li{ class: active_when(@scope == 'blobs'), data: { qa_selector: 'code_tab' } } = link_to search_filter_path(scope: 'blobs') do = _("Code") %span.badge.badge-pill diff --git a/app/views/search/results/_blob_data.html.haml b/app/views/search/results/_blob_data.html.haml index 143e9f91ca3..36b6ea7bd37 100644 --- a/app/views/search/results/_blob_data.html.haml +++ b/app/views/search/results/_blob_data.html.haml @@ -1,10 +1,10 @@ -.blob-result +.blob-result{ data: { qa_selector: 'result_item_content' } } .file-holder - .js-file-title.file-title + .js-file-title.file-title{ data: { qa_selector: 'file_title_content' } } = link_to blob_link do %i.fa.fa-file %strong = search_blob_title(project, file_name) - if blob.data - .file-content.code.term + .file-content.code.term{ data: { qa_selector: 'file_text_content' } } = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline @@ -314,6 +314,10 @@ module QA autoload :Login, 'qa/page/mattermost/login' end + module Search + autoload :Results, 'qa/page/search/results' + end + ## # Classes describing components that are used by several pages. # diff --git a/qa/qa/page/admin/menu.rb b/qa/qa/page/admin/menu.rb index eea5717f5a7..61ec9854726 100644 --- a/qa/qa/page/admin/menu.rb +++ b/qa/qa/page/admin/menu.rb @@ -13,6 +13,10 @@ module QA element :admin_settings_metrics_and_profiling_item end + view 'app/views/layouts/nav/sidebar/_admin.html.haml' do + element :integration_settings_link + end + def go_to_repository_settings hover_settings do within_submenu do @@ -21,6 +25,14 @@ module QA end end + def go_to_integration_settings + hover_settings do + within_submenu do + click_element :integration_settings_link + end + end + end + def go_to_general_settings hover_settings do within_submenu do diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index d86d554356e..e3039149ab4 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -27,6 +27,10 @@ module QA element :your_projects_link end + view 'app/views/layouts/_search.html.haml' do + element :search_term_field + end + def go_to_groups within_top_menu do click_element :groups_dropdown @@ -71,6 +75,10 @@ module QA click_element :snippets_link end + def search_for(term) + fill_element :search_term_field, "#{term}\n" + end + def has_personal_area?(wait: Capybara.default_max_wait_time) has_element?(:user_avatar, wait: wait) end diff --git a/qa/qa/page/search/results.rb b/qa/qa/page/search/results.rb new file mode 100644 index 00000000000..b9b18abf660 --- /dev/null +++ b/qa/qa/page/search/results.rb @@ -0,0 +1,33 @@ +# 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 + end + + view 'app/views/search/results/_blob_data.html.haml' do + element :result_item_content + element :file_title_content + element :file_text_content + end + + def switch_to_code + click_element(:code_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_with_content?(file_name, file_text) + within_element_by_index :result_item_content, 0 do + false unless has_element? :file_title_content, text: file_name + + has_element? :file_text_content, text: file_text + end + end + end + end +end |