mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[Index Management FTR] Improve delete indices test (#200941)](https://github.com/elastic/kibana/pull/200941) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-11-22T08:46:09Z","message":"[Index Management FTR] Improve delete indices test (#200941)\n\nCloses https://github.com/elastic/kibana/issues/192351\r\nCloses https://github.com/elastic/kibana/issues/200660\r\nCloses https://github.com/elastic/kibana/issues/193599\r\nCloses https://github.com/elastic/kibana/issues/192532\r\n\r\n\r\n## Summary\r\n\r\nThis PR improves the IM functional test for indices table. In\r\nhttps://github.com/elastic/kibana/issues/192351, the failure most likely\r\noccurred because the webdriver tried to interact with elements that are\r\nno longer in the DOM - in this case the index rows and table. To avoid\r\nthis, we are adding a try-catch for `StaleElementReferenceError` in the\r\n`expectIndexIsDeleted` test helper. In\r\nhttps://github.com/elastic/kibana/issues/192351,\r\nhttps://github.com/elastic/kibana/issues/20066, and\r\nhttps://github.com/elastic/kibana/issues/193599, the error most likely\r\nwas caused because the check if an index row exists was performed before\r\nthe row element was removed from the DOM, therefore it was incorrectly\r\nfailing. To fix this, we are adding a retry so that the check is retried\r\nin case it fails.","sha":"e48ad46f8adcf680e55facca9987cc1813ec52e1","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Index Management","Team:Kibana Management","release_note:skip","v9.0.0","backport:prev-minor","v8.17.0","v8.18.0"],"title":"[Index Management FTR] Improve delete indices test","number":200941,"url":"https://github.com/elastic/kibana/pull/200941","mergeCommit":{"message":"[Index Management FTR] Improve delete indices test (#200941)\n\nCloses https://github.com/elastic/kibana/issues/192351\r\nCloses https://github.com/elastic/kibana/issues/200660\r\nCloses https://github.com/elastic/kibana/issues/193599\r\nCloses https://github.com/elastic/kibana/issues/192532\r\n\r\n\r\n## Summary\r\n\r\nThis PR improves the IM functional test for indices table. In\r\nhttps://github.com/elastic/kibana/issues/192351, the failure most likely\r\noccurred because the webdriver tried to interact with elements that are\r\nno longer in the DOM - in this case the index rows and table. To avoid\r\nthis, we are adding a try-catch for `StaleElementReferenceError` in the\r\n`expectIndexIsDeleted` test helper. In\r\nhttps://github.com/elastic/kibana/issues/192351,\r\nhttps://github.com/elastic/kibana/issues/20066, and\r\nhttps://github.com/elastic/kibana/issues/193599, the error most likely\r\nwas caused because the check if an index row exists was performed before\r\nthe row element was removed from the DOM, therefore it was incorrectly\r\nfailing. To fix this, we are adding a retry so that the check is retried\r\nin case it fails.","sha":"e48ad46f8adcf680e55facca9987cc1813ec52e1"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200941","number":200941,"mergeCommit":{"message":"[Index Management FTR] Improve delete indices test (#200941)\n\nCloses https://github.com/elastic/kibana/issues/192351\r\nCloses https://github.com/elastic/kibana/issues/200660\r\nCloses https://github.com/elastic/kibana/issues/193599\r\nCloses https://github.com/elastic/kibana/issues/192532\r\n\r\n\r\n## Summary\r\n\r\nThis PR improves the IM functional test for indices table. In\r\nhttps://github.com/elastic/kibana/issues/192351, the failure most likely\r\noccurred because the webdriver tried to interact with elements that are\r\nno longer in the DOM - in this case the index rows and table. To avoid\r\nthis, we are adding a try-catch for `StaleElementReferenceError` in the\r\n`expectIndexIsDeleted` test helper. In\r\nhttps://github.com/elastic/kibana/issues/192351,\r\nhttps://github.com/elastic/kibana/issues/20066, and\r\nhttps://github.com/elastic/kibana/issues/193599, the error most likely\r\nwas caused because the check if an index row exists was performed before\r\nthe row element was removed from the DOM, therefore it was incorrectly\r\nfailing. To fix this, we are adding a retry so that the check is retried\r\nin case it fails.","sha":"e48ad46f8adcf680e55facca9987cc1813ec52e1"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
This commit is contained in:
parent
6be47af411
commit
ad17f7aafc
2 changed files with 31 additions and 9 deletions
|
@ -199,14 +199,33 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext)
|
|||
},
|
||||
|
||||
async expectIndexIsDeleted(indexName: string) {
|
||||
const table = await find.byCssSelector('table');
|
||||
const rows = await table.findAllByTestSubject('indexTableRow');
|
||||
const indexNames: string[] = await Promise.all(
|
||||
rows.map(async (row) => {
|
||||
return await (await row.findByTestSubject('indexTableIndexNameLink')).getVisibleText();
|
||||
})
|
||||
);
|
||||
expect(indexNames.includes(indexName)).to.be(false);
|
||||
try {
|
||||
const table = await find.byCssSelector('table');
|
||||
const rows = await table.findAllByTestSubject('indexTableRow');
|
||||
|
||||
const indexNames = await Promise.all(
|
||||
rows.map(async (row) => {
|
||||
try {
|
||||
return await (
|
||||
await row.findByTestSubject('indexTableIndexNameLink')
|
||||
).getVisibleText();
|
||||
} catch (error) {
|
||||
// If the current row is stale, it has already been removed
|
||||
if (error.name === 'StaleElementReferenceError') return undefined;
|
||||
throw error; // Rethrow unexpected errors
|
||||
}
|
||||
})
|
||||
).then((names) => names.filter((name) => name !== undefined));
|
||||
|
||||
expect(indexNames.includes(indexName)).to.be(false);
|
||||
} catch (error) {
|
||||
if (error.name === 'StaleElementReferenceError') {
|
||||
// If the table itself is stale, it means all rows have been removed
|
||||
return; // Pass the test since the table is gone
|
||||
} else {
|
||||
throw error; // Rethrow unexpected errors
|
||||
}
|
||||
}
|
||||
},
|
||||
async manageIndex(indexName: string) {
|
||||
const id = `checkboxSelectIndex-${indexName}`;
|
||||
|
|
|
@ -15,6 +15,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
const esDeleteAllIndices = getService('esDeleteAllIndices');
|
||||
const testIndexName = `index-ftr-test-${Math.random()}`;
|
||||
const es = getService('es');
|
||||
const retry = getService('retry');
|
||||
|
||||
describe('Indices', function () {
|
||||
this.tags(['skipSvlSearch']);
|
||||
|
@ -73,7 +74,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
});
|
||||
it('can delete index', async () => {
|
||||
await pageObjects.indexManagement.confirmDeleteModalIsVisible();
|
||||
await pageObjects.indexManagement.expectIndexIsDeleted(testIndexName);
|
||||
await retry.try(async () => {
|
||||
await pageObjects.indexManagement.expectIndexIsDeleted(testIndexName);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue