Skip to content

Commit 9ecf5b6

Browse files
authored
[Cloud Security] replace sleep usage with retry.tryForTime in add_cis_integration FTR (#212187)
## Summary This PR replace the usage of sleep method to use retry.tryForTime instead. ### Checklist - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
1 parent 2288cc8 commit 9ecf5b6

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

x-pack/test/cloud_security_posture_functional/page_objects/add_cis_integration_form_page.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
import { v4 as uuidv4 } from 'uuid';
9-
import { setTimeout as sleep } from 'node:timers/promises';
109
import expect from '@kbn/expect';
1110
import { testSubjectIds } from '../constants/test_subject_ids';
1211
import type { FtrProviderContext } from '../ftr_provider_context';
@@ -19,6 +18,7 @@ export function AddCisIntegrationFormPageProvider({
1918
const PageObjects = getPageObjects(['common', 'header']);
2019
const browser = getService('browser');
2120
const logger = getService('log');
21+
const retry = getService('retry');
2222

2323
const AWS_CREDENTIAL_SELECTOR = 'aws-credentials-type-selector';
2424

@@ -256,8 +256,9 @@ export function AddCisIntegrationFormPageProvider({
256256
const button = await testSubjects.find(buttonId);
257257
await button.click();
258258
// Wait a bit to allow the new tab to load the URL
259-
await sleep(3000);
260-
await browser.switchTab(1);
259+
await retry.tryForTime(3000, async () => {
260+
await browser.switchTab(1);
261+
});
261262
const currentUrl = await browser.getCurrentUrl();
262263
await browser.closeCurrentWindow();
263264
await browser.switchTab(0);

0 commit comments

Comments
 (0)