[8.13] [DataViews] Improve management functional tests for serverless (#177146) (#177723)

# Backport

This will backport the following commits from `main` to `8.13`:
- [[DataViews] Improve management functional tests for serverless
(#177146)](https://github.com/elastic/kibana/pull/177146)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Matthias
Wilhelm","email":"matthias.wilhelm@elastic.co"},"sourceCommit":{"committedDate":"2024-02-20T09:52:48Z","message":"[DataViews]
Improve management functional tests for serverless (#177146)\n\n*
improving code to prevent occasional flakiness in
serverless","sha":"a2268131b34f59ecdf1683d855755da0bd845517","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Data
Views","release_note:skip","backport:skip","Team:DataDiscovery","v8.14.0"],"number":177146,"url":"https://github.com/elastic/kibana/pull/177146","mergeCommit":{"message":"[DataViews]
Improve management functional tests for serverless (#177146)\n\n*
improving code to prevent occasional flakiness in
serverless","sha":"a2268131b34f59ecdf1683d855755da0bd845517"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.14.0","labelRegex":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/177146","number":177146,"mergeCommit":{"message":"[DataViews]
Improve management functional tests for serverless (#177146)\n\n*
improving code to prevent occasional flakiness in
serverless","sha":"a2268131b34f59ecdf1683d855755da0bd845517"}}]}]
BACKPORT-->

Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Julia Rechkunova 2024-03-04 15:51:25 +01:00 committed by GitHub
parent 9bcca4780c
commit cfcd681457
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 72 deletions

View file

@ -150,6 +150,7 @@ export const TimestampField = ({ options$, isLoadingOptions$, matchedIndices$ }:
}
)}
isLoading={isLoadingOptions}
data-is-loading={isLoadingOptions ? '1' : '0'}
fullWidth
/>
<EuiFormHelpText>

View file

@ -22,10 +22,6 @@ export class SettingsPageObject extends FtrService {
private readonly savedObjects = this.ctx.getPageObject('savedObjects');
private readonly monacoEditor = this.ctx.getService('monacoEditor');
async clickNavigation() {
await this.find.clickDisplayedByCssSelector('.app-link:nth-child(5) a');
}
async clickLinkText(text: string) {
await this.find.clickByDisplayedLinkText(text);
}
@ -127,22 +123,6 @@ export class SettingsPageObject extends FtrService {
await this.header.waitUntilLoadingHasFinished();
}
async setAdvancedSettingsTextArea(propertyName: string, propertyValue: string) {
const wrapper = await this.testSubjects.find(`management-settings-editField-${propertyName}`);
const textarea = await wrapper.findByTagName('textarea');
await textarea.focus();
// only way to properly replace the value of the ace editor is via the JS api
await this.browser.execute(
(editor: string, value: string) => {
return (window as any).ace.edit(editor).setValue(value);
},
`management-settings-editField-${propertyName}-editor`,
propertyValue
);
await this.testSubjects.click(`settings-save-button`);
await this.header.waitUntilLoadingHasFinished();
}
async setAdvancedSettingsImage(propertyName: string, path: string) {
const input = await this.testSubjects.find(`management-settings-editField-${propertyName}`);
await input.type(path);
@ -172,34 +152,28 @@ export class SettingsPageObject extends FtrService {
return this.testSubjects.find('createIndexPatternTitleInput');
}
async getTimeFieldNameField() {
const wrapperElement = await this.testSubjects.find('timestampField');
return wrapperElement.findByTestSubject('comboBoxSearchInput');
}
async selectTimeFieldOption(selection: string) {
// open dropdown
const timefield = await this.getTimeFieldNameField();
const prevValue = await timefield.getAttribute('value');
const enabled = await timefield.isEnabled();
const testSubj = 'timestampField';
const timefield = await this.testSubjects.find(testSubj);
if (prevValue === selection || !enabled) {
await this.retry.waitFor('loading the timefield options should be finished', async () => {
const isLoading = await timefield.getAttribute('data-is-loading');
return isLoading === '0';
});
const isEnabled = await (await timefield.findByTestSubject('comboBoxSearchInput')).isEnabled();
if (!isEnabled) {
return;
}
const isSelected = await this.comboBox.isOptionSelected(timefield, selection);
if (isSelected) {
return;
}
await this.retry.waitFor('time field dropdown have the right value', async () => {
await timefield.click();
await timefield.type(this.browser.keys.DELETE, { charByChar: true });
await this.browser.pressKeys(selection);
await this.browser.pressKeys(this.browser.keys.TAB);
const value = await timefield.getAttribute('value');
return value === selection;
await this.comboBox.set(testSubj, selection);
return await this.comboBox.isOptionSelected(timefield, selection);
});
}
async getTimeFieldOption(selection: string) {
return await this.find.displayedByCssSelector('option[value="' + selection + '"]');
}
async getNameField() {
return this.testSubjects.find('createIndexPatternNameInput');
}
@ -227,15 +201,6 @@ export class SettingsPageObject extends FtrService {
return await this.testSubjects.find('saveIndexPatternButton');
}
async getCreateButton() {
return await this.find.displayedByCssSelector('[type="submit"]');
}
async clickDefaultIndexButton() {
await this.testSubjects.click('setDefaultIndexPatternButton');
await this.header.waitUntilLoadingHasFinished();
}
async clickEditIndexButton() {
await this.testSubjects.click('editIndexPatternButton');
await this.retry.waitFor('flyout', async () => {
@ -251,10 +216,6 @@ export class SettingsPageObject extends FtrService {
return await this.testSubjects.getVisibleText('indexPatternTitle');
}
async getConfigureHeader() {
return await this.find.byCssSelector('h1');
}
async getTableHeader() {
return await this.find.allByCssSelector('table.euiTable thead tr th');
}
@ -452,10 +413,6 @@ export class SettingsPageObject extends FtrService {
await this.header.waitUntilLoadingHasFinished();
}
async hasIndexPattern(name: string) {
return await this.find.existsByLinkText(name);
}
async clickIndexPatternByName(name: string) {
const indexLink = await this.find.byXPath(`//a[text()='${name}']`);
await indexLink.click();
@ -509,7 +466,7 @@ export class SettingsPageObject extends FtrService {
await this.header.waitUntilLoadingHasFinished();
if (
options.ignoreMissing &&
(await this.testSubjects.exists(`detail-link-${dataViewName}`)) === false
!(await this.testSubjects.exists(`detail-link-${dataViewName}`))
) {
return;
}
@ -567,7 +524,6 @@ export class SettingsPageObject extends FtrService {
await this.setIndexPatternField(indexPatternName);
});
await this.common.sleep(2000);
if (timefield) {
await this.selectTimeFieldOption(timefield);
}
@ -719,10 +675,6 @@ export class SettingsPageObject extends FtrService {
});
}
async getCreateIndexPatternGoToStep2Button() {
return await this.testSubjects.find('createIndexPatternGoToStep2Button');
}
async removeIndexPattern() {
let alertText;
await this.retry.try(async () => {
@ -746,11 +698,6 @@ export class SettingsPageObject extends FtrService {
return alertText;
}
async clickFieldsTab() {
this.log.debug('click Fields tab');
await this.testSubjects.click('tab-indexedFields');
}
async clickScriptedFieldsTab() {
this.log.debug('click Scripted Fields tab');
await this.testSubjects.click('tab-scriptedFields');
@ -1103,8 +1050,4 @@ export class SettingsPageObject extends FtrService {
[data-test-subj="indexPatternOption-${newIndexPatternTitle}"]`
);
}
async clickChangeIndexConfirmButton() {
await this.testSubjects.click('changeIndexConfirmButton');
}
}