From 0275069cc0ecce232bd0c9e383ac5dcf086f2400 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Tue, 9 Oct 2018 16:21:54 +1300 Subject: [PATCH] Move to using qa-* selectors Adds the corresponding qa-* classes into the view files for each new Page element we added. Adjust the click actions to match. --- .../javascripts/environments/components/environment_item.vue | 1 + app/views/layouts/nav/sidebar/_project.html.haml | 2 +- app/views/projects/environments/_external_url.html.haml | 2 +- qa/qa/page/menu/side.rb | 3 ++- qa/qa/page/project/operations/environments/index.rb | 4 ++-- qa/qa/page/project/operations/environments/show.rb | 4 ++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/environments/components/environment_item.vue b/app/assets/javascripts/environments/components/environment_item.vue index a1d8e531940..ad5d16874f3 100644 --- a/app/assets/javascripts/environments/components/environment_item.vue +++ b/app/assets/javascripts/environments/components/environment_item.vue @@ -482,6 +482,7 @@ export default { v-if="!model.isFolder" class="environment-name table-mobile-content"> {{ model.name }} diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index 25cd53b378a..48025f9bd20 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -216,7 +216,7 @@ = _('Metrics') = nav_link(controller: :environments, action: [:index, :folder, :show, :new, :edit, :create, :update, :stop, :terminal]) do - = link_to project_environments_path(@project), title: _('Environments'), class: 'shortcuts-environments' do + = link_to project_environments_path(@project), title: _('Environments'), class: 'shortcuts-environments qa-operations-environments-link' do %span = _('Environments') diff --git a/app/views/projects/environments/_external_url.html.haml b/app/views/projects/environments/_external_url.html.haml index 4694bc39d54..b3a82d1ef41 100644 --- a/app/views/projects/environments/_external_url.html.haml +++ b/app/views/projects/environments/_external_url.html.haml @@ -1,4 +1,4 @@ - if environment.external_url && can?(current_user, :read_environment, environment) - = link_to environment.external_url, target: '_blank', rel: 'noopener noreferrer', class: 'btn external-url has-tooltip', title: s_('Environments|Open live environment') do + = link_to environment.external_url, target: '_blank', rel: 'noopener noreferrer', class: 'btn external-url has-tooltip qa-view-deployment', title: s_('Environments|Open live environment') do = sprite_icon('external-link') View deployment diff --git a/qa/qa/page/menu/side.rb b/qa/qa/page/menu/side.rb index d0b9bbec844..3c08f14d6da 100644 --- a/qa/qa/page/menu/side.rb +++ b/qa/qa/page/menu/side.rb @@ -9,6 +9,7 @@ module QA element :link_pipelines element :pipelines_settings_link, "title: _('CI / CD')" element :operations_kubernetes_link, "title: _('Kubernetes')" + element :operations_environments_link element :issues_link, /link_to.*shortcuts-issues/ element :issues_link_text, "Issues" element :merge_requests_link, /link_to.*shortcuts-merge_requests/ @@ -43,7 +44,7 @@ module QA def click_operations_environments hover_operations do within_submenu do - click_link('Environments') + click_element(:operations_environments_link) end end end diff --git a/qa/qa/page/project/operations/environments/index.rb b/qa/qa/page/project/operations/environments/index.rb index 62b154e5721..63965a57edd 100644 --- a/qa/qa/page/project/operations/environments/index.rb +++ b/qa/qa/page/project/operations/environments/index.rb @@ -7,12 +7,12 @@ module QA module Environments class Index < Page::Base view 'app/assets/javascripts/environments/components/environment_item.vue' do - element :environment_link, 'class="environment-name table-mobile-content"' + element :environment_link end def go_to_environment(environment_name) wait(reload: false) do - click_link(environment_name) + find(element_selector_css(:environment_link), text: environment_name).click end end end diff --git a/qa/qa/page/project/operations/environments/show.rb b/qa/qa/page/project/operations/environments/show.rb index 6736e027c5d..aa88c218c89 100644 --- a/qa/qa/page/project/operations/environments/show.rb +++ b/qa/qa/page/project/operations/environments/show.rb @@ -7,11 +7,11 @@ module QA module Environments class Show < Page::Base view 'app/views/projects/environments/_external_url.html.haml' do - element :view_deployment, %q{title: s_('Environments|Open live environment')} + element :view_deployment end def view_deployment(&block) - new_window = window_opened_by { click_on('Open live environment') } + new_window = window_opened_by { click_element(:view_deployment) } within_window(new_window, &block) if block end -- GitLab