diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group3/tests/alerting/schedule_circuit_breaker/create_with_circuit_breaker.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group3/tests/alerting/schedule_circuit_breaker/create_with_circuit_breaker.ts index 8183f6b48f4ed..bf1a0792a0091 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group3/tests/alerting/schedule_circuit_breaker/create_with_circuit_breaker.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group3/tests/alerting/schedule_circuit_breaker/create_with_circuit_breaker.ts @@ -26,7 +26,7 @@ export default function createWithCircuitBreakerTests({ getService }: FtrProvide .expect(200); objectRemover.add('space1', createdRule.id, 'rule', 'alerting'); - const { body } = await supertest + await supertest .post(`${getUrlPrefix('space1')}/api/alerting/rule`) .set('kbn-xsrf', 'foo') .send(getTestRuleData({ schedule: { interval: '10s' } })) @@ -41,7 +41,7 @@ export default function createWithCircuitBreakerTests({ getService }: FtrProvide .expect(200); objectRemover.add('space1', createdRule.id, 'rule', 'alerting'); - const { body } = await supertest + await supertest .post(`${getUrlPrefix('space2')}/api/alerting/rule`) .set('kbn-xsrf', 'foo') .send(getTestRuleData({ schedule: { interval: '10s' } })) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group3/tests/alerting/suggestions_value_alert.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group3/tests/alerting/suggestions_value_alert.ts index 3980c174528ed..1478a02454bb0 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group3/tests/alerting/suggestions_value_alert.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group3/tests/alerting/suggestions_value_alert.ts @@ -17,7 +17,6 @@ export default function createRuleSuggestionValuesTests({ getService }: FtrProvi describe('alerts/suggestions/values', async () => { const esArchiver = getService('esArchiver'); const supertest = getService('supertest'); - const supertestWithoutAuth = getService('supertestWithoutAuth'); before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts'); diff --git a/x-pack/test/api_integration/apis/management/ingest_pipelines/lib/fixtures.ts b/x-pack/test/api_integration/apis/management/ingest_pipelines/lib/fixtures.ts index c148101749085..344b6fab0f07f 100644 --- a/x-pack/test/api_integration/apis/management/ingest_pipelines/lib/fixtures.ts +++ b/x-pack/test/api_integration/apis/management/ingest_pipelines/lib/fixtures.ts @@ -12,7 +12,7 @@ import { IngestPutPipelineRequest, } from '@elastic/elasticsearch/lib/api/types'; -interface Pipeline { +export interface Pipeline { name: string; description?: string; onFailureProcessors?: IngestProcessorContainer[]; @@ -21,7 +21,7 @@ interface Pipeline { metadata?: Metadata; } -interface IngestPutPipelineInternalRequest extends Omit { +export interface IngestPutPipelineInternalRequest extends Omit { name: string; } diff --git a/x-pack/test/api_integration/apis/security_solution/authentications.ts b/x-pack/test/api_integration/apis/security_solution/authentications.ts index aa54114e04d72..b65c93995156b 100644 --- a/x-pack/test/api_integration/apis/security_solution/authentications.ts +++ b/x-pack/test/api_integration/apis/security_solution/authentications.ts @@ -9,10 +9,10 @@ import expect from '@kbn/expect'; import { AuthStackByField, Direction, - UserAuthenticationsRequestOptions, UserAuthenticationsStrategyResponse, UsersQueries, } from '@kbn/security-solution-plugin/common/search_strategy'; +import type { UserAuthenticationsRequestOptions } from '@kbn/security-solution-plugin/common/api/search_strategy'; import { FtrProviderContext } from '../../ftr_provider_context'; diff --git a/x-pack/test/apm_api_integration/common/bettertest.ts b/x-pack/test/apm_api_integration/common/bettertest.ts index 83f7da5725db8..e1132be3f9a77 100644 --- a/x-pack/test/apm_api_integration/common/bettertest.ts +++ b/x-pack/test/apm_api_integration/common/bettertest.ts @@ -20,7 +20,7 @@ interface BetterTestOptions { body?: any; } -interface BetterTestResponse { +export interface BetterTestResponse { status: number; body: T; } @@ -72,7 +72,7 @@ export class BetterTestError extends Error { const req = res.req as any; super( `Unhandled BetterTestError: -Status: "${res.status}" +Status: "${res.status}" Path: "${req.method} ${req.path}" Body: ${JSON.stringify(res.body)}` ); diff --git a/x-pack/test/apm_api_integration/common/registry.ts b/x-pack/test/apm_api_integration/common/registry.ts index 6876854b5991d..6ae932f59e2a4 100644 --- a/x-pack/test/apm_api_integration/common/registry.ts +++ b/x-pack/test/apm_api_integration/common/registry.ts @@ -153,7 +153,7 @@ export function RegistryProvider({ getService }: FtrProviderContext) { await supertest .get('/api/ml/saved_objects/sync') .set('kbn-xsrf', 'foo') - .auth(ApmUsername.editorUser, kbnTestConfig.getUrlParts().password); + .auth(ApmUsername.editorUser, kbnTestConfig.getUrlParts().password!); } if (condition.archives.length) { log('Loaded all archives'); diff --git a/x-pack/test/apm_api_integration/tests/diagnostics/indices.spec.ts b/x-pack/test/apm_api_integration/tests/diagnostics/indices.spec.ts index 3314b4fdcfcfc..7822acfe923ff 100644 --- a/x-pack/test/apm_api_integration/tests/diagnostics/indices.spec.ts +++ b/x-pack/test/apm_api_integration/tests/diagnostics/indices.spec.ts @@ -61,7 +61,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); expect(status).to.be(200); - expect(body.validIndices.length).to.be.greaterThan(0); + expect(body.validIndices?.length).to.be.greaterThan(0); expect(body.invalidIndices).to.eql([]); }); }); @@ -102,7 +102,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); expect(status).to.be(200); - expect(body.validIndices.length).to.be.greaterThan(0); + expect(body.validIndices?.length).to.be.greaterThan(0); expect(body.invalidIndices).to.eql([ { isValid: false, @@ -158,10 +158,10 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); expect(status).to.be(200); - expect(body.validIndices.length).to.be.greaterThan(0); - expect(body.invalidIndices.length).to.be(1); + expect(body.validIndices?.length).to.be.greaterThan(0); + expect(body.invalidIndices?.length).to.be(1); - expect(omit(body.invalidIndices[0], 'index')).to.eql({ + expect(omit(body.invalidIndices?.[0], 'index')).to.eql({ isValid: false, fieldMappings: { isValid: true }, ingestPipeline: { isValid: false }, @@ -187,9 +187,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); expect(status).to.be(200); - expect(body.validIndices.length).to.be.greaterThan(0); - expect(body.invalidIndices.length).to.be(1); - expect(omit(body.invalidIndices[0], 'index')).to.eql({ + expect(body.validIndices?.length).to.be.greaterThan(0); + expect(body.invalidIndices?.length).to.be(1); + expect(omit(body.invalidIndices?.[0], 'index')).to.eql({ isValid: false, fieldMappings: { isValid: true }, ingestPipeline: { isValid: false, id: 'logs-default-pipeline' }, diff --git a/x-pack/test/cloud_security_posture_functional/pages/findings.ts b/x-pack/test/cloud_security_posture_functional/pages/findings.ts index 5f85b38d39dd6..5caedd4a6e7f2 100644 --- a/x-pack/test/cloud_security_posture_functional/pages/findings.ts +++ b/x-pack/test/cloud_security_posture_functional/pages/findings.ts @@ -22,6 +22,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // We intentionally make some fields start with a capital letter to test that the query bar is case-insensitive/case-sensitive const data = [ { + '@timestamp': '1695819664234', resource: { id: chance.guid(), name: `kubelet`, sub_type: 'lower case sub type' }, result: { evaluation: chance.integer() % 2 === 0 ? 'passed' : 'failed' }, rule: { @@ -38,6 +39,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { cluster_id: 'Upper case cluster id', }, { + '@timestamp': '1695819673242', resource: { id: chance.guid(), name: `Pod`, sub_type: 'Upper case sub type' }, result: { evaluation: chance.integer() % 2 === 0 ? 'passed' : 'failed' }, rule: { @@ -54,6 +56,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { cluster_id: 'Another Upper case cluster id', }, { + '@timestamp': '1695819676242', resource: { id: chance.guid(), name: `process`, sub_type: 'another lower case type' }, result: { evaluation: 'passed' }, rule: { @@ -70,6 +73,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { cluster_id: 'lower case cluster id', }, { + '@timestamp': '1695819680202', resource: { id: chance.guid(), name: `process`, sub_type: 'Upper case type again' }, result: { evaluation: 'failed' }, rule: { diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/group9/exception_operators_data_types/ip_array.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/group9/exception_operators_data_types/ip_array.ts index d828b332d215a..0fcdf1a03b14b 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/group9/exception_operators_data_types/ip_array.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/group9/exception_operators_data_types/ip_array.ts @@ -152,7 +152,7 @@ export default ({ getService }: FtrProviderContext) => { await waitForSignalsToBePresent(supertest, log, 1, [id]); const signalsOpen = await getSignalsById(supertest, log, id); const ips = signalsOpen.hits.hits.map((hit) => hit._source?.ip).sort(); - expect(ips.flat(Number.MAX_SAFE_INTEGER)).to.eql([]); + expect(ips.flat(10)).to.eql([]); }); it('should filter a CIDR range of "127.0.0.1/30"', async () => { @@ -347,7 +347,7 @@ export default ({ getService }: FtrProviderContext) => { await waitForSignalsToBePresent(supertest, log, 1, [id]); const signalsOpen = await getSignalsById(supertest, log, id); const ips = signalsOpen.hits.hits.map((hit) => hit._source?.ip).sort(); - expect(ips.flat(Number.MAX_SAFE_INTEGER)).to.eql([]); + expect(ips.flat(10)).to.eql([]); }); }); @@ -409,7 +409,7 @@ export default ({ getService }: FtrProviderContext) => { await waitForSignalsToBePresent(supertest, log, 1, [id]); const signalsOpen = await getSignalsById(supertest, log, id); const ips = signalsOpen.hits.hits.map((hit) => hit._source?.ip).sort(); - expect(ips.flat(Number.MAX_SAFE_INTEGER)).to.eql([]); + expect(ips.flat(10)).to.eql([]); }); }); @@ -514,7 +514,7 @@ export default ({ getService }: FtrProviderContext) => { await waitForSignalsToBePresent(supertest, log, 1, [id]); const signalsOpen = await getSignalsById(supertest, log, id); const ips = signalsOpen.hits.hits.map((hit) => hit._source?.ip).sort(); - expect(ips.flat(Number.MAX_SAFE_INTEGER)).to.eql([]); + expect(ips.flat(10)).to.eql([]); }); it('will return 2 results if we have a list which contains the CIDR ranges of "127.0.0.1/32, 127.0.0.2/31, 127.0.0.4/30"', async () => { diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/group9/exception_operators_data_types/text_array.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/group9/exception_operators_data_types/text_array.ts index 27d28c3630293..fe4a13fcc3c84 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/group9/exception_operators_data_types/text_array.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/group9/exception_operators_data_types/text_array.ts @@ -152,7 +152,7 @@ export default ({ getService }: FtrProviderContext) => { await waitForSignalsToBePresent(supertest, log, 1, [id]); const signalsOpen = await getSignalsById(supertest, log, id); const hits = signalsOpen.hits.hits.map((hit) => hit._source?.text).sort(); - expect(hits.flat(Number.MAX_SAFE_INTEGER)).to.eql([]); + expect(hits.flat(10)).to.eql([]); }); }); @@ -280,7 +280,7 @@ export default ({ getService }: FtrProviderContext) => { await waitForSignalsToBePresent(supertest, log, 1, [id]); const signalsOpen = await getSignalsById(supertest, log, id); const hits = signalsOpen.hits.hits.map((hit) => hit._source?.text).sort(); - expect(hits.flat(Number.MAX_SAFE_INTEGER)).to.eql([]); + expect(hits.flat(10)).to.eql([]); }); }); @@ -342,7 +342,7 @@ export default ({ getService }: FtrProviderContext) => { await waitForSignalsToBePresent(supertest, log, 1, [id]); const signalsOpen = await getSignalsById(supertest, log, id); const hits = signalsOpen.hits.hits.map((hit) => hit._source?.text).sort(); - expect(hits.flat(Number.MAX_SAFE_INTEGER)).to.eql([]); + expect(hits.flat(10)).to.eql([]); }); }); @@ -522,7 +522,7 @@ export default ({ getService }: FtrProviderContext) => { await waitForSignalsToBePresent(supertest, log, 1, [id]); const signalsOpen = await getSignalsById(supertest, log, id); const hits = signalsOpen.hits.hits.map((hit) => hit._source?.text).sort(); - expect(hits.flat(Number.MAX_SAFE_INTEGER)).to.eql([]); + expect(hits.flat(10)).to.eql([]); }); }); diff --git a/x-pack/test/disable_ems/tests/fonts.ts b/x-pack/test/disable_ems/tests/fonts.ts index aec0b0a6d6802..b8b6d6903db5e 100644 --- a/x-pack/test/disable_ems/tests/fonts.ts +++ b/x-pack/test/disable_ems/tests/fonts.ts @@ -6,6 +6,7 @@ */ import expect from '@kbn/expect'; +import type { FtrProviderContext } from '../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['maps']); diff --git a/x-pack/test/fleet_api_integration/apis/download_sources/crud.ts b/x-pack/test/fleet_api_integration/apis/download_sources/crud.ts index 587a4b7fc884c..8b0e5ca8c4e77 100644 --- a/x-pack/test/fleet_api_integration/apis/download_sources/crud.ts +++ b/x-pack/test/fleet_api_integration/apis/download_sources/crud.ts @@ -357,7 +357,7 @@ export default function (providerContext: FtrProviderContext) { 'https://some.source.proxy:3232' ); - const res = await supertest + await supertest .put(`/api/fleet/agent_download_sources/${downloadSourceId}`) .set('kbn-xsrf', 'xxxx') .send({ diff --git a/x-pack/test/fleet_api_integration/apis/fleet_telemetry.ts b/x-pack/test/fleet_api_integration/apis/fleet_telemetry.ts index e0c6799b5a3cd..3f5c414f46ef8 100644 --- a/x-pack/test/fleet_api_integration/apis/fleet_telemetry.ts +++ b/x-pack/test/fleet_api_integration/apis/fleet_telemetry.ts @@ -126,7 +126,11 @@ export default function (providerContext: FtrProviderContext) { ); }); - async function waitForAgents(expectedAgentCount: number, attempts: number, _attemptsMade = 0) { + async function waitForAgents( + expectedAgentCount: number, + attempts: number, + _attemptsMade = 0 + ): Promise { const { body: apiResponse } = await supertest .get(`/api/fleet/agents?showInactive=true`) .set('kbn-xsrf', 'xxxx') diff --git a/x-pack/test/functional/apps/dashboard/group3/drilldowns/explore_data_chart_action.ts b/x-pack/test/functional/apps/dashboard/group3/drilldowns/explore_data_chart_action.ts index dff41ef2ead73..b8521914da174 100644 --- a/x-pack/test/functional/apps/dashboard/group3/drilldowns/explore_data_chart_action.ts +++ b/x-pack/test/functional/apps/dashboard/group3/drilldowns/explore_data_chart_action.ts @@ -13,7 +13,7 @@ const ACTION_TEST_SUBJ = `embeddablePanelAction-${ACTION_ID}`; export default function ({ getService, getPageObjects }: FtrProviderContext) { const drilldowns = getService('dashboardDrilldownsManage'); - const { dashboard, discover, common, timePicker } = getPageObjects([ + const { dashboard, discover, timePicker } = getPageObjects([ 'dashboard', 'discover', 'common', @@ -28,7 +28,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('Explore underlying data - chart action', () => { describe('value click action', () => { it('action exists in chart click popup menu', async () => { - await PageObjects.dashboard.navigateToApp(); + await dashboard.navigateToApp(); await dashboard.preserveCrossAppState(); await dashboard.loadSavedDashboard(drilldowns.DASHBOARD_WITH_PIE_CHART_NAME); await pieChart.clickOnPieSlice('160,000'); @@ -60,7 +60,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { let originalTimeRangeDurationHours: number | undefined; it('action exists in chart brush popup menu', async () => { - await PageObjects.dashboard.navigateToApp(); + await dashboard.navigateToApp(); await dashboard.preserveCrossAppState(); await dashboard.loadSavedDashboard(drilldowns.DASHBOARD_WITH_AREA_CHART_NAME); diff --git a/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts b/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts index d050a1a9013c6..4364e386b8637 100644 --- a/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts +++ b/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts @@ -6,6 +6,7 @@ */ import { TRANSFORM_STATE } from '@kbn/transform-plugin/common/constants'; +import type { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types'; import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { diff --git a/x-pack/test/functional/page_objects/tag_management_page.ts b/x-pack/test/functional/page_objects/tag_management_page.ts index 2dbff16429c93..7e8fbd8346c1d 100644 --- a/x-pack/test/functional/page_objects/tag_management_page.ts +++ b/x-pack/test/functional/page_objects/tag_management_page.ts @@ -239,7 +239,6 @@ class TagAssignmentFlyout extends FtrService { */ export class TagManagementPageObject extends FtrService { private readonly testSubjects = this.ctx.getService('testSubjects'); - private readonly find = this.ctx.getService('find'); private readonly browser = this.ctx.getService('browser'); private readonly retry = this.ctx.getService('retry'); private readonly header = this.ctx.getPageObject('header'); diff --git a/x-pack/test/functional/services/ml/api.ts b/x-pack/test/functional/services/ml/api.ts index d8dad778fa03e..e2db084b46276 100644 --- a/x-pack/test/functional/services/ml/api.ts +++ b/x-pack/test/functional/services/ml/api.ts @@ -1504,9 +1504,8 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { async deleteIngestPipeline(modelId: string, usePrefix: boolean = true) { log.debug(`Deleting ingest pipeline for trained model with id "${modelId}"`); - const { body, status } = await esSupertest.delete( - `/_ingest/pipeline/${usePrefix ? 'pipeline_' : ''}${modelId}` - ); + // const { body, status } = + await esSupertest.delete(`/_ingest/pipeline/${usePrefix ? 'pipeline_' : ''}${modelId}`); // @todo // this.assertResponseStatusCode(200, status, body);