gitlab-org--gitlab-foss/spec/features/auto_deploy_spec.rb

63 lines
1.7 KiB
Ruby
Raw Normal View History

require 'spec_helper'
describe 'Auto deploy' do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
before do
2016-12-21 15:25:23 -05:00
project.create_kubernetes_service(
active: true,
properties: {
namespace: project.path,
api_url: 'https://kubernetes.example.com',
token: 'a' * 40,
}
)
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)
2016-12-23 05:08:09 -05:00
expect(page).to have_no_content('Set up auto deploy')
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
2016-12-23 05:08:09 -05:00
expect(page).to have_link('Set up auto deploy')
end
2016-12-23 05:08:09 -05:00
it 'includes OpenShift as an available template', js: true do
click_link 'Set up auto deploy'
click_button 'Apply a GitLab CI Yaml template'
within '.gitlab-ci-yml-selector' do
2016-12-21 15:13:13 -05:00
expect(page).to have_content('OpenShift')
end
end
2016-12-23 05:08:09 -05:00
it 'creates a merge request using "auto-deploy" branch', js: true do
click_link 'Set up auto deploy'
click_button 'Apply a GitLab CI Yaml template'
within '.gitlab-ci-yml-selector' do
2016-12-21 15:13:13 -05:00
click_on 'OpenShift'
end
wait_for_ajax
2017-04-04 14:06:32 -04:00
click_button 'Commit changes'
2016-12-23 05:08:09 -05:00
expect(page).to have_content('New Merge Request From auto-deploy into master')
end
end
end