diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-05 12:31:10 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-05 12:31:10 +0200 |
commit | e944fd7064b5a04a334b6c500c9ee7db29a46538 (patch) | |
tree | 7418e54f3774ca676040a16a30a4a9cd7c922100 /spec/features/issues/create_branch_merge_request_spec.rb | |
parent | 3aa92cb5cbe8456c845e16d14489591dd81dbcb3 (diff) | |
parent | 3a2b60f7a0109cdb84e8727a2625318a746e84dc (diff) | |
download | gitlab-ce-e944fd7064b5a04a334b6c500c9ee7db29a46538.tar.gz |
Merge commit '3a2b60f7a' from 'master'fix/gb/hide-environment-external-url-btn-when-not-provided
* commit '3a2b60f7a0109cdb84e8727a2625318a746e84dc': (254 commits)
Fixed Karma spec
Reject EE reserved namespace paths in CE as well
Updated webpack config
Include the bundler:audit job into the static-analysis job
Document serializers
Add artifact file page that uses the blob viewer
Pipeline table mini graph dropdown remains open when table is refreshed
Adds off for event hub
Compile gitlab-shell go executables
Allow to create new branch and empty WIP merge request from issue page
Moved to a view spec
Improving copy of CONTRIBUTING.md, PROCESS.md, and code_review.md
Convert seconds to minutes and hours on chat notifations
Disable navigation to Pages config if Pages is disabled
Sort the network graph both by commit date and topographically.
Add tooltips to note action buttons
Add breadcrumb, build header and pipelines submenu to artifacts browser
Update todos screenshots
removes the possibility of commit messages having carriage returns
Handle incoming emails from aliases correctly
...
Diffstat (limited to 'spec/features/issues/create_branch_merge_request_spec.rb')
-rw-r--r-- | spec/features/issues/create_branch_merge_request_spec.rb | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/spec/features/issues/create_branch_merge_request_spec.rb b/spec/features/issues/create_branch_merge_request_spec.rb new file mode 100644 index 00000000000..44c19275ae5 --- /dev/null +++ b/spec/features/issues/create_branch_merge_request_spec.rb @@ -0,0 +1,91 @@ +require 'rails_helper' + +feature 'Create Branch/Merge Request Dropdown on issue page', feature: true, js: true do + let(:user) { create(:user) } + let!(:project) { create(:project) } + let(:issue) { create(:issue, project: project, title: 'Cherry-Coloured Funk') } + + context 'for team members' do + before do + project.team << [user, :developer] + login_as(user) + end + + it 'allows creating a merge request from the issue page' do + visit namespace_project_issue_path(project.namespace, project, issue) + + select_dropdown_option('create-mr') + + wait_for_ajax + + expect(page).to have_content("created branch 1-cherry-coloured-funk") + expect(page).to have_content("mentioned in merge request !1") + + visit namespace_project_merge_request_path(project.namespace, project, MergeRequest.first) + + expect(page).to have_content('WIP: Resolve "Cherry-Coloured Funk"') + expect(current_path).to eq(namespace_project_merge_request_path(project.namespace, project, MergeRequest.first)) + end + + it 'allows creating a branch from the issue page' do + visit namespace_project_issue_path(project.namespace, project, issue) + + select_dropdown_option('create-branch') + + wait_for_ajax + + expect(page).to have_selector('.dropdown-toggle-text ', text: '1-cherry-coloured-funk') + expect(current_path).to eq namespace_project_tree_path(project.namespace, project, '1-cherry-coloured-funk') + end + + context "when there is a referenced merge request" do + let!(:note) do + create(:note, :on_issue, :system, project: project, noteable: issue, + note: "mentioned in #{referenced_mr.to_reference}") + end + + let(:referenced_mr) do + create(:merge_request, :simple, source_project: project, target_project: project, + description: "Fixes #{issue.to_reference}", author: user) + end + + before do + referenced_mr.cache_merge_request_closes_issues!(user) + + visit namespace_project_issue_path(project.namespace, project, issue) + end + + it 'disables the create branch button' do + expect(page).to have_css('.create-mr-dropdown-wrap .unavailable:not(.hide)') + expect(page).to have_css('.create-mr-dropdown-wrap .available.hide', visible: false) + expect(page).to have_content /1 Related Merge Request/ + end + end + + context 'when issue is confidential' do + it 'disables the create branch button' do + issue = create(:issue, :confidential, project: project) + + visit namespace_project_issue_path(project.namespace, project, issue) + + expect(page).not_to have_css('.create-mr-dropdown-wrap') + end + end + end + + context 'for visitors' do + before do + visit namespace_project_issue_path(project.namespace, project, issue) + end + + it 'shows no buttons' do + expect(page).not_to have_selector('.create-mr-dropdown-wrap') + end + end + + def select_dropdown_option(option) + find('.create-mr-dropdown-wrap .dropdown-toggle').click + find("li[data-value='#{option}']").click + find('.js-create-merge-request').click + end +end |