[Cloud Security] wait for action button to be present before clicking 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:
- https://github.com/elastic/kibana/issues/163950

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Maxim Kholod 2023-08-22 11:23:58 +03:00 committed by GitHub
parent ce93a1f871
commit 9aba253d56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View file

@ -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');
@ -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');
}
});
},
});

View file

@ -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;
@ -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');
});
@ -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');
});