diff --git a/app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue b/app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue index 8536db78dfb845f8a44171e5ba3761b921e4b9fb..d9da238358feadffbd5a6dcd0ac078977fec7a96 100644 --- a/app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue +++ b/app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue @@ -54,15 +54,15 @@ export default { return { message: this.defaultMessage, openMergeRequest: false, - targetBranch: this.currentBranch, + sourceBranch: this.currentBranch, }; }, computed: { isCommitFormFilledOut() { - return this.message && this.targetBranch; + return this.message && this.sourceBranch; }, - isCurrentBranchTarget() { - return this.targetBranch === this.currentBranch; + isCurrentBranchSourceBranch() { + return this.sourceBranch === this.currentBranch; }, isSubmitDisabled() { return !this.isCommitFormFilledOut || (!this.hasUnsavedChanges && !this.isNewCiConfigFile); @@ -79,7 +79,7 @@ export default { onSubmit() { this.$emit('submit', { message: this.message, - targetBranch: this.targetBranch, + sourceBranch: this.sourceBranch, openMergeRequest: this.openMergeRequest, }); }, @@ -93,7 +93,7 @@ export default { }, i18n: { commitMessage: __('Commit message'), - targetBranch: __('Target Branch'), + sourceBranch: __('Branch'), startMergeRequest: __('Start a %{new_merge_request} with these changes'), newMergeRequest: __('new merge request'), commitChanges: __('Commit changes'), @@ -120,20 +120,20 @@ export default { /> </gl-form-group> <gl-form-group - id="target-branch-group" - :label="$options.i18n.targetBranch" + id="source-branch-group" + :label="$options.i18n.sourceBranch" label-cols-sm="2" - label-for="target-branch-field" + label-for="source-branch-field" > <gl-form-input - id="target-branch-field" - v-model="targetBranch" + id="source-branch-field" + v-model="sourceBranch" class="gl-font-monospace!" required - data-qa-selector="target_branch_field" + data-qa-selector="source_branch_field" /> <gl-form-checkbox - v-if="!isCurrentBranchTarget" + v-if="!isCurrentBranchSourceBranch" v-model="openMergeRequest" data-testid="new-mr-checkbox" data-qa-selector="new_mr_checkbox" diff --git a/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue b/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue index 4ef598d6ff3af479287f47443a4160b428d9a89c..9cbf60b1c8f03f6d9a1aa6121c0efb85bd51e3aa 100644 --- a/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue +++ b/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue @@ -75,7 +75,7 @@ export default { }, }, methods: { - async onCommitSubmit({ message, targetBranch, openMergeRequest }) { + async onCommitSubmit({ message, sourceBranch, openMergeRequest }) { this.isSaving = true; try { @@ -88,7 +88,7 @@ export default { variables: { action: this.action, projectPath: this.projectFullPath, - branch: targetBranch, + branch: sourceBranch, startBranch: this.currentBranch, message, filePath: this.ciConfigPath, @@ -104,12 +104,11 @@ export default { if (errors?.length) { this.$emit('showError', { type: COMMIT_FAILURE, reasons: errors }); } else { - const commitBranch = targetBranch; const params = openMergeRequest ? { type: COMMIT_SUCCESS_WITH_REDIRECT, params: { - sourceBranch: commitBranch, + sourceBranch, targetBranch: this.currentBranch, }, } @@ -119,10 +118,10 @@ export default { ...params, }); - this.updateLastCommitBranch(targetBranch); - this.updateCurrentBranch(targetBranch); + this.updateLastCommitBranch(sourceBranch); + this.updateCurrentBranch(sourceBranch); - if (this.currentBranch === targetBranch) { + if (this.currentBranch === sourceBranch) { this.$emit('updateCommitSha'); } } diff --git a/qa/qa/page/project/pipeline_editor/show.rb b/qa/qa/page/project/pipeline_editor/show.rb index 1a8e1e0799419c74c11e4144468dddf19c641507..16bdbb54f95a32bdd6cf0ccd2568491d2989dde2 100644 --- a/qa/qa/page/project/pipeline_editor/show.rb +++ b/qa/qa/page/project/pipeline_editor/show.rb @@ -12,7 +12,7 @@ class Show < QA::Page::Base end view 'app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue' do - element :target_branch_field, required: true + element :source_branch_field, required: true end view 'app/assets/javascripts/pipeline_editor/components/editor/ci_editor_header.vue' do @@ -57,8 +57,8 @@ def select_branch_from_dropdown(branch_name) wait_for_requests end - def target_branch_name - find_element(:target_branch_field).value + def source_branch_name + find_element(:source_branch_field).value end def editing_content @@ -76,8 +76,8 @@ def submit_changes wait_for_requests end - def set_target_branch(name) - find_element(:target_branch_field).fill_in(with: name) + def set_source_branch(name) + find_element(:source_branch_field).fill_in(with: name) end def current_branch diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb index 8d2af3ea0df44f0f7a32875598aa3354bec83284..ac91a9dd2d3d5cff12ec985228fe30f7c4ccd89a 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb @@ -73,7 +73,7 @@ module QA show.select_branch_from_dropdown(random_test_string) aggregate_failures do - expect(show.target_branch_name).to eq(random_test_string), 'Target branch field is not showing expected branch name.' + expect(show.source_branch_name).to eq(random_test_string), 'Branch field is not showing expected branch name.' expect(show.editing_content).to have_content(random_test_string), 'Editor content does not include expected test string.' end @@ -81,7 +81,7 @@ module QA show.select_branch_from_dropdown(project.default_branch) aggregate_failures do - expect(show.target_branch_name).to eq(project.default_branch), 'Target branch field is not showing expected branch name.' + expect(show.source_branch_name).to eq(project.default_branch), 'Branch field is not showing expected branch name.' expect(show.editing_content).to have_content(project.default_branch), 'Editor content does not include expected test string.' end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb index b9f616aa7338477ea417c1f0bb6e464b887e0117..931bb97ba32fbb887bd7025c5b02a4f5bfaaa42d 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb @@ -34,8 +34,8 @@ module QA expect(show).to have_no_new_mr_checkbox end - # The new MR checkbox is visible after a new target branch name is set - show.set_target_branch(SecureRandom.hex(10)) + # The new MR checkbox is visible after a new branch name is set + show.set_source_branch(SecureRandom.hex(10)) expect(show).to have_new_mr_checkbox show.select_new_mr_checkbox diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb index 00c5d4c74d40ff0ccb791bbf95ccec83c96b84ef..d34df17c47729908f2d41ed4f474bafda5449e94 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb @@ -53,13 +53,13 @@ module QA it 'creates new pipeline and target branch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349005' do Page::Project::PipelineEditor::Show.perform do |show| show.write_to_editor(random_test_string) - show.set_target_branch(random_test_string) + show.set_source_branch(random_test_string) show.submit_changes Support::Waiter.wait_until { project.pipelines.size > 1 } aggregate_failures do - expect(show.target_branch_name).to eq(random_test_string) + expect(show.source_branch_name).to eq(random_test_string) expect(show.current_branch).to eq(random_test_string) expect(show.editing_content).to have_content(random_test_string) expect { show.pipeline_id }.to eventually_eq(project.pipelines.pluck(:id).max).within(max_duration: 60, sleep_interval: 3) diff --git a/spec/features/projects/ci/editor_spec.rb b/spec/features/projects/ci/editor_spec.rb index ad4381a526adefa70ebac0a48b886d3ce3497e48..6fcdffeb80149c4577335427be74b5c539a7bc1b 100644 --- a/spec/features/projects/ci/editor_spec.rb +++ b/spec/features/projects/ci/editor_spec.rb @@ -53,7 +53,7 @@ def switch_to_branch(branch) end it 'displays new branch as selected after commiting on a new branch' do - find('#target-branch-field').set('new_branch', clear: :backspace) + find('#source-branch-field').set('new_branch', clear: :backspace) page.within('#source-editor-') do find('textarea').send_keys '123' @@ -112,7 +112,7 @@ def switch_to_branch(branch) it 'user who creates a MR is taken to the merge request page without warnings' do expect(page).not_to have_content('New merge request') - find_field('Target Branch').set 'new_branch' + find_field('Branch').set 'new_branch' find_field('Start a new merge request with these changes').click click_button 'Commit changes' diff --git a/spec/frontend/pipeline_editor/components/commit/commit_form_spec.js b/spec/frontend/pipeline_editor/components/commit/commit_form_spec.js index 59bd71b0e607dd379dc5ec3f1ad98ee171518493..bec6c2a8d0cb8837f98e346ac6f26b7dd3f23001 100644 --- a/spec/frontend/pipeline_editor/components/commit/commit_form_spec.js +++ b/spec/frontend/pipeline_editor/components/commit/commit_form_spec.js @@ -71,7 +71,7 @@ describe('Pipeline Editor | Commit Form', () => { expect(wrapper.emitted('submit')[0]).toEqual([ { message: mockCommitMessage, - targetBranch: mockDefaultBranch, + sourceBranch: mockDefaultBranch, openMergeRequest: false, }, ]); @@ -127,7 +127,7 @@ describe('Pipeline Editor | Commit Form', () => { expect(wrapper.emitted('submit')[0]).toEqual([ { message: anotherMessage, - targetBranch: anotherBranch, + sourceBranch: anotherBranch, openMergeRequest: true, }, ]);