Skip to content

Commit 8b843d0

Browse files
committed
remove hard coded timeouts
1 parent 8caa012 commit 8b843d0

File tree

27 files changed

+220
-71
lines changed

27 files changed

+220
-71
lines changed

packages/kbn-test/src/functional_test_runner/lib/config/schema.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ export const schema = Joi.object()
9898
try: Joi.number().default(120000),
9999
waitFor: Joi.number().default(20000),
100100
esRequestTimeout: Joi.number().default(30000),
101-
kibanaStabilize: Joi.number().default(15000),
102-
navigateStatusPageCheck: Joi.number().default(250),
103101

104102
// Many of our tests use the `exists` functions to determine where the user is. For
105103
// example, you'll see a lot of code like:

test/functional/page_objects/dashboard_page.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide
2828
const log = getService('log');
2929
const find = getService('find');
3030
const retry = getService('retry');
31+
const config = getService('config');
3132
const browser = getService('browser');
3233
const esArchiver = getService('esArchiver');
3334
const kibanaServer = getService('kibanaServer');
@@ -114,7 +115,7 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide
114115
public async onDashboardLandingPage() {
115116
log.debug(`onDashboardLandingPage`);
116117
return await testSubjects.exists('dashboardLandingPage', {
117-
timeout: 5000,
118+
timeout: config.get('timeouts.waitForExits') * 2,
118119
});
119120
}
120121

@@ -362,7 +363,9 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide
362363
await listingTable.clickItemLink('dashboard', dashboardName);
363364
await PageObjects.header.waitUntilLoadingHasFinished();
364365
// check Dashboard landing page is not present
365-
await testSubjects.missingOrFail('dashboardLandingPage', { timeout: 10000 });
366+
await testSubjects.missingOrFail('dashboardLandingPage', {
367+
timeout: config.get('timeouts.waitForExits') * 5,
368+
});
366369
});
367370
}
368371

@@ -497,7 +500,7 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide
497500
for (const name of vizList) {
498501
const isPresent = await testSubjects.exists(
499502
`embeddablePanelHeading-${name.replace(/\s+/g, '')}`,
500-
{ timeout: 10000 }
503+
{ timeout: config.get('timeouts.waitForExits') * 5 }
501504
);
502505
checkList.push({ name, isPresent });
503506
}

test/functional/page_objects/header_page.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
7979

8080
async isGlobalLoadingIndicatorVisible() {
8181
log.debug('isGlobalLoadingIndicatorVisible');
82-
return await testSubjects.exists('globalLoadingIndicator', { timeout: 1500 });
82+
return await testSubjects.exists('globalLoadingIndicator', {
83+
timeout: config.get('timeouts.waitForExits') * 0.6,
84+
});
8385
}
8486

