Commit 464a19ab authored by Pedro Moreira da Silva's avatar Pedro Moreira da Silva Committed by pedroms

Fix failing tests

- Change `click_link` to `click_button` to align with element change
- Change `shallowMount` to `mount` to read button disabled state
- Remove QA test for MWPS dropdown option
- Remove spec for MWPS dropdown option
- Prettify Vue file
parent 2901d7c8
<script> <script>
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { GlIcon, GlButton, GlButtonGroup, GlDropdown, GlDropdownItem, GlSprintf, GlLink, GlTooltipDirective } from '@gitlab/ui'; import {
GlIcon,
GlButton,
GlButtonGroup,
GlDropdown,
GlDropdownItem,
GlSprintf,
GlLink,
GlTooltipDirective,
} from '@gitlab/ui';
import readyToMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/ready_to_merge'; import readyToMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/ready_to_merge';
import simplePoll from '~/lib/utils/simple_poll'; import simplePoll from '~/lib/utils/simple_poll';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -305,9 +314,8 @@ export default { ...@@ -305,9 +314,8 @@ export default {
v-gl-tooltip.hover.focus="__('Select merge moment')" v-gl-tooltip.hover.focus="__('Select merge moment')"
:disabled="isMergeButtonDisabled" :disabled="isMergeButtonDisabled"
variant="info" variant="info"
class="js-merge-moment"
data-qa-selector="merge_moment_dropdown" data-qa-selector="merge_moment_dropdown"
toggle-class="btn-icon" toggle-class="btn-icon js-merge-moment"
> >
<template #button-content> <template #button-content>
<gl-icon name="chevron-down" class="mr-0" /> <gl-icon name="chevron-down" class="mr-0" />
...@@ -315,7 +323,7 @@ export default { ...@@ -315,7 +323,7 @@ export default {
</template> </template>
<gl-dropdown-item <gl-dropdown-item
icon-name="warning" icon-name="warning"
class="accept-merge-request js-merge-immediately-button" button-class="accept-merge-request js-merge-immediately-button"
data-qa-selector="merge_immediately_option" data-qa-selector="merge_immediately_option"
@click="handleMergeImmediatelyButtonClick" @click="handleMergeImmediatelyButtonClick"
> >
......
...@@ -41,7 +41,7 @@ RSpec.describe 'Merge requests > User merges immediately', :js do ...@@ -41,7 +41,7 @@ RSpec.describe 'Merge requests > User merges immediately', :js do
def open_warning_dialog def open_warning_dialog
find('.mr-widget-body .dropdown-toggle').click find('.mr-widget-body .dropdown-toggle').click
click_link 'Merge immediately' click_button 'Merge immediately'
expect(page).to have_selector('#merge-immediately-confirmation-dialog') expect(page).to have_selector('#merge-immediately-confirmation-dialog')
end end
......
import { shallowMount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { MERGE_DISABLED_TEXT_UNAPPROVED } from 'ee/vue_merge_request_widget/mixins/ready_to_merge'; import { MERGE_DISABLED_TEXT_UNAPPROVED } from 'ee/vue_merge_request_widget/mixins/ready_to_merge';
import MergeImmediatelyConfirmationDialog from 'ee/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue'; import MergeImmediatelyConfirmationDialog from 'ee/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue';
import MergeTrainHelperText from 'ee/vue_merge_request_widget/components/merge_train_helper_text.vue'; import MergeTrainHelperText from 'ee/vue_merge_request_widget/components/merge_train_helper_text.vue';
...@@ -58,7 +58,7 @@ describe('ReadyToMerge', () => { ...@@ -58,7 +58,7 @@ describe('ReadyToMerge', () => {
}; };
const factory = (mrUpdates = {}) => { const factory = (mrUpdates = {}) => {
wrapper = shallowMount(ReadyToMerge, { wrapper = mount(ReadyToMerge, {
propsData: { propsData: {
mr: { ...mr, ...mrUpdates }, mr: { ...mr, ...mrUpdates },
service, service,
...@@ -385,7 +385,7 @@ describe('ReadyToMerge', () => { ...@@ -385,7 +385,7 @@ describe('ReadyToMerge', () => {
const button = findMergeButton(); const button = findMergeButton();
expect(button.exists()).toBe(true); expect(button.exists()).toBe(true);
expect(button.attributes('disabled')).toBe('true'); expect(button.attributes('disabled')).toBe('disabled');
}); });
}); });
}); });
......
...@@ -23,7 +23,6 @@ module QA ...@@ -23,7 +23,6 @@ module QA
element :merge_button element :merge_button
element :fast_forward_message, 'Fast-forward merge without a merge commit' # rubocop:disable QA/ElementWithPattern element :fast_forward_message, 'Fast-forward merge without a merge commit' # rubocop:disable QA/ElementWithPattern
element :merge_moment_dropdown element :merge_moment_dropdown
element :merge_when_pipeline_succeeds_option
element :merge_immediately_option element :merge_immediately_option
end end
......
...@@ -34,7 +34,7 @@ RSpec.describe 'Merge requests > User merges immediately', :js do ...@@ -34,7 +34,7 @@ RSpec.describe 'Merge requests > User merges immediately', :js do
find('.dropdown-toggle').click find('.dropdown-toggle').click
Sidekiq::Testing.fake! do Sidekiq::Testing.fake! do
click_link 'Merge immediately' click_button 'Merge immediately'
expect(find('.accept-merge-request.btn-info')).to have_content('Merge in progress') expect(find('.accept-merge-request.btn-info')).to have_content('Merge in progress')
......
...@@ -93,19 +93,6 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do ...@@ -93,19 +93,6 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do
it_behaves_like 'Merge when pipeline succeeds activator' it_behaves_like 'Merge when pipeline succeeds activator'
end end
end end
describe 'enabling Merge when pipeline succeeds via dropdown' do
it 'activates the Merge when pipeline succeeds feature' do
wait_for_requests
find('.js-merge-moment').click
click_link 'Merge when pipeline succeeds'
expect(page).to have_content "Set by #{user.name} to be merged automatically when the pipeline succeeds"
expect(page).to have_content "The source branch will not be deleted"
expect(page).to have_link "Cancel automatic merge"
end
end
end end
context 'when merge when pipeline succeeds is enabled' do context 'when merge when pipeline succeeds is enabled' 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