Commit 0b846d7c authored by Dan Davison's avatar Dan Davison

Merge branch '57930-create-smoke-test-for-autodevops' into 'master'

Resolve "Create smoke test for AutoDevOps"

Closes #57930

See merge request gitlab-org/gitlab-ce!25442
parents cd401a58 5ae46fe7
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
- if @pipeline.queued_duration - if @pipeline.queued_duration
= "(queued for #{time_interval_in_words(@pipeline.queued_duration)})" = "(queued for #{time_interval_in_words(@pipeline.queued_duration)})"
.well-segment .well-segment.qa-pipeline-badges
.icon-container .icon-container
= sprite_icon('flag') = sprite_icon('flag')
- if @pipeline.latest? - if @pipeline.latest?
......
- if show_auto_devops_implicitly_enabled_banner?(project, current_user) - if show_auto_devops_implicitly_enabled_banner?(project, current_user)
.auto-devops-implicitly-enabled-banner.alert.alert-warning .qa-auto-devops-banner.auto-devops-implicitly-enabled-banner.alert.alert-warning
- more_information_link = link_to _('More information'), help_page_path('topics/autodevops/index.md'), target: '_blank', class: 'alert-link' - more_information_link = link_to _('More information'), help_page_path('topics/autodevops/index.md'), target: '_blank', class: 'alert-link'
- auto_devops_message = s_("AutoDevOps|The Auto DevOps pipeline has been enabled and will be used if no alternative CI configuration file is found. %{more_information_link}") % { more_information_link: more_information_link } - auto_devops_message = s_("AutoDevOps|The Auto DevOps pipeline has been enabled and will be used if no alternative CI configuration file is found. %{more_information_link}") % { more_information_link: more_information_link }
= auto_devops_message.html_safe = auto_devops_message.html_safe
......
...@@ -260,6 +260,10 @@ module QA ...@@ -260,6 +260,10 @@ module QA
autoload :Sidebar, 'qa/page/issuable/sidebar' autoload :Sidebar, 'qa/page/issuable/sidebar'
end end
module Alert
autoload :AutoDevopsAlert, 'qa/page/alert/auto_devops_alert'
end
module Layout module Layout
autoload :Banner, 'qa/page/layout/banner' autoload :Banner, 'qa/page/layout/banner'
end end
......
# frozen_string_literal: true
module QA
module Page
module Alert
class AutoDevopsAlert < Page::Base
view 'app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml' do
element :auto_devops_banner
end
end
end
end
end
...@@ -18,6 +18,10 @@ module QA::Page ...@@ -18,6 +18,10 @@ module QA::Page
element :status_icon, 'ci-status-icon-${status}' # rubocop:disable QA/ElementWithPattern element :status_icon, 'ci-status-icon-${status}' # rubocop:disable QA/ElementWithPattern
end end
view 'app/views/projects/pipelines/_info.html.haml' do
element :pipeline_badges
end
def running? def running?
within('.ci-header-container') do within('.ci-header-container') do
page.has_content?('running') page.has_content?('running')
...@@ -32,6 +36,12 @@ module QA::Page ...@@ -32,6 +36,12 @@ module QA::Page
end end
end end
def has_tag?(tag_name)
within_element(:pipeline_badges) do
has_selector?('.badge', text: tag_name)
end
end
def go_to_job(job_name) def go_to_job(job_name)
find_element(:job_link, job_name).click find_element(:job_link, job_name).click
end end
......
...@@ -4,13 +4,13 @@ require 'pathname' ...@@ -4,13 +4,13 @@ require 'pathname'
module QA module QA
# Transient failure issue: https://gitlab.com/gitlab-org/quality/nightly/issues/68 # Transient failure issue: https://gitlab.com/gitlab-org/quality/nightly/issues/68
context 'Configure', :orchestrated, :kubernetes, :quarantine do context 'Configure' do
describe 'Auto DevOps support' do
def login def login
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials) Page::Main::Login.perform(&:sign_in_using_credentials)
end end
describe 'Auto DevOps support', :orchestrated, :kubernetes, :quarantine do
[true, false].each do |rbac| [true, false].each do |rbac|
context "when rbac is #{rbac ? 'enabled' : 'disabled'}" do context "when rbac is #{rbac ? 'enabled' : 'disabled'}" do
before(:all) do before(:all) do
...@@ -173,5 +173,38 @@ module QA ...@@ -173,5 +173,38 @@ module QA
end end
end end
end end
describe 'Auto DevOps', :smoke do
it 'enables AutoDevOps by default' do
login
project = Resource::Project.fabricate! do |p|
p.name = Runtime::Env.auto_devops_project_name || 'project-with-autodevops'
p.description = 'Project with AutoDevOps'
end
project.visit!
Page::Alert::AutoDevopsAlert.perform do |alert|
expect(alert).to have_text(/.*The Auto DevOps pipeline has been enabled.*/)
end
# Create AutoDevOps repo
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.directory = Pathname
.new(__dir__)
.join('../../../../../fixtures/auto_devops_rack')
push.commit_message = 'Create AutoDevOps compatible Project'
end
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:go_to_latest_pipeline)
Page::Project::Pipeline::Show.perform do |pipeline|
expect(pipeline).to have_tag('Auto DevOps')
end
end
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment