From 3e4af77d5ad5c85cf4a0d6aef67752fdacb6b419 Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Tue, 30 Mar 2021 10:51:00 +0200 Subject: [PATCH 1/2] [ML] Functional tests - stabilize anomaly explorer tests for slow network (#95628) This PR stabilizes the ML anomaly explorer functional tests for slow network environments. --- .../apps/ml/anomaly_detection/anomaly_explorer.ts | 10 ++++++++++ .../test/functional/services/ml/anomaly_explorer.ts | 3 ++- x-pack/test/functional/services/ml/swim_lane.ts | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts b/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts index 4461c5aec42fc..c86a875be6416 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts @@ -189,6 +189,8 @@ export default function ({ getService }: FtrProviderContext) { x: sampleCell.x + cellSize, y: sampleCell.y + cellSize, }); + await ml.swimLane.waitForSwimLanesToLoad(); + // TODO extend cell data with X and Y values, and cell width await ml.swimLane.assertSelection(overallSwimLaneTestSubj, { x: [1454846400000, 1454860800000], @@ -215,6 +217,8 @@ export default function ({ getService }: FtrProviderContext) { await ml.testExecution.logTestStep('clears the selection'); await ml.anomalyExplorer.clearSwimLaneSelection(); + await ml.swimLane.waitForSwimLanesToLoad(); + await ml.navigation.assertCurrentURLNotContain( 'selectedLanes%3A!(Overall)%2CselectedTimes%3A!(1454846400%2C1454860800)%2CselectedType%3Aoverall%2CshowTopFieldValues%3A!t%2CviewByFieldName%3Aairline%2CviewByFromPage%3A1%2CviewByPerPage%3A10' ); @@ -255,6 +259,7 @@ export default function ({ getService }: FtrProviderContext) { x: sampleCell.x + cellSize, y: sampleCell.y + cellSize, }); + await ml.swimLane.waitForSwimLanesToLoad(); await ml.testExecution.logTestStep('check page content'); await ml.swimLane.assertSelection(viewBySwimLaneTestSubj, { @@ -274,6 +279,8 @@ export default function ({ getService }: FtrProviderContext) { await ml.testExecution.logTestStep('clears the selection'); await ml.anomalyExplorer.clearSwimLaneSelection(); + await ml.swimLane.waitForSwimLanesToLoad(); + await ml.anomaliesTable.assertTableRowsCount(25); await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 10); await ml.anomalyExplorer.assertAnomalyExplorerChartsCount(0); @@ -299,6 +306,7 @@ export default function ({ getService }: FtrProviderContext) { x2: sampleCell2!.x + cellSize, y2: sampleCell2!.y + cellSize, }); + await ml.swimLane.waitForSwimLanesToLoad(); await ml.swimLane.assertSelection(viewBySwimLaneTestSubj, { x: [1454817600000, 1454846400000], @@ -311,6 +319,8 @@ export default function ({ getService }: FtrProviderContext) { await ml.testExecution.logTestStep('clears the selection'); await ml.anomalyExplorer.clearSwimLaneSelection(); + await ml.swimLane.waitForSwimLanesToLoad(); + await ml.anomaliesTable.assertTableRowsCount(25); await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 10); await ml.anomalyExplorer.assertAnomalyExplorerChartsCount(0); diff --git a/x-pack/test/functional/services/ml/anomaly_explorer.ts b/x-pack/test/functional/services/ml/anomaly_explorer.ts index 4b1992777b8a7..6ec45204388d7 100644 --- a/x-pack/test/functional/services/ml/anomaly_explorer.ts +++ b/x-pack/test/functional/services/ml/anomaly_explorer.ts @@ -89,7 +89,8 @@ export function MachineLearningAnomalyExplorerProvider({ getService }: FtrProvid true ); await testSubjects.clickWhenNotDisabled('mlAddAndEditDashboardButton'); - const embeddable = await testSubjects.find('mlAnomalySwimlaneEmbeddableWrapper'); + // changing to the dashboard app might take sime time + const embeddable = await testSubjects.find('mlAnomalySwimlaneEmbeddableWrapper', 30 * 1000); const swimlane = await embeddable.findByClassName('mlSwimLaneContainer'); expect(await swimlane.isDisplayed()).to.eql( true, diff --git a/x-pack/test/functional/services/ml/swim_lane.ts b/x-pack/test/functional/services/ml/swim_lane.ts index d659b24559a43..29918b83cd276 100644 --- a/x-pack/test/functional/services/ml/swim_lane.ts +++ b/x-pack/test/functional/services/ml/swim_lane.ts @@ -208,5 +208,16 @@ export function SwimLaneProvider({ getService }: FtrProviderContext) { await testSubjects.click(`mlSwimLanePageSizePanel > ${rowsCount} rows`); await this.assertPageSize(testSubj, rowsCount); }, + + async waitForSwimLanesToLoad() { + // when updating the swim lanes, the old lanes might still be displayed + // for some time, before the loading indicator is displayed + + // wait for loading indicator to be displayed, but don't fail in case it's already gone + if (await testSubjects.exists('mlSwimLaneLoadingIndicator', { timeout: 10 * 1000 })) { + // only wait for loading indicator to disappear if it was actually displayed + await testSubjects.missingOrFail('mlSwimLaneLoadingIndicator', { timeout: 10 * 1000 }); + } + }, }; } From cd703c0c89b3f677c9d89e27c43b6526259682be Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Tue, 30 Mar 2021 10:56:29 +0200 Subject: [PATCH 2/2] Revert "[ci] skip building ts refs when not necessary (#95739)" (#95746) This reverts commit e46a74f7 --- .ci/Jenkinsfile_baseline_capture | 1 - test/scripts/checks/type_check.sh | 3 --- vars/workers.groovy | 1 - 3 files changed, 5 deletions(-) diff --git a/.ci/Jenkinsfile_baseline_capture b/.ci/Jenkinsfile_baseline_capture index e017ba54f5595..7fefbbb26fd12 100644 --- a/.ci/Jenkinsfile_baseline_capture +++ b/.ci/Jenkinsfile_baseline_capture @@ -23,7 +23,6 @@ kibanaPipeline(timeoutMinutes: 210) { ) { withGcpServiceAccount.fromVaultSecret('secret/kibana-issues/dev/ci-artifacts-key', 'value') { withEnv([ - 'BUILD_TS_REFS_DISABLE=false', // disabled in root config so we need to override that here 'BUILD_TS_REFS_CACHE_ENABLE=true', 'BUILD_TS_REFS_CACHE_CAPTURE=true', 'DISABLE_BOOTSTRAP_VALIDATION=true', diff --git a/test/scripts/checks/type_check.sh b/test/scripts/checks/type_check.sh index a7ea84d4cadc7..5e091625de4ed 100755 --- a/test/scripts/checks/type_check.sh +++ b/test/scripts/checks/type_check.sh @@ -2,8 +2,5 @@ source src/dev/ci_setup/setup_env.sh -checks-reporter-with-killswitch "Build TS Refs" \ - node scripts/build_ts_refs --ignore-type-failures --force - checks-reporter-with-killswitch "Check Types" \ node scripts/type_check diff --git a/vars/workers.groovy b/vars/workers.groovy index 1260f74f1bdf9..5d3328bc8a3c4 100644 --- a/vars/workers.groovy +++ b/vars/workers.groovy @@ -101,7 +101,6 @@ def base(Map params, Closure closure) { "TEST_BROWSER_HEADLESS=1", "GIT_BRANCH=${checkoutInfo.branch}", "TMPDIR=${env.WORKSPACE}/tmp", // For Chrome and anything else that respects it - "BUILD_TS_REFS_DISABLE=true", // no need to build ts refs in bootstrap ]) { withCredentials([ string(credentialsId: 'vault-addr', variable: 'VAULT_ADDR'),