Skip to content

Commit

Permalink
[Cloud Security] wait for action button to be present before clicking…
Browse files Browse the repository at this point in the history
… to fix flacky FTR tests (#164054)

## Summary

Fixing flaky FTR test where we need to navigate to the integrations page
from our onboarding views. Confirmed in the flaky test runner that with
the fix tests are not flaky anymore
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2901

fixes:
- #163950

---------

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
maxcold and kibanamachine authored Aug 22, 2023
1 parent ce93a1f commit 9aba253
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const FINDINGS_LATEST_INDEX = 'logs-cloud_security_posture.findings_latest-defau

export function FindingsPageProvider({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common']);
const PageObjects = getPageObjects(['common', 'header']);
const retry = getService('retry');
const es = getService('es');
const supertest = getService('supertest');
Expand Down Expand Up @@ -92,7 +92,15 @@ export function FindingsPageProvider({ getService, getPageObjects }: FtrProvider
},

async navigateToAction(actionTestSubject: string) {
await testSubjects.click(actionTestSubject);
return await retry.try(async () => {
await testSubjects.click(actionTestSubject);
await PageObjects.header.waitUntilLoadingHasFinished();
const result = await testSubjects.exists('createPackagePolicy_pageTitle');

if (!result) {
throw new Error('Integration installation page not found');
}
});
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
export default ({ getPageObjects }: FtrProviderContext) => {
const PageObjects = getPageObjects(['common', 'findings', 'header']);

// Failing: See https://github.com/elastic/kibana/issues/163950
describe.skip('Findings Page onboarding', function () {
describe('Findings Page onboarding', function () {
this.tags(['cloud_security_posture_findings_onboarding']);
let findings: typeof PageObjects.findings;
let notInstalledVulnerabilities: typeof findings.notInstalledVulnerabilities;
Expand All @@ -34,6 +33,7 @@ export default ({ getPageObjects }: FtrProviderContext) => {
expect(element).to.not.be(null);

await notInstalledVulnerabilities.navigateToAction('cnvm-not-installed-action');

await PageObjects.common.waitUntilUrlIncludes('add-integration/vuln_mgmt');
});

Expand All @@ -44,6 +44,7 @@ export default ({ getPageObjects }: FtrProviderContext) => {
expect(element).to.not.be(null);

await notInstalledCSP.navigateToAction('cspm-not-installed-action');

await PageObjects.common.waitUntilUrlIncludes('add-integration/cspm');
});

Expand Down

0 comments on commit 9aba253

Please sign in to comment.