diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-11-22 12:31:07 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-11-28 14:47:59 +0300 |
commit | 45f2d0af4173ae8e06b548c4bef1fabe14353c85 (patch) | |
tree | 4036b5f257b0f07a42431a2c2cff41dcbdd28dd1 /spec/features/auto_deploy_spec.rb | |
parent | a8e2094c6591336405a90e4185e89752d38965bf (diff) |
Add test suit for platform::kubernetes
Diffstat (limited to 'spec/features/auto_deploy_spec.rb')
-rw-r--r-- | spec/features/auto_deploy_spec.rb | 113 |
1 files changed, 83 insertions, 30 deletions
diff --git a/spec/features/auto_deploy_spec.rb b/spec/features/auto_deploy_spec.rb index 4a7c3e4f1ab..327059b86e4 100644 --- a/spec/features/auto_deploy_spec.rb +++ b/spec/features/auto_deploy_spec.rb @@ -4,52 +4,105 @@ describe 'Auto deploy' do let(:user) { create(:user) } let(:project) { create(:project, :repository) } - before do - create :kubernetes_service, project: project - project.team << [user, :master] - sign_in user - end - - context 'when no deployment service is active' do + context 'when user configured kubernetes from Integration > Kubernetes' do before do - project.kubernetes_service.update!(active: false) + create :kubernetes_service, project: project + project.team << [user, :master] + sign_in 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 project_path(project) + expect(page).to have_no_content('Set up auto deploy') + end end - it 'does not show a button to set up auto deploy' do - visit project_path(project) - expect(page).to have_no_content('Set up auto deploy') + context 'when a deployment service is active' do + before do + project.kubernetes_service.update!(active: true) + visit project_path(project) + end + + it 'shows a button to set up auto deploy' do + expect(page).to have_link('Set up auto deploy') + end + + it 'includes OpenShift as an available template', :js do + click_link 'Set up auto deploy' + click_button 'Apply a GitLab CI Yaml template' + + within '.gitlab-ci-yml-selector' do + expect(page).to have_content('OpenShift') + end + end + + it 'creates a merge request using "auto-deploy" branch', :js do + click_link 'Set up auto deploy' + click_button 'Apply a GitLab CI Yaml template' + within '.gitlab-ci-yml-selector' do + click_on 'OpenShift' + end + wait_for_requests + click_button 'Commit changes' + + expect(page).to have_content('New Merge Request From auto-deploy into master') + end end end - context 'when a deployment service is active' do + context 'when user configured kubernetes from CI/CD > Clusters' do before do - project.kubernetes_service.update!(active: true) - visit project_path(project) + create(:cluster, :provided_by_gcp, projects: [project]) + project.team << [user, :master] + sign_in user end - it 'shows a button to set up auto deploy' do - expect(page).to have_link('Set up auto deploy') + 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 project_path(project) + expect(page).to have_no_content('Set up auto deploy') + end end - it 'includes OpenShift as an available template', :js do - click_link 'Set up auto deploy' - click_button 'Apply a GitLab CI Yaml template' + context 'when a deployment service is active' do + before do + project.kubernetes_service.update!(active: true) + visit project_path(project) + end - within '.gitlab-ci-yml-selector' do - expect(page).to have_content('OpenShift') + it 'shows a button to set up auto deploy' do + expect(page).to have_link('Set up auto deploy') end - end - it 'creates a merge request using "auto-deploy" branch', :js do - click_link 'Set up auto deploy' - click_button 'Apply a GitLab CI Yaml template' - within '.gitlab-ci-yml-selector' do - click_on 'OpenShift' + it 'includes OpenShift as an available template', :js do + click_link 'Set up auto deploy' + click_button 'Apply a GitLab CI Yaml template' + + within '.gitlab-ci-yml-selector' do + expect(page).to have_content('OpenShift') + end end - wait_for_requests - click_button 'Commit changes' - expect(page).to have_content('New Merge Request From auto-deploy into master') + it 'creates a merge request using "auto-deploy" branch', :js do + click_link 'Set up auto deploy' + click_button 'Apply a GitLab CI Yaml template' + within '.gitlab-ci-yml-selector' do + click_on 'OpenShift' + end + wait_for_requests + click_button 'Commit changes' + + expect(page).to have_content('New Merge Request From auto-deploy into master') + end end end end |