8587
async awaitGlobalLoadingIndicatorHidden() {

test/functional/page_objects/home_page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
2222
export function HomePageProvider({ getService, getPageObjects }: FtrProviderContext) {
2323
const testSubjects = getService('testSubjects');
2424
const retry = getService('retry');
25+
const config = getService('config');
2526
const find = getService('find');
2627
const PageObjects = getPageObjects(['common']);
2728
let isOss = true;
@@ -83,7 +84,7 @@ export function HomePageProvider({ getService, getPageObjects }: FtrProviderCont
8384
await retry.try(async () => {
8485
await testSubjects.click('loadSavedObjects');
8586
const successMsgExists = await testSubjects.exists('loadSavedObjects_success', {
86-
timeout: 5000,
87+
timeout: config.get('timeouts.waitForExits') * 2,
8788
});
8889
if (!successMsgExists) {
8990
throw new Error('Failed to load saved objects');

test/functional/page_objects/settings_page.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
2525
export function SettingsPageProvider({ getService, getPageObjects }: FtrProviderContext) {
2626
const log = getService('log');
2727
const retry = getService('retry');
28+
const config = getService('config');
2829
const browser = getService('browser');
2930
const find = getService('find');
3031
const flyout = getService('flyout');
@@ -298,12 +299,16 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider
298299
}
299300

300301
async getIndexPatternList() {
301-
await testSubjects.existOrFail('indexPatternTable', { timeout: 5000 });
302+
await testSubjects.existOrFail('indexPatternTable', {
303+
timeout: config.get('timeouts.waitForExits') * 2,
304+
});
302305
return await find.allByCssSelector('[data-test-subj="indexPatternTable"] .euiTable a');
303306
}
304307

305308
async isIndexPatternListEmpty() {
306-
await testSubjects.existOrFail('indexPatternTable', { timeout: 5000 });
309+
await testSubjects.existOrFail('indexPatternTable', {
310+
timeout: config.get('timeouts.waitForExits') * 2,
311+
});
307312
const indexPatternList = await this.getIndexPatternList();
308313
return indexPatternList.length === 0;
309314
}
@@ -629,23 +634,33 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider
629634
}
630635

631636
async checkImportSucceeded() {
632-
await testSubjects.existOrFail('importSavedObjectsSuccess', { timeout: 20000 });
637+
await testSubjects.existOrFail('importSavedObjectsSuccess', {
638+
timeout: config.get('timeouts.waitForExits') * 10,
639+
});
633640
}
634641

635642
async checkNoneImported() {
636-
await testSubjects.existOrFail('importSavedObjectsSuccessNoneImported', { timeout: 20000 });
643+
await testSubjects.existOrFail('importSavedObjectsSuccessNoneImported', {
644+
timeout: config.get('timeouts.waitForExits') * 10,
645+
});
637646
}
638647

639648
async checkImportConflictsWarning() {
640-
await testSubjects.existOrFail('importSavedObjectsConflictsWarning', { timeout: 20000 });
649+
await testSubjects.existOrFail('importSavedObjectsConflictsWarning', {
650+
timeout: config.get('timeouts.waitForExits') * 10,
651+
});
641652
}
642653

643654
async checkImportLegacyWarning() {
644-
await testSubjects.existOrFail('importSavedObjectsLegacyWarning', { timeout: 20000 });
655+
await testSubjects.existOrFail('importSavedObjectsLegacyWarning', {
656+
timeout: config.get('timeouts.waitForExits') * 10,
657+
});
645658
}
646659

647660
async checkImportFailedWarning() {
648-
await testSubjects.existOrFail('importSavedObjectsFailedWarning', { timeout: 20000 });
661+
await testSubjects.existOrFail('importSavedObjectsFailedWarning', {
662+
timeout: config.get('timeouts.waitForExits') * 10,
663+
});
649664
}
650665

651666
async clickImportDone() {

test/functional/page_objects/time_picker.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function TimePickerPageProvider({ getService, getPageObjects }) {
2323
const log = getService('log');
2424
const retry = getService('retry');
2525
const find = getService('find');
26+
const config = getService('config');
2627
const browser = getService('browser');
2728
const testSubjects = getService('testSubjects');
2829
const PageObjects = getPageObjects(['header', 'common']);
@@ -157,7 +158,9 @@ export function TimePickerPageProvider({ getService, getPageObjects }) {
157158

158159
async showStartEndTimes() {
159160
// This first await makes sure the superDatePicker has loaded before we check for the ShowDatesButton
160-
await testSubjects.exists('superDatePickerToggleQuickMenuButton', { timeout: 20000 });
161+
await testSubjects.exists('superDatePickerToggleQuickMenuButton', {
162+
timeout: config.get('timeouts.waitForExits') * 10,
163+
});
161164
const isShowDatesButton = await testSubjects.exists('superDatePickerShowDatesButton');
162165
if (isShowDatesButton) {
163166
await testSubjects.click('superDatePickerShowDatesButton');

test/functional/page_objects/visual_builder_page.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
2424
const find = getService('find');
2525
const log = getService('log');
2626
const retry = getService('retry');
27+
const config = getService('config');
2728
const testSubjects = getService('testSubjects');
2829
const comboBox = getService('comboBox');
2930
const PageObjects = getPageObjects(['common', 'header', 'visualize', 'timePicker', 'visChart']);
@@ -54,7 +55,9 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
5455
}
5556

5657
public async checkTabIsLoaded(testSubj: string, name: string) {
57-
const isPresent = await testSubjects.exists(testSubj, { timeout: 10000 });
58+
const isPresent = await testSubjects.exists(testSubj, {
59+
timeout: config.get('timeouts.waitForExits') * 5,
60+
});
5861
if (!isPresent) {
5962
throw new Error(`TSVB ${name} tab is not loaded`);
6063
}
@@ -503,7 +506,9 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
503506

504507
public async checkColorPickerPopUpIsPresent(): Promise<void> {
505508
log.debug(`Check color picker popup is present`);
506-
await testSubjects.existOrFail('tvbColorPickerPopUp', { timeout: 5000 });
509+
await testSubjects.existOrFail('tvbColorPickerPopUp', {
510+
timeout: config.get('timeouts.waitForExits') * 2,
511+
});
507512
}
508513

509514
public async changePanelPreview(nth: number = 0): Promise<void> {
@@ -515,7 +520,9 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
515520

516521
public async checkPreviewIsDisabled(): Promise<void> {
517522
log.debug(`Check no data message is present`);
518-
await testSubjects.existOrFail('noTSVBDataMessage', { timeout: 5000 });
523+
await testSubjects.existOrFail('noTSVBDataMessage', {
524+
timeout: config.get('timeouts.waitForExits') * 2,
525+
});
519526
}
520527

521528
public async cloneSeries(nth: number = 0): Promise<void> {

test/functional/page_objects/visualize_page.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { VisualizeConstants } from '../../../src/legacy/core_plugins/kibana/publ
2222

2323
export function VisualizePageProvider({ getService, getPageObjects }: FtrProviderContext) {
2424
const testSubjects = getService('testSubjects');
25+
const config = getService('config');
2526
const retry = getService('retry');
2627
const find = getService('find');
2728
const log = getService('log');
@@ -216,7 +217,9 @@ export function VisualizePageProvider({ getService, getPageObjects }: FtrProvide
216217
public async ensureSavePanelOpen() {
217218
log.debug('ensureSavePanelOpen');
218219
await header.waitUntilLoadingHasFinished();
219-
const isOpen = await testSubjects.exists('savedObjectSaveModal', { timeout: 5000 });
220+
const isOpen = await testSubjects.exists('savedObjectSaveModal', {
221+
timeout: config.get('timeouts.waitForExits') * 2,
222+
});
220223
if (!isOpen) {
221224
await testSubjects.click('visualizeSaveButton');
222225
}

test/functional/services/flyout.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
2121

2222
export function FlyoutProvider({ getService }: FtrProviderContext) {
2323
const testSubjects = getService('testSubjects');
24+
const config = getService('config');
2425
const find = getService('find');
2526
const log = getService('log');
2627
const retry = getService('retry');
@@ -33,12 +34,19 @@ export function FlyoutProvider({ getService }: FtrProviderContext) {
3334
await closeBtn.click();
3435
await retry.waitFor(
3536
'flyout closed',
36-
async () => !(await testSubjects.exists(dataTestSubj, { timeout: 1000 }))
37+
async () =>
38+
!(await testSubjects.exists(dataTestSubj, {
39+
timeout: config.get('timeouts.waitForExits') * 0.4,
40+
}))
3741
);
3842
}
3943

4044
public async ensureClosed(dataTestSubj: string): Promise<void> {
41-
if (await testSubjects.exists(dataTestSubj, { timeout: 1000 })) {
45+
if (
46+
await testSubjects.exists(dataTestSubj, {
47+
timeout: config.get('timeouts.waitForExits') * 0.4,
48+
})
49+
) {
4250
await this.close(dataTestSubj);
4351
}
4452
}

test/plugin_functional/test_suites/core_plugins/rendering.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ declare global {
3636
export default function({ getService, getPageObjects }: PluginFunctionalProviderContext) {
3737
const PageObjects = getPageObjects(['common']);
3838
const appsMenu = getService('appsMenu');
39+
const config = getService('config');
3940
const browser = getService('browser');
4041
const find = getService('find');
4142
const testSubjects = getService('testSubjects');
@@ -62,7 +63,8 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider
6263
return JSON.parse(document.querySelector('kbn-injected-metadata')!.getAttribute('data')!)
6364
.legacyMetadata.uiSettings.user;
6465
});
65-
const exists = (selector: string) => testSubjects.exists(selector, { timeout: 5000 });
66+
const exists = (selector: string) =>
67+
testSubjects.exists(selector, { timeout: config.get('timeouts.waitForExits') * 2 });
6668
const findLoadingMessage = () => testSubjects.find('kbnLoadingMessage', 5000);
6769
const getRenderingSession = () =>
6870
browser.execute(() => {

0 commit comments

Comments
 (0)