diff --git a/x-pack/test/case_api_integration/basic/tests/cases/comments/delete_comment.ts b/x-pack/test/case_api_integration/basic/tests/cases/comments/delete_comment.ts index 2d78a6ab9eeb1..f5a0415540d17 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/comments/delete_comment.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/comments/delete_comment.ts @@ -14,7 +14,7 @@ import { deleteCases, deleteCasesUserActions, deleteComments } from '../../../.. // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('delete_comment', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/comments/find_comments.ts b/x-pack/test/case_api_integration/basic/tests/cases/comments/find_comments.ts index d783537fa68b7..e9cc01542b376 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/comments/find_comments.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/comments/find_comments.ts @@ -14,16 +14,16 @@ import { deleteCases, deleteCasesUserActions, deleteComments } from '../../../.. // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('find_comments', () => { afterEach(async () => { await deleteCases(es); - await deleteComments(es); - await deleteCasesUserActions(es); + // await deleteComments(es); + // await deleteCasesUserActions(es); }); - it('should get all case comment', async () => { + it('should find all case comment', async () => { const { body: postedCase } = await supertest .post(CASES_URL) .set('kbn-xsrf', 'true') @@ -47,5 +47,30 @@ export default ({ getService }: FtrProviderContext): void => { expect(caseComments.comments).to.eql(patchedCase.comments); }); + + // it('should filter case comments', async () => { + // const { body: postedCase } = await supertest + // .post(CASES_URL) + // .set('kbn-xsrf', 'true') + // .send(postCaseReq) + // .expect(200); + // // post 2 comments + // await supertest + // .post(`${CASES_URL}/${postedCase.id}/comments`) + // .set('kbn-xsrf', 'true') + // .send(postCommentReq); + // + // const { body: patchedCase } = await supertest + // .post(`${CASES_URL}/${postedCase.id}/comments`) + // .set('kbn-xsrf', 'true') + // .send({ comment: 'unique' }); + // + // const { body: caseComments } = await supertest + // .get(`${CASES_URL}/${postedCase.id}/comments/_find?search=unique`) + // .set('kbn-xsrf', 'true') + // .send(); + // + // expect(caseComments.comments).to.eql(patchedCase.comments); + // }); }); }; diff --git a/x-pack/test/case_api_integration/basic/tests/cases/comments/get_comment.ts b/x-pack/test/case_api_integration/basic/tests/cases/comments/get_comment.ts index fa11abf93bb04..7dd938406f9ff 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/comments/get_comment.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/comments/get_comment.ts @@ -14,7 +14,7 @@ import { deleteCases, deleteCasesUserActions, deleteComments } from '../../../.. // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('get_comment', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/comments/patch_comment.ts b/x-pack/test/case_api_integration/basic/tests/cases/comments/patch_comment.ts index e7cf744f88f4b..63a2c78d7ac8d 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/comments/patch_comment.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/comments/patch_comment.ts @@ -14,7 +14,7 @@ import { deleteCases, deleteCasesUserActions, deleteComments } from '../../../.. // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('patch_comment', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/comments/post_comment.ts b/x-pack/test/case_api_integration/basic/tests/cases/comments/post_comment.ts index 47e37958ea13d..6acb71f8dd86e 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/comments/post_comment.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/comments/post_comment.ts @@ -14,7 +14,7 @@ import { deleteCases, deleteCasesUserActions, deleteComments } from '../../../.. // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('post_comment', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/delete_cases.ts b/x-pack/test/case_api_integration/basic/tests/cases/delete_cases.ts index fdfbf3f76eb98..6720b05265147 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/delete_cases.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/delete_cases.ts @@ -14,7 +14,7 @@ import { deleteCases } from '../../../common/lib/utils'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('delete_cases', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/find_cases.ts b/x-pack/test/case_api_integration/basic/tests/cases/find_cases.ts index a652afd3804a8..bc936550f8425 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/find_cases.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/find_cases.ts @@ -14,7 +14,7 @@ import { deleteCases, deleteComments, deleteCasesUserActions } from '../../../co // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('find_cases', () => { afterEach(async () => { await deleteCases(es); diff --git a/x-pack/test/case_api_integration/basic/tests/cases/get_case.ts b/x-pack/test/case_api_integration/basic/tests/cases/get_case.ts index 079f6da3296c7..c56fcb00c1fe6 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/get_case.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/get_case.ts @@ -18,7 +18,7 @@ import { deleteCases } from '../../../common/lib/utils'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('get_case', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/patch_cases.ts b/x-pack/test/case_api_integration/basic/tests/cases/patch_cases.ts index 51bea260fd111..83cb425b169fd 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/patch_cases.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/patch_cases.ts @@ -19,7 +19,7 @@ import { deleteCases, deleteCasesUserActions } from '../../../common/lib/utils'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('patch_cases', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/post_case.ts b/x-pack/test/case_api_integration/basic/tests/cases/post_case.ts index acb6ec80c6036..356e5066865b3 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/post_case.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/post_case.ts @@ -18,7 +18,7 @@ import { deleteCases } from '../../../common/lib/utils'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('post_case', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/push_case.ts b/x-pack/test/case_api_integration/basic/tests/cases/push_case.ts index e6cddfa59ae17..61e478bda4c5a 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/push_case.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/push_case.ts @@ -19,7 +19,7 @@ import { // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('push_case', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/reporters/get_reporters.ts b/x-pack/test/case_api_integration/basic/tests/cases/reporters/get_reporters.ts index 78ba4e22d482d..a781b928b2b68 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/reporters/get_reporters.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/reporters/get_reporters.ts @@ -8,17 +8,13 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { CASES_URL, CASE_REPORTERS_URL } from '../../../../../../plugins/case/common/constants'; -import { - defaultUser, - postCaseReq, - removeServerGeneratedPropertiesFromCase, -} from '../../../../common/lib/mock'; +import { defaultUser, postCaseReq } from '../../../../common/lib/mock'; import { deleteCases } from '../../../../common/lib/utils'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('get_reporters', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/status/get_status.ts b/x-pack/test/case_api_integration/basic/tests/cases/status/get_status.ts index 2093a85e5751e..4ca1af3a687ce 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/status/get_status.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/status/get_status.ts @@ -14,7 +14,7 @@ import { deleteCases } from '../../../../common/lib/utils'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('get_status', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/tags/get_tags.ts b/x-pack/test/case_api_integration/basic/tests/cases/tags/get_tags.ts index 8bb3c158ec18a..9b769e3c5eef4 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/tags/get_tags.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/tags/get_tags.ts @@ -9,12 +9,12 @@ import { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { CASES_URL, CASE_TAGS_URL } from '../../../../../../plugins/case/common/constants'; import { postCaseReq } from '../../../../common/lib/mock'; -import { deleteCases, deleteComments } from '../../../../common/lib/utils'; +import { deleteCases } from '../../../../common/lib/utils'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('get_tags', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/cases/user_actions/get_all_user_actions.ts b/x-pack/test/case_api_integration/basic/tests/cases/user_actions/get_all_user_actions.ts index 56e2d8bf337be..f3996e36d1413 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/user_actions/get_all_user_actions.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/user_actions/get_all_user_actions.ts @@ -7,14 +7,14 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; -import { CASES_URL, CASE_STATUS_URL } from '../../../../../../plugins/case/common/constants'; +import { CASES_URL } from '../../../../../../plugins/case/common/constants'; import { postCaseReq, postCommentReq } from '../../../../common/lib/mock'; import { deleteCases, deleteCasesUserActions, deleteComments } from '../../../../common/lib/utils'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('get_all_user_actions', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/basic/tests/configure/get_configure.ts b/x-pack/test/case_api_integration/basic/tests/configure/get_configure.ts index a9fc2706a6ba2..930cf42b9efc5 100644 --- a/x-pack/test/case_api_integration/basic/tests/configure/get_configure.ts +++ b/x-pack/test/case_api_integration/basic/tests/configure/get_configure.ts @@ -18,7 +18,7 @@ import { // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('get_configure', () => { afterEach(async () => { diff --git a/x-pack/test/case_api_integration/common/lib/utils.ts b/x-pack/test/case_api_integration/common/lib/utils.ts index ae4a0a3491c5a..4b1dc6ffa5891 100644 --- a/x-pack/test/case_api_integration/common/lib/utils.ts +++ b/x-pack/test/case_api_integration/common/lib/utils.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +import { Client } from '@elastic/elasticsearch'; import { CasesConfigureRequest, CasesConfigureResponse } from '../../../../plugins/case/common/api'; export const getConfiguration = (connector_id: string = 'connector-1'): CasesConfigureRequest => { @@ -29,42 +30,42 @@ export const removeServerGeneratedPropertiesFromConfigure = ( return rest; }; -export const deleteCasesUserActions = async (es: any): Promise => { +export const deleteCasesUserActions = async (es: Client): Promise => { await es.deleteByQuery({ index: '.kibana', q: 'type:cases-user-actions', - waitForCompletion: true, - refresh: 'wait_for', + wait_for_completion: true, + refresh: true, body: {}, }); }; -export const deleteCases = async (es: any): Promise => { +export const deleteCases = async (es: Client): Promise => { await es.deleteByQuery({ index: '.kibana', q: 'type:cases', - waitForCompletion: true, - refresh: 'wait_for', + wait_for_completion: true, + refresh: true, body: {}, }); }; -export const deleteComments = async (es: any): Promise => { +export const deleteComments = async (es: Client): Promise => { await es.deleteByQuery({ index: '.kibana', q: 'type:cases-comments', - waitForCompletion: true, - refresh: 'wait_for', + wait_for_completion: true, + refresh: true, body: {}, }); }; -export const deleteConfiguration = async (es: any): Promise => { +export const deleteConfiguration = async (es: Client): Promise => { await es.deleteByQuery({ index: '.kibana', q: 'type:cases-configure', - waitForCompletion: true, - refresh: 'wait_for', + wait_for_completion: true, + refresh: true, body: {}, }); };