Skip to content

Commit

Permalink
[Infra UI] Add timeout to fix flaky tests (#162896)
Browse files Browse the repository at this point in the history
Closes #157711
Closes #157740

## Summary

Fixes for the flaky tests: I ran the tests 200 and after that 50 times
and with the fix they are not flaky anymore. The fix was setting a
timeout because the element was still present when the test checked for
it.
  • Loading branch information
jennypavlova authored Aug 2, 2023
1 parent f2d4120 commit 446f894
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions x-pack/test/functional/apps/infra/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');

// Failing: See https://github.com/elastic/kibana/issues/157711
describe.skip('Home page', function () {
describe('Home page', function () {
this.tags('includeFirefox');
before(async () => {
await kibanaServer.savedObjects.cleanStandardList();
Expand Down Expand Up @@ -225,8 +224,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/157740
describe.skip('Saved Views', () => {
describe('Saved Views', () => {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs');
await pageObjects.infraHome.goToMetricExplorer();
Expand Down
4 changes: 2 additions & 2 deletions x-pack/test/functional/page_objects/infra_home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,15 @@ export function InfraHomePageProvider({ getService, getPageObjects }: FtrProvide
await testSubjects.click('infrastructure-alerts-and-rules');
await testSubjects.click('inventory-alerts-menu-option');
await testSubjects.click('inventory-alerts-create-rule');
await testSubjects.missingOrFail('inventory-alerts-create-rule');
await testSubjects.missingOrFail('inventory-alerts-create-rule', { timeout: 30000 });
await testSubjects.find('euiFlyoutCloseButton');
},

async openMetricsThresholdAlertFlyout() {
await testSubjects.click('infrastructure-alerts-and-rules');
await testSubjects.click('metrics-threshold-alerts-menu-option');
await testSubjects.click('metrics-threshold-alerts-create-rule');
await testSubjects.missingOrFail('metrics-threshold-alerts-create-rule');
await testSubjects.missingOrFail('metrics-threshold-alerts-create-rule', { timeout: 30000 });
await testSubjects.find('euiFlyoutCloseButton');
},

Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/page_objects/infra_saved_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function InfraSavedViewsProvider({ getService }: FtrProviderContext) {
async createNewSavedView(name: string) {
await testSubjects.setValue('savedViewName', name);
await testSubjects.click('createSavedViewButton');

await testSubjects.missingOrFail('createSavedViewButton', { timeout: 20000 });
await retry.tryForTime(10 * 1000, async () => {
await testSubjects.missingOrFail('savedViews-upsertModal');
});
Expand Down

0 comments on commit 446f894

Please sign in to comment.