summaryrefslogtreecommitdiff
path: root/spec/features/auto_deploy_spec.rb
diff options
context:
space:
mode:
authorAdam Niedzielski <adamsunday@gmail.com>2016-12-21 16:21:55 +0100
committerAdam Niedzielski <adamsunday@gmail.com>2016-12-21 16:21:55 +0100
commit9809a9af8a3980f8a65262295cfd9701e793ac11 (patch)
tree7f7f392a203798b2cbebba6c08f8875c433ca4f0 /spec/features/auto_deploy_spec.rb
parent528c3e2b8d2d65257e489601220f34b918b80e17 (diff)
downloadgitlab-ce-9809a9af8a3980f8a65262295cfd9701e793ac11.tar.gz
Introduce "Set up autodeploy" button to help configure GitLab CI for deploymentadam-auto-deploy
The button allows to choose a ".gitlab-ci.yml" template that automatically sets up the deployment of an application. The currently supported template is Kubernetes template.
Diffstat (limited to 'spec/features/auto_deploy_spec.rb')
-rw-r--r--spec/features/auto_deploy_spec.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/features/auto_deploy_spec.rb b/spec/features/auto_deploy_spec.rb
new file mode 100644
index 00000000000..92c5b1cbb3b
--- /dev/null
+++ b/spec/features/auto_deploy_spec.rb
@@ -0,0 +1,56 @@
+require 'spec_helper'
+
+describe 'Auto deploy' do
+ include WaitForAjax
+
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :kubernetes) }
+
+ before do
+ project.team << [user, :master]
+ login_as user
+ end
+
+ context 'when no deployment service is active' do
+ before do
+ project.kubernetes_service.update!(active: false)
+ end
+
+ it 'does not show a button to set up auto deploy' do
+ visit namespace_project_path(project.namespace, project)
+ expect(page).to have_no_content('Set up autodeploy')
+ end
+ end
+
+ context 'when a deployment service is active' do
+ before do
+ project.kubernetes_service.update!(active: true)
+ visit namespace_project_path(project.namespace, project)
+ end
+
+ it 'shows a button to set up auto deploy' do
+ expect(page).to have_link('Set up autodeploy')
+ end
+
+ it 'includes Kubernetes as an available template', js: true do
+ click_link 'Set up autodeploy'
+ click_button 'Choose a GitLab CI Yaml template'
+
+ within '.gitlab-ci-yml-selector' do
+ expect(page).to have_content('Kubernetes')
+ end
+ end
+
+ it 'creates a merge request using "autodeploy" branch', js: true do
+ click_link 'Set up autodeploy'
+ click_button 'Choose a GitLab CI Yaml template'
+ within '.gitlab-ci-yml-selector' do
+ click_on 'Kubernetes'
+ end
+ wait_for_ajax
+ click_button 'Commit Changes'
+
+ expect(page).to have_content('New Merge Request From autodeploy into master')
+ end
+ end
+end