diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/features/projects/environments/environments_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/features/projects/environments/environments_spec.rb')
-rw-r--r-- | spec/features/projects/environments/environments_spec.rb | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 8c032660726..27167f95104 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -12,8 +12,20 @@ RSpec.describe 'Environments page', :js do sign_in(user) end + def actions_button_selector + '[data-testid="environment-actions-button"]' + end + + def action_link_selector + '[data-testid="manual-action-link"]' + end + def stop_button_selector - %q{button[title="Stop environment"]} + 'button[title="Stop environment"]' + end + + def upcoming_deployment_content_selector + '[data-testid="upcoming-deployment-content"]' end describe 'page tabs' do @@ -187,18 +199,17 @@ RSpec.describe 'Environments page', :js do end it 'shows a play button' do - find('.js-environment-actions-dropdown').click - + find(actions_button_selector).click expect(page).to have_content(action.name) end it 'allows to play a manual action', :js do expect(action).to be_manual - find('.js-environment-actions-dropdown').click + find(actions_button_selector).click expect(page).to have_content(action.name) - expect { find('.js-manual-action-link').click } + expect { find(action_link_selector).click } .not_to change { Ci::Pipeline.count } end @@ -301,11 +312,11 @@ RSpec.describe 'Environments page', :js do end it 'has a dropdown for actionable jobs' do - expect(page).to have_selector('.dropdown-new.btn.btn-default [data-testid="play-icon"]') + expect(page).to have_selector("#{actions_button_selector} [data-testid=\"play-icon\"]") end it "has link to the delayed job's action" do - find('.js-environment-actions-dropdown').click + find(actions_button_selector).click expect(page).to have_button('delayed job') expect(page).to have_content(/\d{2}:\d{2}:\d{2}/) @@ -320,7 +331,7 @@ RSpec.describe 'Environments page', :js do end it "shows 00:00:00 as the remaining time" do - find('.js-environment-actions-dropdown').click + find(actions_button_selector).click expect(page).to have_content("00:00:00") end @@ -328,8 +339,8 @@ RSpec.describe 'Environments page', :js do context 'when user played a delayed job immediately' do before do - find('.js-environment-actions-dropdown').click - page.accept_confirm { click_button('delayed job') } + find(actions_button_selector).click + accept_confirm { find(action_link_selector).click } wait_for_requests end @@ -355,6 +366,26 @@ RSpec.describe 'Environments page', :js do expect(page).to have_content('No deployments yet') end end + + context 'when there is an upcoming deployment' do + let_it_be(:project) { create(:project, :repository) } + + let!(:deployment) do + create(:deployment, :running, + environment: environment, + sha: project.commit.id) + end + + it "renders the upcoming deployment", :aggregate_failures do + visit_environments(project) + + within(upcoming_deployment_content_selector) do + expect(page).to have_content("##{deployment.iid}") + expect(page).to have_selector("a[href=\"#{project_job_path(project, deployment.deployable)}\"]") + expect(page).to have_link(href: /#{deployment.user.username}/) + end + end + end end it 'does have a new environment button' do @@ -423,10 +454,10 @@ RSpec.describe 'Environments page', :js do expect(page).to have_content 'review-1' expect(page).to have_content 'review-2' within('.ci-table') do - within('.gl-responsive-table-row:nth-child(3)') do + within('[data-qa-selector="environment_item"]', text: 'review-1') do expect(find('.js-auto-stop').text).not_to be_empty end - within('.gl-responsive-table-row:nth-child(4)') do + within('[data-qa-selector="environment_item"]', text: 'review-2') do expect(find('.js-auto-stop').text).not_to be_empty end end |