diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-17 20:00:03 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-17 20:00:03 +0100 |
commit | 8a7860fd7fe91a9d2642dab9e66be5b22012901d (patch) | |
tree | 8215c73a6f4d648b98bf5a7d47be1fd70afd1c29 /spec/features/environments_spec.rb | |
parent | 4dbed5a249265b3690888b3fcfc91da44412f7f1 (diff) | |
parent | 726a414169e6c3219ff4fd410da3efd53fc7f912 (diff) | |
download | gitlab-ce-8a7860fd7fe91a9d2642dab9e66be5b22012901d.tar.gz |
Merge branch 'master' into 22539-display-folders
* master: (154 commits)
Fix typos
Fix wrong changelog item
Add missing item for 8.13.6
Change last_used_at to use touch
Add chat_name partial
Mention Git strategy none
Fix code review
adds fix for security issue when annonymous user does not ...
Remove ToC since it's now supported in the docs portal itself
Add 8.14 to versions with further additions to review apps
Add Limitations sections to environments and review apps docs
Add link to environments docs
Fix URL to review apps docs
Add a prerequisites section, add some links
Link to NGINX example project for the time being
Get rid most of the irrelevant sections
Add note about current limitation in $CI_BUILD_REF_NAME
Add an intro and an Overview section for Review Apps
WIP review apps
Add Review apps link to CI README
...
Conflicts:
spec/features/environments_spec.rb
Diffstat (limited to 'spec/features/environments_spec.rb')
-rw-r--r-- | spec/features/environments_spec.rb | 200 |
1 files changed, 101 insertions, 99 deletions
diff --git a/spec/features/environments_spec.rb b/spec/features/environments_spec.rb index 9c15a815d0d..0d2162857a1 100644 --- a/spec/features/environments_spec.rb +++ b/spec/features/environments_spec.rb @@ -1,163 +1,161 @@ require 'spec_helper' -feature 'Environments', feature: true, js: true do +feature 'Environments page', :feature, :js do given(:project) { create(:empty_project) } given(:user) { create(:user) } given(:role) { :developer } background do - login_as(user) project.team << [user, role] + login_as(user) end - describe 'when showing environments' do - given!(:environment) { } - given!(:deployment) { } - given!(:manual) { } + given!(:environment) { } + given!(:deployment) { } + given!(:manual) { } - before do - visit namespace_project_environments_path(project.namespace, project) + before do + visit_environments(project) + end + + describe 'page tabs' do + scenario 'shows "Available" and "Stopped" tab with links' do + expect(page).to have_link('Available') + expect(page).to have_link('Stopped') end + end - context 'shows two tabs' do - scenario 'shows "Available" and "Stopped" tab with links' do - expect(page).to have_link('Available') - expect(page).to have_link('Stopped') - end + context 'without environments' do + scenario 'does show no environments' do + expect(page).to have_content('You don\'t have any environments right now.') end - context 'without environments' do - scenario 'does show no environments' do - expect(page).to have_content('You don\'t have any environments right now.') - end + scenario 'does show 0 as counter for environments in both tabs' do + expect(page.find('.js-available-environments-count').text).to eq('0') + expect(page.find('.js-stopped-environments-count').text).to eq('0') + end + end + + context 'with environments' do + given(:environment) { create(:environment, project: project) } - scenario 'does show 0 as counter for environments in both tabs' do - expect(page.find('.js-available-environments-count').text).to eq('0') - expect(page.find('.js-stopped-environments-count').text).to eq('0') + scenario 'does show environment name' do + expect(page).to have_link(environment.name) + end + + scenario 'does show number of available and stopped environments' do + expect(page.find('.js-available-environments-count').text).to eq('1') + expect(page.find('.js-stopped-environments-count').text).to eq('0') + end + + context 'without deployments' do + scenario 'does show no deployments' do + expect(page).to have_content('No deployments yet') end end - context 'with environments' do - given(:environment) { create(:environment, project: project) } + context 'with deployments' do + given(:project) { create(:project) } - scenario 'does show environment name' do - expect(page).to have_link(environment.name) + given(:deployment) do + create(:deployment, environment: environment, + sha: project.commit.id) end - scenario 'does show number of available and stopped environments' do - expect(page.find('.js-available-environments-count').text).to eq('1') - expect(page.find('.js-stopped-environments-count').text).to eq('0') + scenario 'does show deployment SHA' do + expect(page).to have_link(deployment.short_sha) end - context 'without deployments' do - scenario 'does show no deployments' do - expect(page).to have_content('No deployments yet') - end + scenario 'does show deployment internal id' do + expect(page).to have_content(deployment.iid) end - context 'with deployments' do - given(:project) { create(:project) } + context 'with build and manual actions' do + given(:pipeline) { create(:ci_pipeline, project: project) } + given(:build) { create(:ci_build, pipeline: pipeline) } + + given(:manual) do + create(:ci_build, :manual, pipeline: pipeline, name: 'deploy to production') + end given(:deployment) do create(:deployment, environment: environment, + deployable: build, sha: project.commit.id) end - scenario 'does show deployment SHA' do - expect(page).to have_link(deployment.short_sha) + scenario 'does show a play button' do + find('.dropdown-play-icon-container').click + expect(page).to have_content(manual.name.humanize) end - scenario 'does show deployment internal id' do - expect(page).to have_content(deployment.iid) - end + scenario 'does allow to play manual action', js: true do + expect(manual).to be_skipped - context 'with build and manual actions' do - given(:pipeline) { create(:ci_pipeline, project: project) } - given(:build) { create(:ci_build, pipeline: pipeline) } + find('.dropdown-play-icon-container').click + expect(page).to have_content(manual.name.humanize) - given(:manual) do - create(:ci_build, :manual, pipeline: pipeline, name: 'deploy to production') - end + expect { click_link(manual.name.humanize) } + .not_to change { Ci::Pipeline.count } - given(:deployment) do - create(:deployment, environment: environment, - deployable: build, - sha: project.commit.id) - end - - scenario 'does show a play button' do - find('.dropdown-play-icon-container').click - expect(page).to have_content(manual.name.humanize) - end + expect(manual.reload).to be_pending + end - scenario 'does allow to play manual action', js: true do - expect(manual).to be_skipped + scenario 'does show build name and id' do + expect(page).to have_link("#{build.name} ##{build.id}") + end - find('.dropdown-play-icon-container').click - expect(page).to have_content(manual.name.humanize) + scenario 'does not show stop button' do + expect(page).not_to have_selector('.stop-env-link') + end - expect { click_link(manual.name.humanize) } - .not_to change { Ci::Pipeline.count } + scenario 'does not show external link button' do + expect(page).not_to have_css('external-url') + end - expect(manual.reload).to be_pending - end + context 'with external_url' do + given(:environment) { create(:environment, project: project, external_url: 'https://git.gitlab.com') } + given(:build) { create(:ci_build, pipeline: pipeline) } + given(:deployment) { create(:deployment, environment: environment, deployable: build) } - scenario 'does show build name and id' do - expect(page).to have_link("#{build.name} ##{build.id}") + scenario 'does show an external link button' do + expect(page).to have_link(nil, href: environment.external_url) end + end - scenario 'does not show stop button' do - expect(page).not_to have_selector('.stop-env-link') - end + context 'with stop action' do + given(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'close_app') } + given(:deployment) { create(:deployment, environment: environment, deployable: build, on_stop: 'close_app') } - scenario 'does not show external link button' do - expect(page).not_to have_css('external-url') + scenario 'does show stop button' do + expect(page).to have_selector('.stop-env-link') end - context 'with external_url' do - given(:environment) { create(:environment, project: project, external_url: 'https://git.gitlab.com') } - given(:build) { create(:ci_build, pipeline: pipeline) } - given(:deployment) { create(:deployment, environment: environment, deployable: build) } + scenario 'starts build when stop button clicked' do + find('.stop-env-link').click - scenario 'does show an external link button' do - expect(page).to have_link(nil, href: environment.external_url) - end + expect(page).to have_content('close_app') end - context 'with stop action' do - given(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'close_app') } - given(:deployment) { create(:deployment, environment: environment, deployable: build, on_stop: 'close_app') } + context 'for reporter' do + let(:role) { :reporter } - scenario 'does show stop button' do - expect(page).to have_selector('.stop-env-link') - end - - scenario 'starts build when stop button clicked' do - find('.stop-env-link').click - - expect(page).to have_content('close_app') - end - - context 'for reporter' do - let(:role) { :reporter } - - scenario 'does not show stop button' do - expect(page).not_to have_selector('.stop-env-link') - end + scenario 'does not show stop button' do + expect(page).not_to have_selector('.stop-env-link') end end end end end + end - scenario 'does have a New environment button' do - expect(page).to have_link('New environment') - end + scenario 'does have a New environment button' do + expect(page).to have_link('New environment') end describe 'when creating a new environment' do before do - visit namespace_project_environments_path(project.namespace, project) + visit_environments(project) end context 'when logged as developer' do @@ -196,4 +194,8 @@ feature 'Environments', feature: true, js: true do end end end + + def visit_environments(project) + visit namespace_project_environments_path(project.namespace, project) + end end |