diff options
Diffstat (limited to 'spec')
6 files changed, 78 insertions, 8 deletions
diff --git a/spec/features/boards/board_filters_spec.rb b/spec/features/boards/board_filters_spec.rb new file mode 100644 index 00000000000..5eb8f43df07 --- /dev/null +++ b/spec/features/boards/board_filters_spec.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Issue board filters', :js do + let_it_be(:project) { create(:project, :repository) } + let_it_be(:user) { create(:user) } + let_it_be(:board) { create(:board, project: project) } + let_it_be(:milestone_1) { create(:milestone, project: project) } + let_it_be(:milestone_2) { create(:milestone, project: project) } + let_it_be(:release) { create(:release, tag: 'v1.0', project: project, milestones: [milestone_1]) } + let_it_be(:release_2) { create(:release, tag: 'v2.0', project: project, milestones: [milestone_2]) } + let_it_be(:issue) { create(:issue, project: project, milestone: milestone_1) } + let_it_be(:issue_2) { create(:issue, project: project, milestone: milestone_2) } + + let(:filtered_search) { find('[data-testid="issue-board-filtered-search"]') } + let(:filter_input) { find('.gl-filtered-search-term-input')} + let(:filter_dropdown) { find('.gl-filtered-search-suggestion-list') } + let(:filter_first_suggestion) { find('.gl-filtered-search-suggestion-list').first('.gl-filtered-search-suggestion') } + let(:filter_submit) { find('.gl-search-box-by-click-search-button') } + + before do + stub_feature_flags(issue_boards_filtered_search: true) + + project.add_maintainer(user) + sign_in(user) + + visit_project_board + end + + describe 'filters by releases' do + before do + filter_input.click + filter_input.set('release:') + filter_first_suggestion.click # Select `=` operator + end + + it 'loads all the releases when opened and submit one as filter', :aggregate_failures do + expect(find('.board:nth-child(1)')).to have_selector('.board-card', count: 2) + + expect_filtered_search_dropdown_results(filter_dropdown, 2) + + click_on release.tag + filter_submit.click + + expect(find('.board:nth-child(1)')).to have_selector('.board-card', count: 1) + end + end + + def expect_filtered_search_dropdown_results(filter_dropdown, count) + expect(filter_dropdown).to have_selector('.gl-new-dropdown-item', count: count) + end + + def visit_project_board + visit project_board_path(project, board) + wait_for_requests + end +end diff --git a/spec/frontend/boards/components/board_filtered_search_spec.js b/spec/frontend/boards/components/board_filtered_search_spec.js index 356cc22a2db..65a3ed2f788 100644 --- a/spec/frontend/boards/components/board_filtered_search_spec.js +++ b/spec/frontend/boards/components/board_filtered_search_spec.js @@ -124,6 +124,7 @@ describe('BoardFilteredSearch', () => { { type: 'types', value: { data: 'INCIDENT', operator: '=' } }, { type: 'weight', value: { data: '2', operator: '=' } }, { type: 'iteration', value: { data: '3341', operator: '=' } }, + { type: 'release', value: { data: 'v1.0.0', operator: '=' } }, ]; jest.spyOn(urlUtility, 'updateHistory'); findFilteredSearch().vm.$emit('onFilter', mockFilters); @@ -132,7 +133,7 @@ describe('BoardFilteredSearch', () => { title: '', replace: true, url: - 'http://test.host/?author_username=root&label_name[]=label&label_name[]=label2&milestone_title=New+Milestone&iteration_id=3341&types=INCIDENT&weight=2', + 'http://test.host/?author_username=root&label_name[]=label&label_name[]=label2&milestone_title=New+Milestone&iteration_id=3341&types=INCIDENT&weight=2&release_tag=v1.0.0', }); }); }); diff --git a/spec/frontend/boards/components/issue_board_filtered_search_spec.js b/spec/frontend/boards/components/issue_board_filtered_search_spec.js index 45c5c87d800..af2ad90396f 100644 --- a/spec/frontend/boards/components/issue_board_filtered_search_spec.js +++ b/spec/frontend/boards/components/issue_board_filtered_search_spec.js @@ -16,6 +16,7 @@ describe('IssueBoardFilter', () => { propsData: { fullPath: 'gitlab-org', boardType: 'group' }, provide: { isSignedIn, + releasesFetchPath: '/releases', }, }); }; diff --git a/spec/frontend/boards/mock_data.js b/spec/frontend/boards/mock_data.js index 25764269677..035f0ac2915 100644 --- a/spec/frontend/boards/mock_data.js +++ b/spec/frontend/boards/mock_data.js @@ -7,6 +7,7 @@ import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/auth import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue'; +import ReleaseToken from '~/vue_shared/components/filtered_search_bar/tokens/release_token.vue'; export const boardObj = { id: 1, @@ -615,6 +616,13 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, hasEmoji) { icon: 'issue-type-incident', value: 'INCIDENT', title: 'Incident' }, ], }, + { + type: 'release', + title: __('Release'), + icon: 'rocket', + token: ReleaseToken, + fetchReleases: expect.any(Function), + }, ]; export const mockLabel1 = { diff --git a/spec/frontend/sidebar/components/sidebar_dropdown_widget_spec.js b/spec/frontend/sidebar/components/sidebar_dropdown_widget_spec.js index ca6e5ac5e7f..c9c121d12a6 100644 --- a/spec/frontend/sidebar/components/sidebar_dropdown_widget_spec.js +++ b/spec/frontend/sidebar/components/sidebar_dropdown_widget_spec.js @@ -369,16 +369,18 @@ describe('SidebarDropdownWidget', () => { describe('when a user is searching', () => { describe('when search result is not found', () => { - it('renders "No milestone found"', async () => { - createComponent(); + describe('when milestone', () => { + it('renders "No milestone found"', async () => { + createComponent(); - await toggleDropdown(); + await toggleDropdown(); - findSearchBox().vm.$emit('input', 'non existing milestones'); + findSearchBox().vm.$emit('input', 'non existing milestones'); - await wrapper.vm.$nextTick(); + await wrapper.vm.$nextTick(); - expect(findDropdownText().text()).toBe('No milestone found'); + expect(findDropdownText().text()).toBe('No milestone found'); + }); }); }); }); diff --git a/spec/views/layouts/_head.html.haml_spec.rb b/spec/views/layouts/_head.html.haml_spec.rb index 2c7289deaef..f9725c73d05 100644 --- a/spec/views/layouts/_head.html.haml_spec.rb +++ b/spec/views/layouts/_head.html.haml_spec.rb @@ -62,7 +62,7 @@ RSpec.describe 'layouts/_head' do expect(rendered).to match('<link rel="stylesheet" media="print" href="/stylesheets/highlight/themes/solarised-light.css" />') end - context 'when an asset_host is set and snowplow url is set' do + context 'when an asset_host is set and snowplow url is set', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/346542' do let(:asset_host) { 'http://test.host' } let(:snowplow_collector_hostname) { 'www.snow.plow' } |