Commit 7459b779 authored by Kushal Pandya's avatar Kushal Pandya

Add author token filtering support

Add ability to filter test cases with author
username.
parent 8467c199
<script>
import { GlButton } from '@gitlab/ui';
import Api from '~/api';
import { s__, __ } from '~/locale';
import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
......@@ -8,6 +9,7 @@ import { urlParamsToObject } from '~/lib/utils/common_utils';
import { updateHistory, setUrlParams } from '~/lib/utils/url_utility';
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 TestCaseListEmptyState from './test_case_list_empty_state.vue';
......@@ -215,6 +217,17 @@ export default {
},
getFilteredSearchTokens() {
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',
icon: 'labels',
......
......@@ -6,6 +6,7 @@ query projectIssues(
$projectPath: ID!
$types: [IssueType!]
$state: IssuableState
$authorUsername: String = ""
$labelName: [String]
$search: String = ""
$sortBy: IssueSort = created_desc
......@@ -19,6 +20,7 @@ query projectIssues(
issues(
types: $types
state: $state
authorUsername: $authorUsername
labelName: $labelName
search: $search
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
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
it 'shows list of all open test cases' 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