[Chore] Dashboard: Tests for dashboard's add content buttons and menu (#66233)

* add tests for empty dashboard page

* add tests for AddPanelButton

* export default components

* test +Add menu in dashboard page

* use userEvent instead of firing an event on the DOM itself

* fix test to match new analytic events
This commit is contained in:
Polina Boneva
2023-06-08 11:16:08 +01:00
committed by GitHub
parent 6d82962edf
commit 4db6679460
12 changed files with 321 additions and 25 deletions
@@ -144,7 +144,7 @@ export const addDashboard = (config?: Partial<AddDashboardConfig>) => {
e2e.pages.SaveDashboardAsModal.newName().clear().type(title, { force: true });
e2e.pages.SaveDashboardAsModal.save().click();
e2e.flows.assertSuccessNotification();
e2e.pages.AddDashboard.addNewPanel().should('be.visible');
e2e.pages.AddDashboard.itemButton('Create new panel button').should('be.visible');
e2e().logToConsole('Added dashboard with title:', title);
@@ -92,12 +92,12 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC
e2e.components.Panels.Panel.headerItems('Edit').click();
} else {
try {
e2e.components.PageToolbar.itemButton('Add panel button').should('be.visible');
e2e.components.PageToolbar.itemButton('Add panel button').click();
e2e.components.PageToolbar.itemButton('Add button').should('be.visible');
e2e.components.PageToolbar.itemButton('Add button').click();
} catch (e) {
// Depending on the screen size, the "Add panel" button might be hidden
// Depending on the screen size, the "Add" button might be hidden
e2e.components.PageToolbar.item('Show more items').click();
e2e.components.PageToolbar.item('Add panel button').last().click();
e2e.components.PageToolbar.item('Add button').last().click();
}
e2e.pages.AddDashboard.itemButton('Add new visualization menu item').should('be.visible');
e2e.pages.AddDashboard.itemButton('Add new visualization menu item').click();