[8.4] [ftr/testSubjects/clickOnEnabled] retry on stale-element exceptions (#139964) (#140324)

* [ftr/testSubjects/clickOnEnabled] retry on stale-element exceptions (#139964)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 5adda1f63b)

# Conflicts:
#	test/functional/page_objects/settings_page.ts
#	test/functional/services/filter_bar.ts
#	x-pack/test/functional/services/ml/lens_visualizations.ts

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Spencer 2022-09-08 13:43:53 -05:00 committed by GitHub
parent 3fee982178
commit dc5e02e5a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 203 additions and 102 deletions

View file

@ -92,7 +92,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
log.debug(`expanded document id: ${expandDocId}`);
await dataGrid.clickRowToggle();
await find.clickByCssSelectorWhenNotDisabled('#kbn_doc_viewer_tab_1');
await find.clickByCssSelectorWhenNotDisabledWithoutRetry('#kbn_doc_viewer_tab_1');
await retry.waitForWithTimeout(
'document id in flyout matching the expanded document id',
@ -140,7 +140,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
log.debug(`expanded document id: ${expandDocId}`);
await dataGrid.clickRowToggle();
await find.clickByCssSelectorWhenNotDisabled('#kbn_doc_viewer_tab_1');
await find.clickByCssSelectorWhenNotDisabledWithoutRetry('#kbn_doc_viewer_tab_1');
await retry.waitForWithTimeout(
'document id in flyout matching the expanded document id',

View file

@ -436,7 +436,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('interval errors', () => {
before(async () => {
// to trigger displaying of error messages
await testSubjects.clickWhenNotDisabled('visualizeEditorRenderButton');
await testSubjects.clickWhenNotDisabledWithoutRetry('visualizeEditorRenderButton');
// this will avoid issues with the play tooltip covering the interval field
await testSubjects.scrollIntoView('advancedParams-2');
});
@ -520,7 +520,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.visEditor.setInterval('Millisecond');
// Apply interval
await testSubjects.clickWhenNotDisabled('visualizeEditorRenderButton');
await testSubjects.clickWhenNotDisabledWithoutRetry('visualizeEditorRenderButton');
const isHelperScaledLabelExists = await find.existsByCssSelector(
'[data-test-subj="currentlyScaledText"]'
@ -537,7 +537,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should update scaled label text after custom interval is set and time range is changed', async () => {
await PageObjects.visEditor.setInterval('10s', { type: 'custom' });
await testSubjects.clickWhenNotDisabled('visualizeEditorRenderButton');
await testSubjects.clickWhenNotDisabledWithoutRetry('visualizeEditorRenderButton');
const isHelperScaledLabelExists = await find.existsByCssSelector(
'[data-test-subj="currentlyScaledText"]'
);

View file

@ -649,7 +649,7 @@ export class DiscoverPageObject extends FtrService {
public async clickViewModeFieldStatsButton() {
await this.retry.tryForTime(2 * 1000, async () => {
await this.testSubjects.existOrFail('dscViewModeFieldStatsButton');
await this.testSubjects.clickWhenNotDisabled('dscViewModeFieldStatsButton');
await this.testSubjects.clickWhenNotDisabledWithoutRetry('dscViewModeFieldStatsButton');
await this.testSubjects.existOrFail('dscFieldStatsEmbeddedContent');
});
}

View file

@ -306,7 +306,7 @@ export class SettingsPageObject extends FtrService {
}
async clearFieldTypeFilter(type: string) {
await this.testSubjects.clickWhenNotDisabled('indexedFieldTypeFilterDropdown');
await this.testSubjects.clickWhenNotDisabledWithoutRetry('indexedFieldTypeFilterDropdown');
await this.retry.try(async () => {
await this.testSubjects.existOrFail('indexedFieldTypeFilterDropdown-popover');
});
@ -319,7 +319,7 @@ export class SettingsPageObject extends FtrService {
}
async setFieldTypeFilter(type: string) {
await this.testSubjects.clickWhenNotDisabled('indexedFieldTypeFilterDropdown');
await this.testSubjects.clickWhenNotDisabledWithoutRetry('indexedFieldTypeFilterDropdown');
await this.testSubjects.existOrFail('indexedFieldTypeFilterDropdown-popover');
await this.testSubjects.existOrFail(`indexedFieldTypeFilterDropdown-option-${type}`);
await this.testSubjects.click(`indexedFieldTypeFilterDropdown-option-${type}`);
@ -328,7 +328,7 @@ export class SettingsPageObject extends FtrService {
}
async clearScriptedFieldLanguageFilter(type: string) {
await this.testSubjects.clickWhenNotDisabled('scriptedFieldLanguageFilterDropdown');
await this.testSubjects.clickWhenNotDisabledWithoutRetry('scriptedFieldLanguageFilterDropdown');
await this.retry.try(async () => {
await this.testSubjects.existOrFail('scriptedFieldLanguageFilterDropdown-popover');
});
@ -344,7 +344,9 @@ export class SettingsPageObject extends FtrService {
async setScriptedFieldLanguageFilter(language: string) {
await this.retry.try(async () => {
await this.testSubjects.clickWhenNotDisabled('scriptedFieldLanguageFilterDropdown');
await this.testSubjects.clickWhenNotDisabledWithoutRetry(
'scriptedFieldLanguageFilterDropdown'
);
return await this.find.byCssSelector('div.euiPopover__panel-isOpen');
});
await this.testSubjects.existOrFail('scriptedFieldLanguageFilterDropdown-popover');

View file

@ -265,7 +265,7 @@ export class VisualBuilderPageObject extends FtrService {
}
public async applyChanges() {
await this.testSubjects.clickWhenNotDisabled('applyBtn');
await this.testSubjects.clickWhenNotDisabledWithoutRetry('applyBtn');
}
/**

View file

@ -59,7 +59,7 @@ export class VisualizeEditorPageObject extends FtrService {
}
public async inputControlSubmit() {
await this.testSubjects.clickWhenNotDisabled('inputControlSubmitBtn');
await this.testSubjects.clickWhenNotDisabledWithoutRetry('inputControlSubmitBtn');
await this.visChart.waitForVisualizationRenderingStabilized();
}
@ -70,7 +70,7 @@ export class VisualizeEditorPageObject extends FtrService {
const prevRenderingCount = await this.visChart.getVisualizationRenderingCount();
this.log.debug(`Before Rendering count ${prevRenderingCount}`);
await this.testSubjects.clickWhenNotDisabled('visualizeEditorRenderButton');
await this.testSubjects.clickWhenNotDisabledWithoutRetry('visualizeEditorRenderButton');
await this.visChart.waitForRenderingCount(prevRenderingCount + 1);
}

View file

@ -10,7 +10,9 @@ import { WebDriver, WebElement, By, until } from 'selenium-webdriver';
import { Browsers } from '../remote/browsers';
import { FtrService, FtrProviderContext } from '../../ftr_provider_context';
import { retryOnStale } from './retry_on_stale';
import { WebElementWrapper } from '../lib/web_element_wrapper';
import { TimeoutOpt } from './types';
export class FindService extends FtrService {
private readonly log = this.ctx.getService('log');
@ -285,16 +287,33 @@ export class FindService extends FtrService {
}, timeout);
}
public async clickByCssSelectorWhenNotDisabled(
public async clickByCssSelectorWhenNotDisabled(selector: string, opts?: TimeoutOpt) {
const timeout = opts?.timeout ?? this.defaultFindTimeout;
await retryOnStale(this.log, async () => {
this.log.debug(`Find.clickByCssSelectorWhenNotDisabled(${selector}, timeout=${timeout})`);
const element = await this.byCssSelector(selector);
await element.moveMouseTo();
await this.driver.wait(until.elementIsEnabled(element._webElement), timeout);
await element.click();
});
}
public async clickByCssSelectorWhenNotDisabledWithoutRetry(
selector: string,
{ timeout } = { timeout: this.defaultFindTimeout }
opts?: TimeoutOpt
): Promise<void> {
this.log.debug(`Find.clickByCssSelectorWhenNotDisabled('${selector}') with timeout=${timeout}`);
const timeout = opts?.timeout ?? this.defaultFindTimeout;
this.log.debug(
`Find.clickByCssSelectorWhenNotDisabledWithoutRetry(${selector}, timeout=${timeout})`
);
// Don't wrap this code in a retry, or stale element checks may get caught here and the element
// will never be re-grabbed. Let errors bubble, but continue checking for disabled property until
// it's gone.
const element = await this.byCssSelector(selector, timeout);
const element = await this.byCssSelector(selector);
await element.moveMouseTo();
await this.driver.wait(until.elementIsEnabled(element._webElement), timeout);
await element.click();

View file

@ -0,0 +1,35 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { ToolingLog } from '@kbn/tooling-log';
const MAX_ATTEMPTS = 10;
const isObj = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null;
const errMsg = (err: unknown) => (isObj(err) && typeof err.message === 'string' ? err.message : '');
export async function retryOnStale<T>(log: ToolingLog, fn: () => Promise<T>): Promise<T> {
let attempt = 0;
while (true) {
attempt += 1;
try {
return await fn();
} catch (error) {
if (errMsg(error).includes('stale element reference')) {
if (attempt >= MAX_ATTEMPTS) {
throw new Error(`retryOnStale ran out of attempts after ${attempt} tries`);
}
log.warning('stale element exception caught, retrying');
continue;
}
throw error;
}
}
}

View file

@ -9,6 +9,7 @@
import testSubjSelector from '@kbn/test-subj-selector';
import { WebElementWrapper } from '../lib/web_element_wrapper';
import { FtrService } from '../../ftr_provider_context';
import { TimeoutOpt } from './types';
interface ExistsOptions {
timeout?: number;
@ -85,14 +86,33 @@ export class TestSubjects extends FtrService {
await input.type(text);
}
public async clickWhenNotDisabled(
selector: string,
{ timeout = this.FIND_TIME }: { timeout?: number } = {}
): Promise<void> {
/**
* Clicks on the element identified by the testSubject selector. If the retries
* automatically on "stale element" errors unlike clickWhenNotDisabledWithoutRetry.
* `opts.timeout` defaults to the 'timeouts.find' config, which defaults to 10 seconds
*/
public async clickWhenNotDisabled(selector: string, opts?: TimeoutOpt) {
this.log.debug(`TestSubjects.clickWhenNotDisabled(${selector})`);
await this.findService.clickByCssSelectorWhenNotDisabled(testSubjSelector(selector), {
timeout,
});
await this.findService.clickByCssSelectorWhenNotDisabled(testSubjSelector(selector), opts);
}
/**
* Clicks on the element identified by the testSubject selector. Somewhat surprisingly,
* this method allows `stale element` errors to propogate, which is why it was renamed
* from `clickWhenNotDisabled()` and that method was re-implemented to be more consistent
* with the rest of the functions in this service.
*
* `opts.timeout` defaults to the 'timeouts.find' config, which defaults to 10 seconds
*/
public async clickWhenNotDisabledWithoutRetry(
selector: string,
opts?: TimeoutOpt
): Promise<void> {
this.log.debug(`TestSubjects.clickWhenNotDisabledWithoutRetry(${selector})`);
await this.findService.clickByCssSelectorWhenNotDisabledWithoutRetry(
testSubjSelector(selector),
opts
);
}
public async click(

View file

@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export interface TimeoutOpt {
timeout?: number;
}

View file

@ -79,7 +79,7 @@ export class DashboardPanelActionsService extends FtrService {
await this.openContextMenu();
const isActionVisible = await this.testSubjects.exists(EDIT_PANEL_DATA_TEST_SUBJ);
if (!isActionVisible) await this.clickContextMenuMoreItem();
await this.testSubjects.clickWhenNotDisabled(EDIT_PANEL_DATA_TEST_SUBJ);
await this.testSubjects.clickWhenNotDisabledWithoutRetry(EDIT_PANEL_DATA_TEST_SUBJ);
await this.header.waitUntilLoadingHasFinished();
await this.common.waitForTopNavToBeVisible();
}
@ -92,7 +92,7 @@ export class DashboardPanelActionsService extends FtrService {
} else {
await this.openContextMenu();
}
await this.testSubjects.clickWhenNotDisabled(EDIT_PANEL_DATA_TEST_SUBJ);
await this.testSubjects.clickWhenNotDisabledWithoutRetry(EDIT_PANEL_DATA_TEST_SUBJ);
}
async clickExpandPanelToggle() {

View file

@ -53,14 +53,18 @@ export class FieldEditorService extends FtrService {
public async confirmSave() {
await this.retry.try(async () => {
await this.testSubjects.setValue('saveModalConfirmText', 'change');
await this.testSubjects.clickWhenNotDisabled('confirmModalConfirmButton', { timeout: 1000 });
await this.testSubjects.clickWhenNotDisabledWithoutRetry('confirmModalConfirmButton', {
timeout: 1000,
});
});
}
public async confirmDelete() {
await this.retry.try(async () => {
await this.testSubjects.setValue('deleteModalConfirmText', 'remove');
await this.testSubjects.clickWhenNotDisabled('confirmModalConfirmButton', { timeout: 1000 });
await this.testSubjects.clickWhenNotDisabledWithoutRetry('confirmModalConfirmButton', {
timeout: 1000,
});
});
}
}

View file

@ -38,7 +38,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should start search, save session, restore session using "restore" button', async () => {
await comboBox.setCustom('dataViewSelector', 'logstash-*');
await comboBox.setCustom('searchMetricField', 'bytes');
await testSubjects.clickWhenNotDisabled('startSearch');
await testSubjects.clickWhenNotDisabledWithoutRetry('startSearch');
await testSubjects.find('searchResults-1');
await searchSessions.expectState('completed');
await searchSessions.save();

View file

@ -47,7 +47,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
it('navigates to Discover app on action click carrying over pie slice filter', async () => {
await testSubjects.clickWhenNotDisabled(ACTION_TEST_SUBJ);
await testSubjects.clickWhenNotDisabledWithoutRetry(ACTION_TEST_SUBJ);
await discover.waitForDiscoverAppOnScreen();
await filterBar.hasFilter('memory', '160,000 to 200,000');
const filterCount = await filterBar.getFilterCount();
@ -88,7 +88,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
it('navigates to Discover on click carrying over brushed time range', async () => {
await testSubjects.clickWhenNotDisabled(ACTION_TEST_SUBJ);
await testSubjects.clickWhenNotDisabledWithoutRetry(ACTION_TEST_SUBJ);
await discover.waitForDiscoverAppOnScreen();
const newTimeRangeDurationHours = await timePicker.getTimeDurationInHours();

View file

@ -64,7 +64,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
it('navigates to Discover app to index pattern of the panel on action click', async () => {
await testSubjects.clickWhenNotDisabled(ACTION_TEST_SUBJ);
await testSubjects.clickWhenNotDisabledWithoutRetry(ACTION_TEST_SUBJ);
await discover.waitForDiscoverAppOnScreen();
const el = await testSubjects.find('discover-dataView-switch-link');
@ -87,7 +87,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.saveDashboard('Dashboard with Pie Chart');
await panelActions.openContextMenu();
await testSubjects.clickWhenNotDisabled(ACTION_TEST_SUBJ);
await testSubjects.clickWhenNotDisabledWithoutRetry(ACTION_TEST_SUBJ);
await discover.waitForDiscoverAppOnScreen();
const text = await timePicker.getShowDatesButtonText();

View file

@ -552,7 +552,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
);
// check the JSON tab
await find.clickByCssSelectorWhenNotDisabled('#kbn_doc_viewer_tab_1');
await find.clickByCssSelectorWhenNotDisabledWithoutRetry('#kbn_doc_viewer_tab_1');
await retry.waitForWithTimeout(
'index in flyout JSON tab is matching the logstash index',
5000,

View file

@ -35,7 +35,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// expect the button is shown and enabled
await testSubjects.clickWhenNotDisabled(`lnsApp_openInDiscover`);
await testSubjects.clickWhenNotDisabledWithoutRetry(`lnsApp_openInDiscover`);
const [lensWindowHandler, discoverWindowHandle] = await browser.getAllWindowHandles();
await browser.switchToWindow(discoverWindowHandle);
@ -62,7 +62,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.lens.waitForVisualization('xyVisChart');
// expect the button is shown and enabled
await testSubjects.clickWhenNotDisabled(`lnsApp_openInDiscover`);
await testSubjects.clickWhenNotDisabledWithoutRetry(`lnsApp_openInDiscover`);
const [lensWindowHandler, discoverWindowHandle] = await browser.getAllWindowHandles();
await browser.switchToWindow(discoverWindowHandle);
@ -98,7 +98,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.lens.waitForVisualization('xyVisChart');
await testSubjects.clickWhenNotDisabled(`lnsApp_openInDiscover`);
await testSubjects.clickWhenNotDisabledWithoutRetry(`lnsApp_openInDiscover`);
const [lensWindowHandler, discoverWindowHandle] = await browser.getAllWindowHandles();
await browser.switchToWindow(discoverWindowHandle);
@ -134,7 +134,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.lens.waitForVisualization('xyVisChart');
// expect the button is shown and enabled
await testSubjects.clickWhenNotDisabled(`lnsApp_openInDiscover`);
await testSubjects.clickWhenNotDisabledWithoutRetry(`lnsApp_openInDiscover`);
const [lensWindowHandler, discoverWindowHandle] = await browser.getAllWindowHandles();
await browser.switchToWindow(discoverWindowHandle);
@ -169,7 +169,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.lens.waitForVisualization('xyVisChart');
// expect the button is shown and enabled
await testSubjects.clickWhenNotDisabled(`lnsApp_openInDiscover`);
await testSubjects.clickWhenNotDisabledWithoutRetry(`lnsApp_openInDiscover`);
const [lensWindowHandler, discoverWindowHandle] = await browser.getAllWindowHandles();
await browser.switchToWindow(discoverWindowHandle);

View file

@ -171,7 +171,7 @@ export class GisPageObject extends FtrService {
}
await this.testSubjects.click('savedObjectTitle');
}
await this.testSubjects.clickWhenNotDisabled('confirmSaveSavedObjectButton');
await this.testSubjects.clickWhenNotDisabledWithoutRetry('confirmSaveSavedObjectButton');
await this.header.waitUntilLoadingHasFinished();
}

View file

@ -1350,7 +1350,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
async typeFormula(formula: string) {
await find.byCssSelector('.monaco-editor');
await find.clickByCssSelectorWhenNotDisabled('.monaco-editor');
await find.clickByCssSelectorWhenNotDisabledWithoutRetry('.monaco-editor');
const input = await find.activeElement();
await input.clearValueWithKeyboard({ charByChar: true });
await input.type(formula);

View file

@ -32,8 +32,10 @@ export function ExplainLogRateSpikesProvider({ getService }: FtrProviderContext)
async clickUseFullDataButton(expectedFormattedTotalDocCount: string) {
await retry.tryForTime(30 * 1000, async () => {
await testSubjects.clickWhenNotDisabled('aiopsExplainLogRatesSpikeButtonUseFullData');
await testSubjects.clickWhenNotDisabled('superDatePickerApplyTimeButton');
await testSubjects.clickWhenNotDisabledWithoutRetry(
'aiopsExplainLogRatesSpikeButtonUseFullData'
);
await testSubjects.clickWhenNotDisabledWithoutRetry('superDatePickerApplyTimeButton');
await this.assertTotalDocumentCount(expectedFormattedTotalDocCount);
});
},
@ -72,7 +74,7 @@ export function ExplainLogRateSpikesProvider({ getService }: FtrProviderContext)
},
async clickRerunAnalysisButton(shouldRerun: boolean) {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
`aiopsRerunAnalysisButton${shouldRerun ? ' shouldRerun' : ''}`
);

View file

@ -29,7 +29,7 @@ export function DashboardDrilldownPanelActionsProvider({ getService }: FtrProvid
async clickCreateDrilldown() {
log.debug('clickCreateDrilldown');
await this.expectExistsCreateDrilldownAction();
await testSubjects.clickWhenNotDisabled(CREATE_DRILLDOWN_DATA_TEST_SUBJ);
await testSubjects.clickWhenNotDisabledWithoutRetry(CREATE_DRILLDOWN_DATA_TEST_SUBJ);
}
async expectExistsManageDrilldownsAction() {
@ -45,7 +45,7 @@ export function DashboardDrilldownPanelActionsProvider({ getService }: FtrProvid
async clickManageDrilldowns() {
log.debug('clickManageDrilldowns');
await this.expectExistsManageDrilldownsAction();
await testSubjects.clickWhenNotDisabled(MANAGE_DRILLDOWNS_DATA_TEST_SUBJ);
await testSubjects.clickWhenNotDisabledWithoutRetry(MANAGE_DRILLDOWNS_DATA_TEST_SUBJ);
}
async expectMultipleActionsMenuOpened() {

View file

@ -89,7 +89,7 @@ export function MachineLearningAnomalyExplorerProvider({
async addAndEditSwimlaneInDashboard(dashboardTitle: string) {
await retry.tryForTime(30 * 1000, async () => {
await this.filterDashboardSearchWithSearchString(dashboardTitle);
await testSubjects.clickWhenNotDisabled('~mlEmbeddableAddAndEditDashboard');
await testSubjects.clickWhenNotDisabledWithoutRetry('~mlEmbeddableAddAndEditDashboard');
// make sure the dashboard page actually loaded
const dashboardItemCount = await dashboardPage.getSharedItemsCount();

View file

@ -164,7 +164,7 @@ export function MachineLearningCommonUIProvider({
},
async setMultiSelectFilter(testDataSubj: string, fieldTypes: string[]) {
await testSubjects.clickWhenNotDisabled(`${testDataSubj}-button`);
await testSubjects.clickWhenNotDisabledWithoutRetry(`${testDataSubj}-button`);
await testSubjects.existOrFail(`${testDataSubj}-popover`);
await testSubjects.existOrFail(`${testDataSubj}-searchInput`);
const searchBarInput = await testSubjects.find(`${testDataSubj}-searchInput`);
@ -186,7 +186,7 @@ export function MachineLearningCommonUIProvider({
},
async removeMultiSelectFilter(testDataSubj: string, fieldTypes: string[]) {
await testSubjects.clickWhenNotDisabled(`${testDataSubj}-button`);
await testSubjects.clickWhenNotDisabledWithoutRetry(`${testDataSubj}-button`);
await testSubjects.existOrFail(`${testDataSubj}-popover`);
await testSubjects.existOrFail(`${testDataSubj}-searchInput`);
const searchBarInput = await testSubjects.find(`${testDataSubj}-searchInput`);

View file

@ -59,7 +59,7 @@ export function MachineLearningDashboardEmbeddablesProvider(
const subj = 'mlAnomalyChartsInitializerConfirmButton';
await retry.tryForTime(60 * 1000, async () => {
await this.assertInitializerConfirmButtonEnabled();
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
await this.assertAnomalyChartsEmbeddableInitializerNotExists();
});
},

View file

@ -65,7 +65,7 @@ export function MachineLearningDashboardJobSelectionTableProvider({
const subj = this.rowSelector(jobId, `${jobId}-checkbox`);
if ((await this.getRowCheckboxCheckedState(jobId)) !== expectCheckedState) {
await retry.tryForTime(5 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
await this.assertRowCheckboxCheckedState(jobId, expectCheckedState);
});
}
@ -79,7 +79,7 @@ export function MachineLearningDashboardJobSelectionTableProvider({
async applyJobSelection() {
const subj = 'mlFlyoutJobSelectorButtonApply';
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
await this.assertJobSelectionTableNotExists();
},
};

View file

@ -287,7 +287,7 @@ export function MachineLearningDataFrameAnalyticsCreationProvider(
const subj = 'mlDataFrameAnalyticsRuntimeMappingsEditorSwitch';
if ((await this.getRuntimeMappingsEditorSwitchCheckedState()) !== toggle) {
await retry.tryForTime(5 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
await this.assertRuntimeMappingsEditorSwitchCheckState(toggle);
});
}
@ -316,7 +316,7 @@ export function MachineLearningDataFrameAnalyticsCreationProvider(
async applyRuntimeMappings() {
const subj = 'mlDataFrameAnalyticsRuntimeMappingsApplyButton';
await testSubjects.existOrFail(subj);
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
const isEnabled = await testSubjects.isEnabled(subj);
expect(isEnabled).to.eql(
false,
@ -466,7 +466,7 @@ export function MachineLearningDataFrameAnalyticsCreationProvider(
async continueToAdditionalOptionsStep() {
await retry.tryForTime(15 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
'mlAnalyticsCreateJobWizardConfigurationStep active > mlAnalyticsCreateJobWizardContinueButton'
);
await this.assertAdditionalOptionsStepActive();
@ -475,7 +475,7 @@ export function MachineLearningDataFrameAnalyticsCreationProvider(
async continueToDetailsStep() {
await retry.tryForTime(15 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
'mlAnalyticsCreateJobWizardAdvancedStep active > mlAnalyticsCreateJobWizardContinueButton'
);
await this.assertDetailsStepActive();
@ -484,7 +484,7 @@ export function MachineLearningDataFrameAnalyticsCreationProvider(
async continueToValidationStep() {
await retry.tryForTime(15 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
'mlAnalyticsCreateJobWizardDetailsStep active > mlAnalyticsCreateJobWizardContinueButton'
);
await this.assertValidationStepActive();
@ -504,7 +504,7 @@ export function MachineLearningDataFrameAnalyticsCreationProvider(
async continueToCreateStep() {
await retry.tryForTime(15 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
'mlAnalyticsCreateJobWizardValidationStepWrapper active > mlAnalyticsCreateJobWizardContinueButton'
);
await this.assertCreateStepActive();

View file

@ -379,7 +379,7 @@ export function MachineLearningDataFrameAnalyticsResultsProvider(
if (expandableContentExists !== shouldExpand) {
await retry.tryForTime(5 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
`mlDFExpandableSection-${sectionId}-toggle-button`
);
if (shouldExpand) {

View file

@ -122,7 +122,7 @@ export function MachineLearningDataVisualizerFileBasedProvider(
},
async startImportAndWaitForProcessing() {
await testSubjects.clickWhenNotDisabled('dataVisualizerFileImportButton');
await testSubjects.clickWhenNotDisabledWithoutRetry('dataVisualizerFileImportButton');
await retry.tryForTime(60 * 1000, async () => {
await testSubjects.existOrFail('dataVisualizerFileImportSuccessCallout');
});

View file

@ -35,8 +35,8 @@ export function MachineLearningDataVisualizerIndexBasedProvider({
async clickUseFullDataButton(expectedFormattedTotalDocCount: string) {
await retry.tryForTime(30 * 1000, async () => {
await testSubjects.clickWhenNotDisabled('dataVisualizerButtonUseFullData');
await testSubjects.clickWhenNotDisabled('superDatePickerApplyTimeButton');
await testSubjects.clickWhenNotDisabledWithoutRetry('dataVisualizerButtonUseFullData');
await testSubjects.clickWhenNotDisabledWithoutRetry('superDatePickerApplyTimeButton');
await this.assertTotalDocumentCount(expectedFormattedTotalDocCount);
});
},
@ -154,7 +154,7 @@ export function MachineLearningDataVisualizerIndexBasedProvider({
},
async clickCreateAdvancedJobButton() {
await testSubjects.clickWhenNotDisabled('dataVisualizerCreateAdvancedJobCard');
await testSubjects.clickWhenNotDisabledWithoutRetry('dataVisualizerCreateAdvancedJobCard');
},
async assertCreateDataFrameAnalyticsCardExists() {
@ -183,7 +183,7 @@ export function MachineLearningDataVisualizerIndexBasedProvider({
async clickViewInDiscoverButton() {
await retry.tryForTime(5000, async () => {
await testSubjects.clickWhenNotDisabled('dataVisualizerViewInDiscoverCard');
await testSubjects.clickWhenNotDisabledWithoutRetry('dataVisualizerViewInDiscoverCard');
await PageObjects.discover.waitForDiscoverAppOnScreen();
});
},

View file

@ -37,7 +37,9 @@ export function MachineLearningDataVisualizerIndexPatternManagementProvider(
async clickIndexPatternManagementButton() {
await retry.tryForTime(5000, async () => {
await testSubjects.clickWhenNotDisabled('dataVisualizerDataViewManagementButton');
await testSubjects.clickWhenNotDisabledWithoutRetry(
'dataVisualizerDataViewManagementButton'
);
await this.assertIndexPatternManagementMenuExists();
});
},
@ -45,7 +47,7 @@ export function MachineLearningDataVisualizerIndexPatternManagementProvider(
async clickAddIndexPatternFieldAction() {
await retry.tryForTime(5000, async () => {
await this.assertIndexPatternManagementMenuExists();
await testSubjects.clickWhenNotDisabled('dataVisualizerAddDataViewFieldAction');
await testSubjects.clickWhenNotDisabledWithoutRetry('dataVisualizerAddDataViewFieldAction');
await this.assertIndexPatternFieldEditorExists();
});
},
@ -53,7 +55,7 @@ export function MachineLearningDataVisualizerIndexPatternManagementProvider(
async clickManageIndexPatternAction() {
await retry.tryForTime(5000, async () => {
await this.assertIndexPatternManagementMenuExists();
await testSubjects.clickWhenNotDisabled('dataVisualizerManageDataViewAction');
await testSubjects.clickWhenNotDisabledWithoutRetry('dataVisualizerManageDataViewAction');
await testSubjects.existOrFail('editIndexPattern');
});
},

View file

@ -300,7 +300,7 @@ export function MachineLearningDataVisualizerTableProvider(
docCountFormatted: string
) {
await this.assertSampleSizeInputExists();
await testSubjects.clickWhenNotDisabled('dataVisualizerShardSizeSelect');
await testSubjects.clickWhenNotDisabledWithoutRetry('dataVisualizerShardSizeSelect');
await testSubjects.existOrFail(`dataVisualizerShardSizeOption ${sampleSize}`);
await testSubjects.click(`dataVisualizerShardSizeOption ${sampleSize}`);
@ -567,7 +567,7 @@ export function MachineLearningDataVisualizerTableProvider(
public async assertLensActionShowChart(fieldName: string, visualizationContainer?: string) {
await retry.tryForTime(30 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
this.rowSelector(fieldName, 'dataVisualizerActionViewInLensButton')
);
await testSubjects.existOrFail(visualizationContainer ?? 'lnsVisualizationContainer', {

View file

@ -191,7 +191,7 @@ export function MachineLearningJobAnnotationsProvider({ getService }: FtrProvide
public async clickAnnotationsEditAction(annotationId: string) {
await this.assertAnnotationsEditActionExists(annotationId);
await retry.tryForTime(1000, async () => {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
this.rowSelector(annotationId, 'mlAnnotationsActionEdit')
);
await testSubjects.existOrFail('mlAnnotationFlyout');
@ -273,9 +273,9 @@ export function MachineLearningJobAnnotationsProvider({ getService }: FtrProvide
await this.clickAnnotationsEditAction(annotationId);
await testSubjects.existOrFail('mlAnnotationFlyout');
await testSubjects.existOrFail('mlAnnotationsFlyoutDeleteButton');
await testSubjects.clickWhenNotDisabled('mlAnnotationsFlyoutDeleteButton');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlAnnotationsFlyoutDeleteButton');
await testSubjects.existOrFail('mlAnnotationFlyoutConfirmDeleteModal');
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
'~mlAnnotationFlyoutConfirmDeleteModal > ~confirmModalConfirmButton'
);
});
@ -372,7 +372,7 @@ export function MachineLearningJobAnnotationsProvider({ getService }: FtrProvide
await this.ensureAnnotationsActionsMenuOpen(annotationId);
await this.assertAnnotationsDelayedDataChartActionExists();
await testSubjects.clickWhenNotDisabled('mlAnnotationsActionViewDatafeed');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlAnnotationsActionViewDatafeed');
await testSubjects.existOrFail('mlAnnotationsViewDatafeedFlyout');
await testSubjects.existOrFail('mlAnnotationsViewDatafeedFlyoutTitle');

View file

@ -19,7 +19,7 @@ export function MachineLearningJobManagementProvider(
return {
async navigateToNewJobSourceSelection() {
await testSubjects.clickWhenNotDisabled('mlCreateNewJobButton');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlCreateNewJobButton');
await testSubjects.existOrFail('mlPageSourceSelection');
},

View file

@ -26,7 +26,7 @@ export function MachineLearningJobSourceSelectionProvider({ getService }: FtrPro
async selectSource(sourceName: string, nextPageSubj: string) {
await this.filterSourceSelection(sourceName);
await retry.tryForTime(30 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(`savedObjectTitle${sourceName}`);
await testSubjects.clickWhenNotDisabledWithoutRetry(`savedObjectTitle${sourceName}`);
await testSubjects.existOrFail(nextPageSubj, { timeout: 10 * 1000 });
});
},

View file

@ -12,7 +12,7 @@ export function MachineLearningJobTypeSelectionProvider({ getService }: FtrProvi
return {
async selectSingleMetricJob() {
await testSubjects.clickWhenNotDisabled('mlJobTypeLinkSingleMetricJob');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobTypeLinkSingleMetricJob');
await this.assertSingleMetricJobWizardOpen();
},
@ -21,7 +21,7 @@ export function MachineLearningJobTypeSelectionProvider({ getService }: FtrProvi
},
async selectMultiMetricJob() {
await testSubjects.clickWhenNotDisabled('mlJobTypeLinkMultiMetricJob');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobTypeLinkMultiMetricJob');
await this.assertMultiMetricJobWizardOpen();
},
@ -30,7 +30,7 @@ export function MachineLearningJobTypeSelectionProvider({ getService }: FtrProvi
},
async selectPopulationJob() {
await testSubjects.clickWhenNotDisabled('mlJobTypeLinkPopulationJob');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobTypeLinkPopulationJob');
await this.assertPopulationJobWizardOpen();
},
@ -39,7 +39,7 @@ export function MachineLearningJobTypeSelectionProvider({ getService }: FtrProvi
},
async selectAdvancedJob() {
await testSubjects.clickWhenNotDisabled('mlJobTypeLinkAdvancedJob');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobTypeLinkAdvancedJob');
await this.assertAdvancedJobWizardOpen();
},
@ -48,7 +48,7 @@ export function MachineLearningJobTypeSelectionProvider({ getService }: FtrProvi
},
async selectCategorizationJob() {
await testSubjects.clickWhenNotDisabled('mlJobTypeLinkCategorizationJob');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobTypeLinkCategorizationJob');
await this.assertCategorizationJobWizardOpen();
},

View file

@ -314,12 +314,12 @@ export function MachineLearningJobWizardAdvancedProvider(
},
async confirmAddDetectorModal() {
await testSubjects.clickWhenNotDisabled('mlCreateDetectorModalSaveButton');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlCreateDetectorModalSaveButton');
await testSubjects.missingOrFail('mlCreateDetectorModal');
},
async cancelAddDetectorModal() {
await testSubjects.clickWhenNotDisabled('mlCreateDetectorModalCancelButton');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlCreateDetectorModalCancelButton');
await testSubjects.missingOrFail('mlCreateDetectorModal');
},
@ -359,7 +359,7 @@ export function MachineLearningJobWizardAdvancedProvider(
},
async createJob() {
await testSubjects.clickWhenNotDisabled('mlJobWizardButtonCreateJob');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobWizardButtonCreateJob');
await testSubjects.existOrFail('mlStartDatafeedModal', { timeout: 10 * 1000 });
},
};

View file

@ -23,7 +23,7 @@ export function MachineLearningJobWizardCategorizationProvider({ getService }: F
async selectCategorizationDetectorType(identifier: string) {
const id = `~mlJobWizardCategorizationDetector${identifier}Card`;
await testSubjects.existOrFail(id);
await testSubjects.clickWhenNotDisabled(id);
await testSubjects.clickWhenNotDisabledWithoutRetry(id);
await testSubjects.existOrFail(`mlJobWizardCategorizationDetector${identifier}Card selected`);
},

View file

@ -32,7 +32,7 @@ export function MachineLearningJobWizardCommonProvider(
return {
async clickNextButton() {
await testSubjects.existOrFail('mlJobWizardNavButtonNext');
await testSubjects.clickWhenNotDisabled('mlJobWizardNavButtonNext');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobWizardNavButtonNext');
},
async assertTimeRangeSectionExists() {
@ -329,7 +329,7 @@ export function MachineLearningJobWizardCommonProvider(
})) === false
) {
await retry.tryForTime(5 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
await this.assertDedicatedIndexSwitchCheckedState(true, {
withAdvancedSection: sectionOptions.withAdvancedSection,
});
@ -362,7 +362,7 @@ export function MachineLearningJobWizardCommonProvider(
const subj = 'mlJobWizardStartDatafeedCheckbox';
if ((await this.getStartDatafeedSwitchCheckedState()) !== toggle) {
await retry.tryForTime(5 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
await this.assertStartDatafeedSwitchCheckedState(toggle);
});
}
@ -492,7 +492,7 @@ export function MachineLearningJobWizardCommonProvider(
},
async clickUseFullDataButton(expectedStartDate: string, expectedEndDate: string) {
await testSubjects.clickWhenNotDisabled('mlButtonUseFullData');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlButtonUseFullData');
await this.assertDateRangeSelection(expectedStartDate, expectedEndDate);
},
@ -540,12 +540,12 @@ export function MachineLearningJobWizardCommonProvider(
},
async createJobAndWaitForCompletion() {
await testSubjects.clickWhenNotDisabled('mlJobWizardButtonCreateJob');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobWizardButtonCreateJob');
await testSubjects.existOrFail('mlJobWizardButtonRunInRealTime', { timeout: 2 * 60 * 1000 });
},
async createJobWithoutDatafeedStart() {
await testSubjects.clickWhenNotDisabled('mlJobWizardButtonCreateJob');
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobWizardButtonCreateJob');
await testSubjects.existOrFail('mlPageJobManagement');
},
};

View file

@ -284,7 +284,7 @@ export function MachineLearningSettingsCalendarProvider(
const subj = 'mlCalendarApplyToAllJobsSwitch';
if ((await this.getApplyToAllJobsSwitchCheckedState()) !== toggle) {
await retry.tryForTime(5 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
await this.assertApplyToAllJobsSwitchCheckState(toggle);
});
}

View file

@ -84,7 +84,9 @@ export function MachineLearningStackManagementJobsProvider({
},
async executeSync() {
await testSubjects.clickWhenNotDisabled('mlJobMgmtSyncFlyoutSyncButton', { timeout: 5000 });
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobMgmtSyncFlyoutSyncButton', {
timeout: 5000,
});
// check and close success toast
const resultToast = await toasts.getToastElement(1);
@ -136,7 +138,7 @@ export function MachineLearningStackManagementJobsProvider({
},
async saveAndCloseSpacesFlyout() {
await testSubjects.clickWhenNotDisabled('sts-save-button', { timeout: 2000 });
await testSubjects.clickWhenNotDisabledWithoutRetry('sts-save-button', { timeout: 2000 });
await testSubjects.missingOrFail('share-to-space-flyout', { timeout: 2000 });
},
@ -276,7 +278,9 @@ export function MachineLearningStackManagementJobsProvider({
},
async importJobs() {
await testSubjects.clickWhenNotDisabled('mlJobMgmtImportImportButton', { timeout: 5000 });
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobMgmtImportImportButton', {
timeout: 5000,
});
// check and close success toast
const resultToast = await toasts.getToastElement(1);
@ -342,7 +346,9 @@ export function MachineLearningStackManagementJobsProvider({
},
async selectExportJobs() {
await testSubjects.clickWhenNotDisabled('mlJobMgmtExportExportButton', { timeout: 5000 });
await testSubjects.clickWhenNotDisabledWithoutRetry('mlJobMgmtExportExportButton', {
timeout: 5000,
});
// check and close success toast
const resultToast = await toasts.getToastElement(1);

View file

@ -284,7 +284,7 @@ export function TrainedModelsTableProvider(
}
public async openStartDeploymentModal(modelId: string) {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
this.rowSelector(modelId, 'mlModelsTableRowStartDeploymentAction'),
{ timeout: 5000 }
);
@ -292,7 +292,7 @@ export function TrainedModelsTableProvider(
}
public async clickStopDeploymentAction(modelId: string) {
await testSubjects.clickWhenNotDisabled(
await testSubjects.clickWhenNotDisabledWithoutRetry(
this.rowSelector(modelId, 'mlModelsTableRowStopDeploymentAction'),
{ timeout: 5000 }
);

View file

@ -26,7 +26,7 @@ export function TransformSourceSelectionProvider({ getService }: FtrProviderCont
async selectSource(sourceName: string) {
await this.filterSourceSelection(sourceName);
await retry.tryForTime(30 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(`savedObjectTitle${sourceName}`);
await testSubjects.clickWhenNotDisabledWithoutRetry(`savedObjectTitle${sourceName}`);
await testSubjects.existOrFail('transformPageCreateTransform', { timeout: 10 * 1000 });
});
},

View file

@ -33,7 +33,7 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi
return {
async clickNextButton() {
await testSubjects.existOrFail('transformWizardNavButtonNext');
await testSubjects.clickWhenNotDisabled('transformWizardNavButtonNext');
await testSubjects.clickWhenNotDisabledWithoutRetry('transformWizardNavButtonNext');
},
async assertDefineStepActive() {
@ -317,7 +317,7 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi
const subj = 'transformAdvancedRuntimeMappingsEditorSwitch';
if ((await this.getRuntimeMappingsEditorSwitchCheckedState()) !== toggle) {
await retry.tryForTime(5 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
await this.assertRuntimeMappingsEditorSwitchCheckState(toggle);
});
}
@ -355,7 +355,7 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi
async applyRuntimeMappings() {
const subj = 'transformRuntimeMappingsApplyButton';
await testSubjects.existOrFail(subj);
await testSubjects.clickWhenNotDisabled(subj);
await testSubjects.clickWhenNotDisabledWithoutRetry(subj);
const isEnabled = await testSubjects.isEnabled(subj);
expect(isEnabled).to.eql(
false,
@ -560,7 +560,7 @@ export function TransformWizardProvider({ getService, getPageObjects }: FtrProvi
break;
}
}
await testSubjects.clickWhenNotDisabled('transformApplyAggChanges');
await testSubjects.clickWhenNotDisabledWithoutRetry('transformApplyAggChanges');
await testSubjects.missingOrFail(`transformAggPopoverForm_${expectedLabel}`);
},