Commit a230569e authored by Natalia Tepluhina's avatar Natalia Tepluhina Committed by Vitaly Slobodin

Fixed test cases count

Applied a fix to test cases count
Fixed a query shape

Fixed a loading state test

Made test passing

Removed unnnecessary $apollo properties

Added changelog entry
parent a0d465de
...@@ -13,7 +13,6 @@ import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/auth ...@@ -13,7 +13,6 @@ import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/auth
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 projectTestCases from '../queries/project_test_cases.query.graphql'; import projectTestCases from '../queries/project_test_cases.query.graphql';
import projectTestCasesCount from '../queries/project_test_cases_count.query.graphql';
import { TestCaseTabs, AvailableSortOptions, DEFAULT_PAGE_SIZE } from '../constants'; import { TestCaseTabs, AvailableSortOptions, DEFAULT_PAGE_SIZE } from '../constants';
import TestCaseListEmptyState from './test_case_list_empty_state.vue'; import TestCaseListEmptyState from './test_case_list_empty_state.vue';
...@@ -47,7 +46,7 @@ export default { ...@@ -47,7 +46,7 @@ export default {
}, },
}, },
apollo: { apollo: {
testCases: { project: {
query: projectTestCases, query: projectTestCases,
variables() { variables() {
const queryVariables = { const queryVariables = {
...@@ -78,14 +77,6 @@ export default { ...@@ -78,14 +77,6 @@ export default {
return queryVariables; return queryVariables;
}, },
update(data) {
const testCasesRoot = data.project?.issues;
return {
list: testCasesRoot?.nodes || [],
pageInfo: testCasesRoot?.pageInfo || {},
};
},
error(error) { error(error) {
createFlash({ createFlash({
message: s__('TestCases|Something went wrong while fetching test cases list.'), message: s__('TestCases|Something went wrong while fetching test cases list.'),
...@@ -94,31 +85,6 @@ export default { ...@@ -94,31 +85,6 @@ export default {
}); });
}, },
}, },
testCasesCount: {
query: projectTestCasesCount,
variables() {
return {
projectPath: this.projectFullPath,
types: ['TEST_CASE'],
};
},
update(data) {
const { opened, closed, all } = data.project?.issueStatusCounts;
return {
opened,
closed,
all,
};
},
error(error) {
createFlash({
message: s__('TestCases|Something went wrong while fetching count of test cases.'),
captureError: true,
error,
});
},
},
}, },
data() { data() {
return { return {
...@@ -128,23 +94,32 @@ export default { ...@@ -128,23 +94,32 @@ export default {
nextPageCursor: this.next, nextPageCursor: this.next,
filterParams: this.initialFilterParams, filterParams: this.initialFilterParams,
sortedBy: this.initialSortBy, sortedBy: this.initialSortBy,
testCases: { project: {
list: [], issueStatusCounts: {},
pageInfo: {}, issues: {},
},
testCasesCount: {
opened: 0,
closed: 0,
all: 0,
}, },
}; };
}, },
computed: { computed: {
testCases() {
return {
list: this.project?.issues?.nodes || [],
pageInfo: this.project?.issues?.pageInfo || {},
};
},
testCasesCount() {
const { opened = 0, closed = 0, all = 0 } = this.project?.issueStatusCounts || {};
return {
opened,
closed,
all,
};
},
testCaseListLoading() { testCaseListLoading() {
return this.$apollo.queries.testCases.loading; return this.$apollo.queries.project.loading;
}, },
testCaseListEmpty() { testCaseListEmpty() {
return !this.$apollo.queries.testCases.loading && !this.testCases.list.length; return !this.$apollo.queries.project.loading && !this.testCases.list.length;
}, },
showPaginationControls() { showPaginationControls() {
const { hasPreviousPage, hasNextPage } = this.testCases.pageInfo; const { hasPreviousPage, hasNextPage } = this.testCases.pageInfo;
......
...@@ -17,6 +17,16 @@ query projectIssues( ...@@ -17,6 +17,16 @@ query projectIssues(
) { ) {
project(fullPath: $projectPath) { project(fullPath: $projectPath) {
name name
issueStatusCounts(
types: $types
authorUsername: $authorUsername
labelName: $labelName
search: $search
) {
opened
closed
all
}
issues( issues(
types: $types types: $types
state: $state state: $state
......
query projectIssueCounts($projectPath: ID!, $types: [IssueType!]) {
project(fullPath: $projectPath) {
issueStatusCounts(types: $types) {
opened
closed
all
}
}
}
---
title: Resolve Filter count does not get reflected in Test Cases
merge_request: 52889
author:
type: fixed
...@@ -28475,9 +28475,6 @@ msgstr "" ...@@ -28475,9 +28475,6 @@ msgstr ""
msgid "TestCases|Something went wrong while creating a test case." msgid "TestCases|Something went wrong while creating a test case."
msgstr "" msgstr ""
msgid "TestCases|Something went wrong while fetching count of test cases."
msgstr ""
msgid "TestCases|Something went wrong while fetching test case." msgid "TestCases|Something went wrong while fetching test case."
msgstr "" msgstr ""
......
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