Skip to content

Commit

Permalink
[Cloud Security] replace sleep usage with retry.tryForTime in add_cis…
Browse files Browse the repository at this point in the history
…_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)
  • Loading branch information
alexreal1314 authored Feb 23, 2025
1 parent 2288cc8 commit 9ecf5b6
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

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

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

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

0 comments on commit 9ecf5b6

Please sign in to comment.