2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-28 08:06:18 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'a maintainer edits files on a source-branch of an MR from a fork', :js, :sidekiq_might_not_need_inline do
|
2018-02-28 08:06:18 +00:00
|
|
|
include ProjectForksHelper
|
2018-03-06 22:30:47 +00:00
|
|
|
let(:user) { create(:user, username: 'the-maintainer') }
|
2018-02-28 08:06:18 +00:00
|
|
|
let(:target_project) { create(:project, :public, :repository) }
|
|
|
|
let(:author) { create(:user, username: 'mr-authoring-machine') }
|
|
|
|
let(:source_project) { fork_project(target_project, author, repository: true) }
|
|
|
|
|
|
|
|
let(:merge_request) do
|
|
|
|
create(:merge_request,
|
|
|
|
source_project: source_project,
|
|
|
|
target_project: target_project,
|
|
|
|
source_branch: 'fix',
|
|
|
|
target_branch: 'master',
|
|
|
|
author: author,
|
2018-05-23 01:54:57 +00:00
|
|
|
allow_collaboration: true)
|
2018-02-28 08:06:18 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
2018-07-11 14:36:08 +00:00
|
|
|
target_project.add_maintainer(user)
|
2018-02-28 08:06:18 +00:00
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit project_merge_request_path(target_project, merge_request)
|
|
|
|
click_link 'Changes'
|
|
|
|
wait_for_requests
|
2020-09-24 12:09:37 +00:00
|
|
|
|
|
|
|
page.within(first('.js-file-title')) do
|
|
|
|
find('.js-diff-more-actions').click
|
|
|
|
find('.js-edit-blob').click
|
2020-09-18 21:10:11 +00:00
|
|
|
end
|
2020-09-24 12:09:37 +00:00
|
|
|
|
2018-02-28 08:06:18 +00:00
|
|
|
wait_for_requests
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'mentions commits will go to the source branch' do
|
|
|
|
expect(page).to have_content('Your changes can be committed to fix because a merge request is open.')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'allows committing to the source branch' do
|
2020-06-19 12:09:07 +00:00
|
|
|
execute_script("monaco.editor.getModels()[0].setValue('Updated the readme')")
|
2018-02-28 08:06:18 +00:00
|
|
|
|
|
|
|
click_button 'Commit changes'
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect(page).to have_content('Your changes have been successfully committed')
|
|
|
|
expect(page).to have_content('Updated the readme')
|
|
|
|
end
|
|
|
|
end
|