From 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 17 Dec 2020 11:59:07 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-7-stable-ee --- .../projects/environments/environments_spec.rb | 55 +++++++++++++++++----- 1 file changed, 43 insertions(+), 12 deletions(-) (limited to 'spec/features/projects/environments/environments_spec.rb') 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 -- cgit v1.2.1