From bde028c4af83574b44bdcb6bde0ec18a09d15845 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Fri, 5 Oct 2018 16:36:32 +1300 Subject: [PATCH] Assert prod environment is live after Auto Devops Goes to Operations > Environments and clicks on the "View deployment" link for production. --- qa/qa.rb | 5 ++++ qa/qa/page/menu/side.rb | 8 +++++++ .../project/operations/environments/index.rb | 23 +++++++++++++++++++ .../project/operations/environments/show.rb | 23 +++++++++++++++++++ .../create_project_with_auto_devops_spec.rb | 10 ++++++++ 5 files changed, 69 insertions(+) create mode 100644 qa/qa/page/project/operations/environments/index.rb create mode 100644 qa/qa/page/project/operations/environments/show.rb diff --git a/qa/qa.rb b/qa/qa.rb index 227d4424b09..061185f68fb 100644 --- a/qa/qa.rb +++ b/qa/qa.rb @@ -201,6 +201,11 @@ module QA end module Operations + module Environments + autoload :Index, 'qa/page/project/operations/environments/index' + autoload :Show, 'qa/page/project/operations/environments/show' + end + module Kubernetes autoload :Index, 'qa/page/project/operations/kubernetes/index' autoload :Add, 'qa/page/project/operations/kubernetes/add' diff --git a/qa/qa/page/menu/side.rb b/qa/qa/page/menu/side.rb index a1eedfea42e..d0b9bbec844 100644 --- a/qa/qa/page/menu/side.rb +++ b/qa/qa/page/menu/side.rb @@ -40,6 +40,14 @@ module QA end end + def click_operations_environments + hover_operations do + within_submenu do + click_link('Environments') + end + end + end + def click_operations_kubernetes hover_operations do within_submenu do diff --git a/qa/qa/page/project/operations/environments/index.rb b/qa/qa/page/project/operations/environments/index.rb new file mode 100644 index 00000000000..62b154e5721 --- /dev/null +++ b/qa/qa/page/project/operations/environments/index.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Operations + 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"' + end + + def go_to_environment(environment_name) + wait(reload: false) do + click_link(environment_name) + end + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/operations/environments/show.rb b/qa/qa/page/project/operations/environments/show.rb new file mode 100644 index 00000000000..6736e027c5d --- /dev/null +++ b/qa/qa/page/project/operations/environments/show.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Operations + 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')} + end + + def view_deployment(&block) + new_window = window_opened_by { click_on('Open live environment') } + + within_window(new_window, &block) if block + end + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb index 4604936916b..6286e516180 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb @@ -65,6 +65,16 @@ module QA expect(pipeline).to have_build('test', status: :success, wait: 600) expect(pipeline).to have_build('production', status: :success, wait: 1200) end + + Page::Menu::Side.act { click_operations_environments } + Page::Project::Operations::Environments::Index.perform do |index| + index.go_to_environment('production') + end + Page::Project::Operations::Environments::Show.perform do |show| + show.view_deployment do + expect(page).to have_content('Hello World!') + end + end end end end