Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-09 06:13:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-09 06:13:02 +0300
commit44a883b53a586ff5966adce0aacfaa9d31e80441 (patch)
treeb2040c2fa853aec7dd181c5c6d8129b638ee3693 /spec
parentde19091107816cd08b0b83f7d908776e71a43606 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/ci/pipeline_new/components/pipeline_new_form_spec.js16
-rw-r--r--spec/frontend/ci/pipeline_new/mock_data.js2
-rw-r--r--spec/tooling/danger/specs_spec.rb10
-rw-r--r--spec/views/projects/pipelines/show.html.haml_spec.rb17
4 files changed, 44 insertions, 1 deletions
diff --git a/spec/frontend/ci/pipeline_new/components/pipeline_new_form_spec.js b/spec/frontend/ci/pipeline_new/components/pipeline_new_form_spec.js
index 6f18899ebac..bd1158a1c32 100644
--- a/spec/frontend/ci/pipeline_new/components/pipeline_new_form_spec.js
+++ b/spec/frontend/ci/pipeline_new/components/pipeline_new_form_spec.js
@@ -32,6 +32,7 @@ import {
mockProjectId,
mockRefs,
mockYamlVariables,
+ mockPipelineConfigButtonText,
} from '../mock_data';
Vue.use(VueApollo);
@@ -42,6 +43,7 @@ jest.mock('~/lib/utils/url_utility', () => ({
const projectRefsEndpoint = '/root/project/refs';
const pipelinesPath = '/root/project/-/pipelines';
+const pipelinesEditorPath = '/root/project/-/ci/editor';
const projectPath = '/root/project/-/pipelines/config_variables';
const newPipelinePostResponse = { id: 1 };
const defaultBranch = 'main';
@@ -65,6 +67,7 @@ describe('Pipeline New Form', () => {
wrapper.findAllByTestId('pipeline-form-ci-variable-value-dropdown');
const findValueDropdownItems = (dropdown) => dropdown.findAllComponents(GlDropdownItem);
const findErrorAlert = () => wrapper.findByTestId('run-pipeline-error-alert');
+ const findPipelineConfigButton = () => wrapper.findByTestId('ci-cd-pipeline-configuration');
const findWarningAlert = () => wrapper.findByTestId('run-pipeline-warning-alert');
const findWarningAlertSummary = () => findWarningAlert().findComponent(GlSprintf);
const findWarnings = () => wrapper.findAllByTestId('run-pipeline-warning');
@@ -106,6 +109,8 @@ describe('Pipeline New Form', () => {
propsData: {
projectId: mockProjectId,
pipelinesPath,
+ pipelinesEditorPath,
+ canViewPipelineEditor: true,
projectPath,
defaultBranch,
refParam: defaultBranch,
@@ -500,6 +505,17 @@ describe('Pipeline New Form', () => {
expect(findSubmitButton().props('disabled')).toBe(false);
});
+ it('shows pipeline configuration button for user who can view', () => {
+ expect(findPipelineConfigButton().exists()).toBe(true);
+ expect(findPipelineConfigButton().text()).toBe(mockPipelineConfigButtonText);
+ });
+
+ it('does not show pipeline configuration button for user who can not view', () => {
+ createComponentWithApollo({ props: { canViewPipelineEditor: false } });
+
+ expect(findPipelineConfigButton().exists()).toBe(false);
+ });
+
it('does not show the credit card validation required alert', () => {
expect(findCCAlert().exists()).toBe(false);
});
diff --git a/spec/frontend/ci/pipeline_new/mock_data.js b/spec/frontend/ci/pipeline_new/mock_data.js
index 5b935c0c819..175f513217b 100644
--- a/spec/frontend/ci/pipeline_new/mock_data.js
+++ b/spec/frontend/ci/pipeline_new/mock_data.js
@@ -133,3 +133,5 @@ export const mockCiConfigVariablesResponseWithoutDesc = mockCiConfigVariablesQue
mockYamlVariablesWithoutDesc,
);
export const mockNoCachedCiConfigVariablesResponse = mockCiConfigVariablesQueryResponse(null);
+
+export const mockPipelineConfigButtonText = 'Go to the pipeline editor';
diff --git a/spec/tooling/danger/specs_spec.rb b/spec/tooling/danger/specs_spec.rb
index cdac5954f92..09550f037d6 100644
--- a/spec/tooling/danger/specs_spec.rb
+++ b/spec/tooling/danger/specs_spec.rb
@@ -259,6 +259,10 @@ RSpec.describe Tooling::Danger::Specs, feature_category: :tooling do
" ee: true do",
"\n",
"RSpec.describe Issues :aggregate_failures,",
+ " feature_category: :team_planning do",
+ "\n",
+ "RSpec.describe MergeRequest :aggregate_failures,",
+ " :js,",
" feature_category: :team_planning do"
]
end
@@ -275,7 +279,11 @@ RSpec.describe Tooling::Danger::Specs, feature_category: :tooling do
"+ feature_category: planning_analytics do",
"+RSpec.describe Epics :aggregate_failures,",
"+ ee: true do",
- "+RSpec.describe Issues :aggregate_failures,"
+ "+RSpec.describe Issues :aggregate_failures,",
+ "+RSpec.describe MergeRequest :aggregate_failures,",
+ "+ :js,",
+ "+ feature_category: :team_planning do",
+ "+RSpec.describe 'line in commit diff but no longer in working copy' do"
]
end
diff --git a/spec/views/projects/pipelines/show.html.haml_spec.rb b/spec/views/projects/pipelines/show.html.haml_spec.rb
index feafc4dc5b9..81a11874886 100644
--- a/spec/views/projects/pipelines/show.html.haml_spec.rb
+++ b/spec/views/projects/pipelines/show.html.haml_spec.rb
@@ -13,6 +13,7 @@ RSpec.describe 'projects/pipelines/show', feature_category: :pipeline_compositio
before do
assign(:project, project)
assign(:pipeline, presented_pipeline)
+ allow(view).to receive(:current_user) { user }
end
context 'when pipeline has errors' do
@@ -32,6 +33,22 @@ RSpec.describe 'projects/pipelines/show', feature_category: :pipeline_compositio
expect(rendered).not_to have_selector('#js-pipeline-tabs')
end
+
+ it 'renders the pipeline editor button with correct link for users who can view' do
+ project.add_developer(user)
+
+ render
+
+ expect(rendered).to have_link s_('Go to the pipeline editor'),
+ href: project_ci_pipeline_editor_path(project)
+ end
+
+ it 'renders the pipeline editor button with correct link for users who can not view' do
+ render
+
+ expect(rendered).not_to have_link s_('Go to the pipeline editor'),
+ href: project_ci_pipeline_editor_path(project)
+ end
end
context 'when pipeline is valid' do