debian-mirror-gitlab/spec/features/groups/merge_requests_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

104 lines
3.5 KiB
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
2016-11-24 13:41:30 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Group merge requests page' do
2018-03-17 18:26:18 +05:30
include FilteredSearchHelpers
2016-11-24 13:41:30 +05:30
let(:path) { merge_requests_group_path(group) }
2017-08-17 22:00:37 +05:30
let(:issuable) { create(:merge_request, source_project: project, target_project: project, title: 'this is my created issuable') }
2018-05-09 12:01:36 +05:30
let(:access_level) { ProjectFeature::ENABLED }
let(:user) { user_in_group }
2016-11-24 13:41:30 +05:30
include_examples 'project features apply to issuables', MergeRequest
2017-08-17 22:00:37 +05:30
context 'archived issuable' do
2017-09-10 17:25:29 +05:30
let(:project_archived) { create(:project, :archived, :merge_requests_enabled, :repository, group: group) }
2017-08-17 22:00:37 +05:30
let(:issuable_archived) { create(:merge_request, source_project: project_archived, target_project: project_archived, title: 'issuable of an archived project') }
before do
issuable_archived
visit path
end
it 'hides archived merge requests' do
expect(page).to have_content(issuable.title)
expect(page).not_to have_content(issuable_archived.title)
end
it 'ignores archived merge request count badges in navbar' do
2021-04-29 21:17:54 +05:30
expect(first(:link, text: 'Merge requests').find('.badge').text).to eq("1")
2017-08-17 22:00:37 +05:30
end
it 'ignores archived merge request count badges in state-filters' do
expect(page.find('#state-opened span.badge').text).to eq("1")
expect(page.find('#state-merged span.badge').text).to eq("0")
expect(page.find('#state-closed span.badge').text).to eq("0")
expect(page.find('#state-all span.badge').text).to eq("1")
end
end
2018-03-17 18:26:18 +05:30
2018-05-09 12:01:36 +05:30
context 'when merge request assignee to user' do
before do
2019-07-31 22:56:46 +05:30
issuable.update!(assignees: [user])
2018-05-09 12:01:36 +05:30
visit path
end
it { expect(page).to have_content issuable.title[0..80] }
end
2018-03-17 18:26:18 +05:30
context 'group filtered search', :js do
let(:user2) { user_outside_group }
it 'filters by assignee only group users' do
2020-04-08 14:13:33 +05:30
filtered_search.set('assignee:=')
2018-03-17 18:26:18 +05:30
expect(find('#js-dropdown-assignee .filter-dropdown')).to have_content(user.name)
expect(find('#js-dropdown-assignee .filter-dropdown')).not_to have_content(user2.name)
end
end
2018-11-08 19:23:39 +05:30
describe 'new merge request dropdown' do
let(:project_with_merge_requests_disabled) { create(:project, :merge_requests_disabled, group: group) }
before do
visit path
end
it 'shows projects only with merge requests feature enabled', :js do
2022-03-02 08:16:31 +05:30
find('.js-new-project-item-link').click
2018-11-08 19:23:39 +05:30
page.within('.select2-results') do
expect(page).to have_content(project.name_with_namespace)
expect(page).not_to have_content(project_with_merge_requests_disabled.name_with_namespace)
end
end
end
2021-09-30 23:02:18 +05:30
context 'empty state with no merge requests' do
before do
MergeRequest.delete_all
end
it 'shows an empty state, button to create merge request and no filters bar', :aggregate_failures, :js do
visit path
expect(page).to have_selector('.empty-state')
expect(page).to have_link('Select project to create merge request')
expect(page).not_to have_selector('.issues-filters')
end
context 'with no open merge requests' do
it 'shows an empty state, button to create merge request and filters bar', :aggregate_failures, :js do
create(:merge_request, :closed, source_project: project, target_project: project)
visit path
expect(page).to have_selector('.empty-state')
expect(page).to have_link('Select project to create merge request')
expect(page).to have_selector('.issues-filters')
end
end
end
2016-11-24 13:41:30 +05:30
end