Skip to content

Commit

Permalink
added sleep for filters for stability
Browse files Browse the repository at this point in the history
  • Loading branch information
animehart committed Jun 28, 2023
1 parent 96e6e22 commit 2d484d7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions x-pack/test/cloud_security_posture_functional/pages/findings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ 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));
};

// eslint-disable-next-line import/no-default-export
export default function ({ getPageObjects, getService }: FtrProviderContext) {
const queryBar = getService('queryBar');
Expand Down Expand Up @@ -95,8 +100,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

const benchMarkName = data[0].rule.benchmark.name;

// Failing: See https://github.com/elastic/kibana/issues/159565
describe.skip('Findings Page', () => {
describe('Findings Page', () => {
let findings: typeof pageObjects.findings;
let latestFindingsTable: typeof findings.latestFindingsTable;
let findingsByResourceTable: typeof findings.findingsByResourceTable;
Expand Down Expand Up @@ -131,6 +135,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
describe('SearchBar', () => {
it('add filter', async () => {
await filterBar.addFilter({ field: 'rule.name', operation: 'is', value: ruleName1 });
sleep(1000);

expect(await filterBar.hasFilter('rule.name', ruleName1)).to.be(true);
expect(await latestFindingsTable.hasColumnValue('Rule Name', ruleName1)).to.be(true);
Expand Down Expand Up @@ -187,11 +192,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
return a.localeCompare(b);
};

/* 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));
};

it('sorts by a column, should be case sensitive/insensitive depending on the column', async () => {
type TestCase = [string, SortDirection, SortingMethod];
const testCases: TestCase[] = [
Expand Down

0 comments on commit 2d484d7

Please sign in to comment.