diff options
Diffstat (limited to 'spec/features/merge_request')
12 files changed, 77 insertions, 34 deletions
diff --git a/spec/features/merge_request/user_comments_on_diff_spec.rb b/spec/features/merge_request/user_comments_on_diff_spec.rb index ad1ad067935..c452408cff2 100644 --- a/spec/features/merge_request/user_comments_on_diff_spec.rb +++ b/spec/features/merge_request/user_comments_on_diff_spec.rb @@ -136,12 +136,6 @@ RSpec.describe 'User comments on a diff', :js do add_comment('-13', '+15') end - it 'allows comments to start above hidden lines and end below' do - # click +28, select 21 add and verify comment - click_diff_line(find('div[data-path="files/ruby/popen.rb"] .new_line a[data-linenumber="28"]').find(:xpath, '../..'), 'right') - add_comment('21', '+28') - end - it 'allows comments on previously hidden lines at the top of a file' do # Click -9, expand up, select 1 add and verify comment page.within('[data-path="files/ruby/popen.rb"]') do diff --git a/spec/features/merge_request/user_comments_on_merge_request_spec.rb b/spec/features/merge_request/user_comments_on_merge_request_spec.rb index 73f2b1a25ce..43096f8e7f9 100644 --- a/spec/features/merge_request/user_comments_on_merge_request_spec.rb +++ b/spec/features/merge_request/user_comments_on_merge_request_spec.rb @@ -30,6 +30,27 @@ RSpec.describe 'User comments on a merge request', :js do end end + it 'replys to a new comment' do + page.within('.js-main-target-form') do + fill_in('note[note]', with: 'comment 1') + click_button('Comment') + end + + wait_for_requests + + page.within('.note') do + click_button('Reply to comment') + + fill_in('note[note]', with: 'comment 2') + click_button('Add comment now') + end + + wait_for_requests + + # Test that the discussion doesn't get auto-resolved + expect(page).to have_button('Resolve thread') + end + it 'loads new comment' do # Add new comment in background in order to check # if it's going to be loaded automatically for current user. diff --git a/spec/features/merge_request/user_expands_diff_spec.rb b/spec/features/merge_request/user_expands_diff_spec.rb index 0cdc87de761..09c5897f102 100644 --- a/spec/features/merge_request/user_expands_diff_spec.rb +++ b/spec/features/merge_request/user_expands_diff_spec.rb @@ -8,6 +8,8 @@ RSpec.describe 'User expands diff', :js do before do stub_feature_flags(increased_diff_limits: false) + allow(Gitlab::CurrentSettings).to receive(:diff_max_patch_bytes).and_return(100.kilobytes) + visit(diffs_project_merge_request_path(project, merge_request)) wait_for_requests @@ -15,11 +17,11 @@ RSpec.describe 'User expands diff', :js do it 'allows user to expand diff' do page.within find('[id="19763941ab80e8c09871c0a425f0560d9053bcb3"]') do - click_link 'Click to expand it.' + find('[data-testid="expand-button"]').click wait_for_requests - expect(page).not_to have_content('Click to expand it.') + expect(page).not_to have_content('Expand file') expect(page).to have_selector('.code') end end diff --git a/spec/features/merge_request/user_merges_immediately_spec.rb b/spec/features/merge_request/user_merges_immediately_spec.rb index 0fb081ec507..64a357de1f7 100644 --- a/spec/features/merge_request/user_merges_immediately_spec.rb +++ b/spec/features/merge_request/user_merges_immediately_spec.rb @@ -34,7 +34,7 @@ RSpec.describe 'Merge requests > User merges immediately', :js do find('.dropdown-toggle').click 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') diff --git a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb index 444d5371e7a..5e99383e4a1 100644 --- a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb +++ b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb @@ -93,19 +93,6 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do it_behaves_like 'Merge when pipeline succeeds activator' 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 context 'when merge when pipeline succeeds is enabled' do diff --git a/spec/features/merge_request/user_resolves_conflicts_spec.rb b/spec/features/merge_request/user_resolves_conflicts_spec.rb index f96408fb10b..06405232462 100644 --- a/spec/features/merge_request/user_resolves_conflicts_spec.rb +++ b/spec/features/merge_request/user_resolves_conflicts_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Merge request > User resolves conflicts', :js do + include Spec::Support::Helpers::Features::EditorLiteSpecHelpers + let(:project) { create(:project, :repository) } let(:user) { project.creator } @@ -64,15 +66,13 @@ RSpec.describe 'Merge request > User resolves conflicts', :js do within find('.files-wrapper .diff-file', text: 'files/ruby/popen.rb') do click_button 'Edit inline' wait_for_requests - find('.files-wrapper .diff-file pre') - execute_script('ace.edit($(".files-wrapper .diff-file pre")[0]).setValue("One morning");') + editor_set_value("One morning") end within find('.files-wrapper .diff-file', text: 'files/ruby/regex.rb') do click_button 'Edit inline' wait_for_requests - find('.files-wrapper .diff-file pre') - execute_script('ace.edit($(".files-wrapper .diff-file pre")[1]).setValue("Gregor Samsa woke from troubled dreams");') + editor_set_value("Gregor Samsa woke from troubled dreams") end find_button('Commit to source branch').send_keys(:return) diff --git a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb index cd06886169d..00f0c88497b 100644 --- a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb +++ b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb @@ -15,6 +15,10 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do diff_refs: merge_request.diff_refs) end + before do + stub_feature_flags(remove_resolve_note: false) + end + context 'no threads' do before do project.add_maintainer(user) diff --git a/spec/features/merge_request/user_resolves_wip_mr_spec.rb b/spec/features/merge_request/user_resolves_wip_mr_spec.rb index b67167252e1..93b14279a06 100644 --- a/spec/features/merge_request/user_resolves_wip_mr_spec.rb +++ b/spec/features/merge_request/user_resolves_wip_mr_spec.rb @@ -33,7 +33,7 @@ RSpec.describe 'Merge request > User resolves Work in Progress', :js do it 'retains merge request data after clicking Resolve WIP status' do expect(page.find('.ci-widget-content')).to have_content("Pipeline ##{pipeline.id}") - expect(page).to have_content "This merge request is still a work in progress." + expect(page).to have_content "This merge request is still a draft." page.within('.mr-state-widget') do click_button('Mark as ready') @@ -45,7 +45,7 @@ RSpec.describe 'Merge request > User resolves Work in Progress', :js do # merge request widget refreshes, which masks missing elements # that should already be present. expect(page.find('.ci-widget-content', wait: 0)).to have_content("Pipeline ##{pipeline.id}") - expect(page).not_to have_content('This merge request is still a work in progress.') + expect(page).not_to have_content('This merge request is still a draft.') end end end diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index 93fea44707c..0e8012f161f 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -558,8 +558,9 @@ RSpec.describe 'Merge request > User sees merge widget', :js do end before do - allow_any_instance_of(TestSuiteComparerEntity) - .to receive(:max_tests).and_return(2) + stub_const("Gitlab::Ci::Reports::TestSuiteComparer::DEFAULT_MAX_TESTS", 2) + stub_const("Gitlab::Ci::Reports::TestSuiteComparer::DEFAULT_MIN_TESTS", 1) + allow_any_instance_of(MergeRequest) .to receive(:has_test_reports?).and_return(true) allow_any_instance_of(MergeRequest) diff --git a/spec/features/merge_request/user_sees_suggest_pipeline_spec.rb b/spec/features/merge_request/user_sees_suggest_pipeline_spec.rb index 93807512d9c..4bb6c3265a4 100644 --- a/spec/features/merge_request/user_sees_suggest_pipeline_spec.rb +++ b/spec/features/merge_request/user_sees_suggest_pipeline_spec.rb @@ -9,8 +9,6 @@ RSpec.describe 'Merge request > User sees suggest pipeline', :js do before do stub_application_setting(auto_devops_enabled: false) - stub_experiment(suggest_pipeline: true) - stub_experiment_for_user(suggest_pipeline: true) project.add_maintainer(user) sign_in(user) visit project_merge_request_path(project, merge_request) @@ -32,4 +30,40 @@ RSpec.describe 'Merge request > User sees suggest pipeline', :js do expect(page).not_to have_content('Are you adding technical debt or code vulnerabilities?') end + + it 'runs tour from start to finish ensuring all nudges are executed' do + # nudge 1 + expect(page).to have_content('Are you adding technical debt or code vulnerabilities?') + + page.within '.mr-pipeline-suggest' do + find('[data-testid="ok"]').click + end + + wait_for_requests + + # nudge 2 + expect(page).to have_content('Choose Code Quality to add a pipeline that tests the quality of your code.') + + find('.js-gitlab-ci-yml-selector').click + + wait_for_requests + + within '.gitlab-ci-yml-selector' do + find('.dropdown-input-field').set('Jekyll') + find('.dropdown-content li', text: 'Jekyll').click + end + + wait_for_requests + + expect(page).not_to have_content('Choose Code Quality to add a pipeline that tests the quality of your code.') + # nudge 3 + expect(page).to have_content('The template is ready!') + + find('#commit-changes').click + + wait_for_requests + + # nudge 4 + expect(page).to have_content("That's it, well done!") + end end diff --git a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb index 9268190c7e0..1e1888cd826 100644 --- a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb +++ b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb @@ -304,7 +304,7 @@ RSpec.describe 'User comments on a diff', :js do wait_for_requests end - it 'suggestion is presented' do + it 'suggestion is presented', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/268240' do page.within('.diff-discussions') do expect(page).to have_button('Apply suggestion') expect(page).to have_content('Suggested change') diff --git a/spec/features/merge_request/user_views_diffs_spec.rb b/spec/features/merge_request/user_views_diffs_spec.rb index 928755bf5de..e1865fe2e14 100644 --- a/spec/features/merge_request/user_views_diffs_spec.rb +++ b/spec/features/merge_request/user_views_diffs_spec.rb @@ -61,7 +61,7 @@ RSpec.describe 'User views diffs', :js do end it 'expands all diffs' do - first('.js-file-title').click + first('.diff-toggle-caret').click expect(page).to have_button('Expand all') |