Commit 2b4eca7d authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch 'vs-add-cc-validation-pipelines-page' into 'master'

Add CC validation on the pipeline details page [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61246
parents 90154591 766b9b8e
......@@ -11,6 +11,10 @@
.js-pipeline-container{ data: { controller_action: "#{controller.action_name}" } }
#js-pipeline-header-vue.pipeline-header-container{ data: { full_path: @project.full_path, pipeline_iid: @pipeline.iid, pipeline_id: @pipeline.id, pipelines_path: project_pipelines_path(@project) } }
- if @pipeline.failed? && @pipeline.user_not_verified?
#js-cc-validation-required-alert
- if @pipeline.commit.present?
= render "projects/pipelines/info", commit: @pipeline.commit
......
......@@ -42,6 +42,7 @@ export default {
:dismissible="false"
:title="$options.i18n.alertTitle"
:primary-button-text="$options.i18n.primaryButtonText"
data-testid="creditCardValidationRequiredAlert"
@primaryAction="showModal"
>
<gl-sprintf :message="$options.i18n.alertText">
......
import Vue from 'vue';
import CreditCardValidationRequiredAlert from 'ee/billings/components/cc_validation_required_alert.vue';
export default (containerId = 'js-cc-validation-required-alert') => {
const el = document.getElementById(containerId);
if (!el) {
return false;
}
return new Vue({
el,
render(createElement) {
return createElement(CreditCardValidationRequiredAlert);
},
});
};
import initCCValidationRequiredAlert from 'ee/credit_card_validation_required_alert';
import initPipelineSecurityDashboard from 'ee/security_dashboard/pipeline_init';
import initPipelines from '~/pages/projects/pipelines/init_pipelines';
import initPipelineDetails from '~/pipelines/pipeline_details_bundle';
......@@ -9,3 +10,4 @@ initPipelineDetails();
initPipelineSecurityDashboard();
initLicenseReport();
initCodequalityReport();
initCCValidationRequiredAlert();
......@@ -4,7 +4,8 @@ require 'spec_helper'
RSpec.describe 'Pipeline', :js do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository) }
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project, reload: true) { create(:project, :repository, namespace: namespace) }
before do
stub_feature_flags(graphql_pipeline_details_users: false)
......@@ -146,6 +147,42 @@ RSpec.describe 'Pipeline', :js do
end
end
end
context 'when :ci_require_credit_card_on_free_plan flag is on' do
before do
allow(::Gitlab).to receive(:com?).and_return(true)
create(:gitlab_subscription, namespace: namespace, hosted_plan: create(:free_plan))
stub_feature_flags(ci_require_credit_card_on_free_plan: true)
end
context 'on free plan' do
it 'does not show an alert to verify an account with a credit card' do
subject
expect(page).not_to have_selector('[data-testid="creditCardValidationRequiredAlert"]')
end
context 'when failed' do
let!(:pipeline) do
create(
:ci_empty_pipeline,
project: project,
ref: 'master',
status: 'failed',
failure_reason: 'user_not_verified',
sha: project.commit.id
)
end
it 'shows an alert to verify an account with a credit card' do
subject
expect(page).to have_selector('[data-testid="creditCardValidationRequiredAlert"]')
end
end
end
end
end
describe 'GET /:project/-/pipelines/:id/security' do
......
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