[9.0] [Logs UI] Make logs ui categories page tests more robust (#213834) (#214223)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Logs UI] Make logs ui categories page tests more robust
(#213834)](https://github.com/elastic/kibana/pull/213834)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Felix
Stürmer","email":"weltenwort@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-12T16:08:11Z","message":"[Logs
UI] Make logs ui categories page tests more robust
(#213834)","sha":"3338092efcc707ef7fa80c0ef34d1b23d257193e","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Logs
UI","release_note:skip","backport:all-open","Team:obs-ux-logs","v9.1.0"],"title":"[Logs
UI] Make logs ui categories page tests more
robust","number":213834,"url":"https://github.com/elastic/kibana/pull/213834","mergeCommit":{"message":"[Logs
UI] Make logs ui categories page tests more robust
(#213834)","sha":"3338092efcc707ef7fa80c0ef34d1b23d257193e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/213834","number":213834,"mergeCommit":{"message":"[Logs
UI] Make logs ui categories page tests more robust
(#213834)","sha":"3338092efcc707ef7fa80c0ef34d1b23d257193e"}}]}]
BACKPORT-->

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2025-03-13 05:20:20 +11:00 committed by GitHub
parent d0cbdcb670
commit 9e48d505ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,11 +11,18 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default ({ getPageObjects, getService }: FtrProviderContext) => {
const PageObjects = getPageObjects(['security']);
const config = getService('config');
const esArchiver = getService('esArchiver');
const logsUi = getService('logsUi');
const retry = getService('retry');
const security = getService('security');
const retryNavigationOptions = {
retryCount: 2,
retryDelay: 0,
timeout: config.get('timeouts.try') * 2,
};
describe('Log Entry Categories Tab', function () {
this.tags('includeFirefox');
@ -61,11 +68,17 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
before(() => logsUi.cleanIndices());
it('Shows no data page when indices do not exist', async () => {
await logsUi.logEntryCategoriesPage.navigateTo();
await retry.tryWithRetries(
"retry if indices haven't been refreshed yet",
async () => {
await logsUi.logEntryCategoriesPage.navigateTo();
await retry.try(async () => {
expect(await logsUi.logEntryCategoriesPage.getNoDataScreen()).to.be.ok();
});
await retry.try(async () => {
expect(await logsUi.logEntryCategoriesPage.getNoDataScreen()).to.be.ok();
});
},
retryNavigationOptions
);
});
describe('when indices exists', () => {
@ -78,11 +91,17 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
it('shows setup page when indices exist', async () => {
await logsUi.logEntryCategoriesPage.navigateTo();
await retry.tryWithRetries(
"retry if indices haven't been refreshed yet",
async () => {
await logsUi.logEntryCategoriesPage.navigateTo();
await retry.try(async () => {
expect(await logsUi.logEntryCategoriesPage.getSetupScreen()).to.be.ok();
});
await retry.try(async () => {
expect(await logsUi.logEntryCategoriesPage.getSetupScreen()).to.be.ok();
});
},
retryNavigationOptions
);
});
it('shows required ml read privileges prompt when the user has not any ml privileges', async () => {