Skip to content

Commit

Permalink
added another delay to handle a different failure + clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
animehart committed Jun 28, 2023
1 parent 2d484d7 commit 7cd831b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
11 changes: 11 additions & 0 deletions x-pack/test/cloud_security_posture_functional/helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

/* This sleep or delay is added to allow some time for the column to settle down before we get the value and to prevent the test from getting the wrong value*/
export const sleep = (num: number) => {
return new Promise((res) => setTimeout(res, num));
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import expect from '@kbn/expect';
import type { FtrProviderContext } from '../ftr_provider_context';
import { sleep } from '../helper';

// Defined in CSP plugin
const LATEST_FINDINGS_INDEX = 'logs-cloud_security_posture.findings_latest-default';
Expand Down Expand Up @@ -61,6 +62,7 @@ export function CspDashboardPageProvider({ getService, getPageObjects }: FtrProv

getKubernetesTab: async () => {
const tabs = await dashboard.getDashboardTabs();
sleep(1000);
return await tabs.findByXpath(`//span[text()="Kubernetes"]`);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
import expect from '@kbn/expect';
import Chance from 'chance';
import type { FtrProviderContext } from '../ftr_provider_context';

/* This sleep or delay is added to allow some time for the column to settle down before we get the value and to prevent the test from getting the wrong value*/
const sleep = (num: number) => {
return new Promise((res) => setTimeout(res, num));
};
import { sleep } from '../helper';

// eslint-disable-next-line import/no-default-export
export default function ({ getPageObjects, getService }: FtrProviderContext) {
Expand Down

0 comments on commit 7cd831b

Please sign in to comment.