Commit 6d8a5470 authored by Phil Hughes's avatar Phil Hughes

Merge branch '292721-test-case-author-filtering' into 'master'

Add author token filtering support for Test Cases

See merge request gitlab-org/gitlab!50747
parents ee01c82f 7459b779
<script> <script>
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import Api from '~/api';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import createFlash from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
...@@ -8,6 +9,7 @@ import { urlParamsToObject } from '~/lib/utils/common_utils'; ...@@ -8,6 +9,7 @@ import { urlParamsToObject } from '~/lib/utils/common_utils';
import { updateHistory, setUrlParams } from '~/lib/utils/url_utility'; import { updateHistory, setUrlParams } from '~/lib/utils/url_utility';
import IssuableList from '~/issuable_list/components/issuable_list_root.vue'; import IssuableList from '~/issuable_list/components/issuable_list_root.vue';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
import TestCaseListEmptyState from './test_case_list_empty_state.vue'; import TestCaseListEmptyState from './test_case_list_empty_state.vue';
...@@ -215,6 +217,17 @@ export default { ...@@ -215,6 +217,17 @@ export default {
}, },
getFilteredSearchTokens() { getFilteredSearchTokens() {
return [ return [
{
type: 'author_username',
icon: 'user',
title: __('Author'),
unique: true,
symbol: '@',
token: AuthorToken,
operators: [{ value: '=', description: __('is'), default: 'true' }],
fetchPath: this.projectFullPath,
fetchAuthors: Api.projectUsers.bind(Api),
},
{ {
type: 'label_name', type: 'label_name',
icon: 'labels', icon: 'labels',
......
...@@ -6,6 +6,7 @@ query projectIssues( ...@@ -6,6 +6,7 @@ query projectIssues(
$projectPath: ID! $projectPath: ID!
$types: [IssueType!] $types: [IssueType!]
$state: IssuableState $state: IssuableState
$authorUsername: String = ""
$labelName: [String] $labelName: [String]
$search: String = "" $search: String = ""
$sortBy: IssueSort = created_desc $sortBy: IssueSort = created_desc
...@@ -19,6 +20,7 @@ query projectIssues( ...@@ -19,6 +20,7 @@ query projectIssues(
issues( issues(
types: $types types: $types
state: $state state: $state
authorUsername: $authorUsername
labelName: $labelName labelName: $labelName
search: $search search: $search
sort: $sortBy sort: $sortBy
......
---
title: Add author token filtering support for Test Cases
merge_request: 50747
author:
type: added
...@@ -55,6 +55,16 @@ RSpec.describe 'Test Cases', :js do ...@@ -55,6 +55,16 @@ RSpec.describe 'Test Cases', :js do
end end
end end
it 'shows filter tokens author and label' do
page.within('.vue-filtered-search-bar-container .gl-search-box-by-click') do
page.find('input').click
expect(page.find('.gl-filtered-search-suggestion-list')).to have_selector('li', count: 2)
expect(page.find('.gl-filtered-search-suggestion-list li:nth-child(1)')).to have_content('Author')
expect(page.find('.gl-filtered-search-suggestion-list li:nth-child(2)')).to have_content('Label')
end
end
context 'open tab' do context 'open tab' do
it 'shows list of all open test cases' do it 'shows list of all open test cases' do
page.within('.issuable-list-container .issuable-list') do page.within('.issuable-list-container .issuable-list') do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment