diff --git a/x-pack/test/reporting/api/usage.ts b/x-pack/test/reporting/api/usage.ts index 6473168f03200..427dfe33e58b7 100644 --- a/x-pack/test/reporting/api/usage.ts +++ b/x-pack/test/reporting/api/usage.ts @@ -5,8 +5,13 @@ */ import expect from '@kbn/expect'; -import * as GenerationUrls from './generation_urls'; import { FtrProviderContext } from '../ftr_provider_context'; +import { ReportingUsageStats } from '../services/reporting_api'; +import * as GenerationUrls from './generation_urls'; + +interface UsageStats { + reporting: ReportingUsageStats; +} // eslint-disable-next-line import/no-default-export export default function({ getService }: FtrProviderContext) { @@ -19,10 +24,10 @@ export default function({ getService }: FtrProviderContext) { afterEach(() => reportingAPI.deleteAllReportingIndexes()); describe('initial state', () => { - let usage: any; // FIXME after https://github.com/elastic/kibana/pull/64841 is merged use ReportingUsageType + let usage: UsageStats; before(async () => { - usage = await usageAPI.getUsageStats(); + usage = (await usageAPI.getUsageStats()) as UsageStats; }); it('shows reporting as available and enabled', async () => { diff --git a/x-pack/test/reporting/services/reporting_api.ts b/x-pack/test/reporting/services/reporting_api.ts index 212dc2800c0f8..1fa5fd7135708 100644 --- a/x-pack/test/reporting/services/reporting_api.ts +++ b/x-pack/test/reporting/services/reporting_api.ts @@ -7,15 +7,37 @@ import expect from '@kbn/expect'; // @ts-ignore no module definition import { indexTimestamp } from '../../../legacy/plugins/reporting/server/lib/esqueue/helpers/index_timestamp'; -import { ReportingUsageType } from '../../../legacy/plugins/reporting/server/usage/types'; import { FtrProviderContext } from '../ftr_provider_context'; -function removeWhitespace(str: string) { - return str.replace(/\s/g, ''); +interface PDFAppCounts { + app: { + [appName: string]: number; + }; + layout: { + [layoutType: string]: number; + }; +} + +export interface ReportingUsageStats { + available: boolean; + enabled: boolean; + total: number; + last_7_days: { + total: number; + printable_pdf: PDFAppCounts; + [jobType: string]: any; + }; + printable_pdf: PDFAppCounts; + status: any; + [jobType: string]: any; } interface UsageStats { - reporting: ReportingUsageType; + reporting: ReportingUsageStats; +} + +function removeWhitespace(str: string) { + return str.replace(/\s/g, ''); } export function ReportingAPIProvider({ getService }: FtrProviderContext) {