[Obs AI Assistant] Unskip user instructions test (#205656) (#205897)

Closes https://github.com/elastic/kibana/issues/205656

## Summary

### Problem
There seems to be a race condition and state contamination between tests
in the KB user instructions tests.

### Solution
- Clear knowledge base and conversations after tests
- Remove title interceptor --> we don't need title interception for
these tests

### Checklist

- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
Viduni Wickramarachchi 2025-01-09 10:01:15 -05:00 committed by GitHub
parent 75fe22b604
commit 37d7a5efb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 18 deletions

View file

@ -233,12 +233,9 @@ export default function ApiTest({ getService }: FtrProviderContext) {
})
.expect(200);
const interceptPromises = [
proxy.interceptConversationTitle('LLM-generated title').completeAfterIntercept(),
proxy
.interceptConversation({ name: 'conversation', response: 'I, the LLM, hear you!' })
.completeAfterIntercept(),
];
const interceptPromise = proxy
.interceptConversation({ name: 'conversation', response: 'I, the LLM, hear you!' })
.completeAfterIntercept();
const messages: Message[] = [
{
@ -283,8 +280,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
},
});
// wait for all interceptors to be settled
await Promise.all(interceptPromises);
await interceptPromise;
const conversation = res.body;
return conversation;
@ -297,6 +293,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {
after(async () => {
proxy.close();
await clearKnowledgeBase(es);
await clearConversations(es);
await deleteActionConnector({ supertest, connectorId, log });
});

View file

@ -37,8 +37,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
const svlCommonApi = getService('svlCommonApi');
const retry = getService('retry');
// Failing: See https://github.com/elastic/kibana/issues/205656
describe.skip('Knowledge base user instructions', function () {
describe('Knowledge base user instructions', function () {
// TODO: https://github.com/elastic/kibana/issues/192751
this.tags(['skipMKI']);
let editorRoleAuthc: RoleCredentials;
@ -248,12 +247,9 @@ export default function ApiTest({ getService }: FtrProviderContext) {
})
.expect(200);
const interceptPromises = [
proxy.interceptConversationTitle('LLM-generated title').completeAfterIntercept(),
proxy
.interceptConversation({ name: 'conversation', response: 'I, the LLM, hear you!' })
.completeAfterIntercept(),
];
const interceptPromise = proxy
.interceptConversation({ name: 'conversation', response: 'I, the LLM, hear you!' })
.completeAfterIntercept();
const messages: Message[] = [
{
@ -298,8 +294,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
},
});
// wait for all interceptors to be settled
await Promise.all(interceptPromises);
await interceptPromise;
const conversation = res.body;
return conversation;
@ -318,6 +313,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {
after(async () => {
proxy.close();
await clearKnowledgeBase(es);
await clearConversations(es);
await deleteActionConnector({
supertest: supertestWithoutAuth,
connectorId,