Dashboard tab test: attempt to fix (#206485)

Closes #203740

## Summary

After some other attempts to fix it, I saw that a different tab was
selected before the test started so I added an extra step to start from
the overview (this should make it more stable- locally it passed several
times so I guess the issue was that other test results affected the
test)
This commit is contained in:
jennypavlova 2025-01-15 10:49:38 +01:00 committed by GitHub
parent 21493f7990
commit adfd7d7ed4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 15 deletions

View file

@ -224,7 +224,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// Helpers
const loginWithReadOnlyUserAndNavigateToHostsFlyout = async () => {
const loginWithReadOnlyUser = async () => {
await security.role.create('global_hosts_read_privileges_role', {
elasticsearch: {
indices: [
@ -260,17 +260,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
expectSpaceSelector: false,
}
);
await pageObjects.common.navigateToApp(HOSTS_VIEW_PATH);
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.timePicker.setAbsoluteRange(
START_SYNTHTRACE_DATE.format(DATE_PICKER_FORMAT),
END_SYNTHTRACE_DATE.format(DATE_PICKER_FORMAT)
);
await waitForPageToLoad();
await pageObjects.infraHostsView.clickTableOpenFlyoutButton();
};
const logoutAndDeleteReadOnlyUser = async () => {
@ -997,13 +986,23 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});
});
describe('#Permissions: Read Only User - Single Host Flyout', () => {
describe('Dashboards Tab', () => {
before(async () => {
await setCustomDashboardsEnabled(true);
await loginWithReadOnlyUserAndNavigateToHostsFlyout();
await pageObjects.assetDetails.clickDashboardsTab();
await loginWithReadOnlyUser();
await pageObjects.common.navigateToApp(HOSTS_VIEW_PATH);
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.timePicker.setAbsoluteRange(
START_SYNTHTRACE_DATE.format(DATE_PICKER_FORMAT),
END_SYNTHTRACE_DATE.format(DATE_PICKER_FORMAT)
);
await waitForPageToLoad();
await pageObjects.infraHostsView.clickTableOpenFlyoutButton();
await browser.scrollTop();
});
after(async () => {
@ -1014,6 +1013,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
it('should render dashboards tab splash screen with disabled option to add dashboard', async () => {
await pageObjects.assetDetails.dashboardsTabExistsOrFail();
await pageObjects.assetDetails.clickDashboardsTab();
await pageObjects.assetDetails.addDashboardExists();
const elementToHover = await pageObjects.assetDetails.getAddDashboardButton();
await retry.tryForTime(5000, async () => {

View file

@ -342,6 +342,10 @@ export function AssetDetailsProvider({ getService }: FtrProviderContext) {
return testSubjects.exists('infraAssetDetailsDashboardsTab');
},
async dashboardsTabExistsOrFail() {
return testSubjects.existOrFail('infraAssetDetailsDashboardsTab');
},
async addDashboardExists() {
await testSubjects.existOrFail('infraAddDashboard');
},