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
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
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 TestCaseListEmptyState from './test_case_list_empty_state.vue';
......@@ -47,7 +46,7 @@ export default {
},
},
apollo: {
testCases: {
project: {
query: projectTestCases,
variables() {
const queryVariables = {
......@@ -78,14 +77,6 @@ export default {
return queryVariables;
},
update(data) {
const testCasesRoot = data.project?.issues;
return {
list: testCasesRoot?.nodes || [],
pageInfo: testCasesRoot?.pageInfo || {},
};
},
error(error) {
createFlash({
message: s__('TestCases|Something went wrong while fetching test cases list.'),
......@@ -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() {
return {
......@@ -128,23 +94,32 @@ export default {
nextPageCursor: this.next,
filterParams: this.initialFilterParams,
sortedBy: this.initialSortBy,
testCases: {
list: [],
pageInfo: {},
},
testCasesCount: {
opened: 0,
closed: 0,
all: 0,
project: {
issueStatusCounts: {},
issues: {},
},
};
},
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() {
return this.$apollo.queries.testCases.loading;
return this.$apollo.queries.project.loading;
},
testCaseListEmpty() {
return !this.$apollo.queries.testCases.loading && !this.testCases.list.length;
return !this.$apollo.queries.project.loading && !this.testCases.list.length;
},
showPaginationControls() {
const { hasPreviousPage, hasNextPage } = this.testCases.pageInfo;
......
......@@ -17,6 +17,16 @@ query projectIssues(
) {
project(fullPath: $projectPath) {
name
issueStatusCounts(
types: $types
authorUsername: $authorUsername
labelName: $labelName
search: $search
) {
opened
closed
all
}
issues(
types: $types
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 ""
msgid "TestCases|Something went wrong while creating a test case."
msgstr ""
msgid "TestCases|Something went wrong while fetching count of test cases."
msgstr ""
msgid "TestCases|Something went wrong while fetching test case."
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