diff --git a/x-pack/test/observability_ai_assistant_api_integration/tests/knowledge_base/knowledge_base_user_instructions.spec.ts b/x-pack/test/observability_ai_assistant_api_integration/tests/knowledge_base/knowledge_base_user_instructions.spec.ts index dc0f991c66ee2..a93c194c85daa 100644 --- a/x-pack/test/observability_ai_assistant_api_integration/tests/knowledge_base/knowledge_base_user_instructions.spec.ts +++ b/x-pack/test/observability_ai_assistant_api_integration/tests/knowledge_base/knowledge_base_user_instructions.spec.ts @@ -10,6 +10,7 @@ import { kbnTestConfig } from '@kbn/test'; import { sortBy } from 'lodash'; import { Message, MessageRole } from '@kbn/observability-ai-assistant-plugin/common'; import { CONTEXT_FUNCTION_NAME } from '@kbn/observability-ai-assistant-plugin/server/functions/context'; +import { Instruction } from '@kbn/observability-ai-assistant-plugin/common/types'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import { clearConversations, @@ -51,8 +52,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { await clearConversations(es); }); - // FLAKY: https://github.com/elastic/kibana/issues/192222 - describe.skip('when creating private and public user instructions', () => { + describe('when creating private and public user instructions', () => { before(async () => { await clearKnowledgeBase(es); @@ -75,6 +75,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { }, ].map(async ({ username, isPublic }) => { const visibility = isPublic ? 'Public' : 'Private'; + await getScopedApiClientForUsername(username)({ endpoint: 'PUT /internal/observability_ai_assistant/kb/user_instructions', params: { @@ -94,9 +95,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { const res = await observabilityAIAssistantAPIClient.editorUser({ endpoint: 'GET /internal/observability_ai_assistant/kb/user_instructions', }); + const instructions = res.body.userInstructions; - const sortByDocId = (data: any) => sortBy(data, 'doc_id'); + const sortByDocId = (data: Array) => + sortBy(data, 'doc_id'); + expect(sortByDocId(instructions)).to.eql( sortByDocId([ { @@ -124,7 +128,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); const instructions = res.body.userInstructions; - const sortByDocId = (data: any) => sortBy(data, 'doc_id'); + const sortByDocId = (data: Array) => + sortBy(data, 'doc_id'); + expect(sortByDocId(instructions)).to.eql( sortByDocId([ {