Skip to content

Commit

Permalink
fixes ftr test for adding case system action to rule
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley14 committed Jul 17, 2024
1 parent dbf4db2 commit 991e10a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
17 changes: 4 additions & 13 deletions x-pack/test/cases_api_integration/common/lib/api/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ export const createCase = async (
return theCase;
};

export const waitForCases = async ({
supertest,
log,
}: {
supertest: SuperTest.Agent;
log: ToolingLog;
}): Promise<void> => {
export const waitForCases = async (supertest: SuperTest.Agent, log: ToolingLog): Promise<void> => {
await waitFor(
async () => {
const response = await getCases(supertest);
Expand All @@ -61,16 +55,13 @@ export const waitForCases = async ({
export const getCases = async (
supertest: SuperTest.Agent,
expectedHttpCode: number = 200,
auth: { user: User; space: string | null } | null = { user: superUser, space: null },
headers: Record<string, string | string[]> = {}
): Promise<CasesFindResponse> => {
const apiCall = supertest.get(`${getSpaceUrlPrefix(auth?.space)}${CASES_URL}/_find`);

setupAuth({ apiCall, headers, auth });

const { body: theCase } = await apiCall
const { body: theCase } = await supertest
.get(`${CASES_URL}/_find`)
.set('kbn-xsrf', 'true')
.set('x-elastic-internal-origin', 'foo')
.set('elastic-api-version', '2023-10-31')
.set(headers)
.expect(expectedHttpCode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default ({ getService }: FtrProviderContext) => {
};
const createdRule = await createRule(supertest, log, rule);
const alerts = await getAlerts(supertest, log, es, createdRule);
await waitForCases({ supertest, log });
await waitForCases(supertest, log);
const cases = await getCases(supertest);
expect(cases.cases[0].totalAlerts).toBeGreaterThan(0);
expect(alerts.hits.hits.length).toBeGreaterThan(0);
Expand Down

0 comments on commit 991e10a

Please sign in to comment.