Commit 5d76d004 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'ali/blocked-deployments-link-to-environments-page' into 'master'

Update CI job page for blocked deployments

See merge request gitlab-org/gitlab!82456
parents 6bbb3831 e56c04cb
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Blocked deployment job page', :js do
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:build) { create(:ci_build, :manual, environment: 'production', project: project) }
before do
environment = create(:environment, name: 'production', project: project)
create(:protected_environment, project: project, name: 'production', required_approval_count: 1)
create(:deployment, :blocked, project: project, environment: environment, deployable: build)
project.add_developer(user)
sign_in(user)
visit(project_job_path(project, build))
end
it 'displays a button linking to the environments page' do
expect(page).to have_text('Waiting for approval')
expect(page).to have_link('Go to environments page to approve or reject', href: project_environments_path(project))
find("[data-testid='job-empty-state-action']").click
expect(page).to have_current_path(project_environments_path(project))
end
end
......@@ -9,11 +9,35 @@ module Gitlab
{
image: 'illustrations/manual_action.svg',
size: 'svg-394',
title: 'Waiting for approval',
content: "This job deploys to the protected environment \"#{subject.deployment&.environment&.name}\" which requires approvals. Use the Deployments API to approve or reject the deployment."
title: _('Waiting for approval'),
content: _("This job deploys to the protected environment \"%{environment}\" which requires approvals.") % { environment: subject.deployment&.environment&.name }
}
end
def has_action?
true
end
def action_icon
nil
end
def action_title
nil
end
def action_button_title
_('Go to environments page to approve or reject')
end
def action_path
project_environments_path(subject.project)
end
def action_method
:get
end
def self.matches?(build, user)
build.waiting_for_deployment_approval?
end
......
......@@ -16955,6 +16955,9 @@ msgstr ""
msgid "Go to environments"
msgstr ""
msgid "Go to environments page to approve or reject"
msgstr ""
msgid "Go to epic"
msgstr ""
......@@ -37837,6 +37840,9 @@ msgstr ""
msgid "This job depends on upstream jobs that need to succeed in order for this job to be triggered"
msgstr ""
msgid "This job deploys to the protected environment \"%{environment}\" which requires approvals."
msgstr ""
msgid "This job does not have a trace."
msgstr ""
......@@ -41246,6 +41252,9 @@ msgstr ""
msgid "Wait for the file to load to copy its contents"
msgstr ""
msgid "Waiting for approval"
msgstr ""
msgid "Waiting for merge (open and assigned)"
msgstr ""
......
......@@ -5,22 +5,10 @@ require 'spec_helper'
RSpec.describe Gitlab::Ci::Status::Build::WaitingForApproval do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
let_it_be(:build) { create(:ci_build, :manual, environment: 'production', project: project) }
subject { described_class.new(Gitlab::Ci::Status::Core.new(build, user)) }
describe '#illustration' do
let(:build) { create(:ci_build, :manual, environment: 'production', project: project) }
before do
environment = create(:environment, name: 'production', project: project)
create(:deployment, :blocked, project: project, environment: environment, deployable: build)
end
it { expect(subject.illustration).to include(:image, :size) }
it { expect(subject.illustration[:title]).to eq('Waiting for approval') }
it { expect(subject.illustration[:content]).to include('This job deploys to the protected environment "production"') }
end
describe '.matches?' do
subject { described_class.matches?(build, user) }
......@@ -46,4 +34,39 @@ RSpec.describe Gitlab::Ci::Status::Build::WaitingForApproval do
end
end
end
describe '#illustration' do
before do
environment = create(:environment, name: 'production', project: project)
create(:deployment, :blocked, project: project, environment: environment, deployable: build)
end
it { expect(subject.illustration).to include(:image, :size) }
it { expect(subject.illustration[:title]).to eq('Waiting for approval') }
it { expect(subject.illustration[:content]).to include('This job deploys to the protected environment "production"') }
end
describe '#has_action?' do
it { expect(subject.has_action?).to be_truthy }
end
describe '#action_icon' do
it { expect(subject.action_icon).to be_nil }
end
describe '#action_title' do
it { expect(subject.action_title).to be_nil }
end
describe '#action_button_title' do
it { expect(subject.action_button_title).to eq('Go to environments page to approve or reject') }
end
describe '#action_path' do
it { expect(subject.action_path).to include('environments') }
end
describe '#action_method' do
it { expect(subject.action_method).to eq(:get) }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment