From 83d2480a00b87ccbcc99d343435b59d5ae160cd5 Mon Sep 17 00:00:00 2001 From: Ritvi Bhatt Date: Thu, 21 Nov 2024 16:50:37 -0800 Subject: [PATCH 1/9] update cypress testing for app analytics Signed-off-by: Ritvi Bhatt --- .../app_analytics_test/app_analytics.spec.js | 41 +++++++------------ .../components/app_table.tsx | 4 +- .../components/application.tsx | 2 +- .../visualization_container.tsx | 36 ++++++++++++++++ 4 files changed, 54 insertions(+), 29 deletions(-) diff --git a/.cypress/integration/app_analytics_test/app_analytics.spec.js b/.cypress/integration/app_analytics_test/app_analytics.spec.js index f1147d5a12..0a13e125e8 100644 --- a/.cypress/integration/app_analytics_test/app_analytics.spec.js +++ b/.cypress/integration/app_analytics_test/app_analytics.spec.js @@ -254,6 +254,7 @@ describe('Viewing application', () => { it('Shows latency variance in dashboards table', () => { changeTimeTo24('years'); + cy.get('[data-test-subj="app-analytics-traceTab"]').click(); cy.get('[data-test-subj="trace-groups-service-operation-accordian"]').click(); cy.get('[data-test-subj="dashboardTable"]').first().within(($table) => { cy.get('.plot-container').should('have.length.at.least', 1); @@ -261,6 +262,7 @@ describe('Viewing application', () => { }); it('Adds filter when Trace group name is clicked', () => { + cy.get('[data-test-subj="app-analytics-traceTab"]').click(); cy.get('[data-test-subj="trace-groups-service-operation-accordian"]').click(); cy.get('[data-test-subj="dashboard-table-trace-group-name-button"]').contains('client_create_order').click(); cy.get('[data-test-subj="client_create_orderFilterBadge"]').should('exist'); @@ -271,7 +273,7 @@ describe('Viewing application', () => { it('Opens service detail flyout when Service Name is clicked', () => { cy.get('[data-test-subj="app-analytics-serviceTab"]').click(); - cy.get('.euiLink').contains('authentication').click(); + cy.get('*[data-test-subj^="service-flyout-action-btntrace"]').eq(0).click(); cy.get('[data-test-subj="serviceDetailFlyoutTitle"]').should('be.visible'); cy.get('[data-test-subj="Number of connected servicesDescriptionList"]').should('contain', '3'); cy.get('[data-text="Errors"]').eq(1).click(); // Selecting errors tab within flyout @@ -433,7 +435,6 @@ describe('Viewing application', () => { cy.get('select').select(visOneName); cy.intercept('PUT', `**/api/observability/application`).as('selectUpdate'); cy.wait('@selectUpdate') - cy.wait(2000); // despite the previous wait grabbing the call that updates the panel select, it doesn't appear without this moveToHomePage(); cy.intercept('GET', `**/api/observability/operational_panels/panels/**`).as('loadingPanels') cy.wait('@loadingPanels'); @@ -479,8 +480,7 @@ describe('Separate from other plugins', () => { cy.visit( `${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/` ); - cy.get('[data-test-subj="operationalPanelsActionsButton"]', { timeout: timeoutDelay }).click(); - cy.get('[data-test-subj="addSampleContextMenuItem"]', { timeout: timeoutDelay }).click(); + cy.get('.euiButtonContent').contains('Add samples').click(); cy.get('[data-test-subj="confirmModalConfirmButton"]', { timeout: timeoutDelay }).click(); cy.get('.euiLink').contains('[Logs] Web traffic Panel').first().click(); cy.get('[data-test-subj="addVisualizationButton"]').click(); @@ -547,15 +547,9 @@ describe('Application Analytics home page', () => { }); it('Renames application', () => { - cy.get('[data-test-subj="appAnalyticsActionsButton"]').click(); - cy.get('[data-test-subj="renameApplicationContextMenuItem"]').should('be.disabled'); - cy.get('[data-test-subj="appAnalyticsActionsButton"]').click(); - cy.get('.euiTableRow').first().find('.euiCheckbox').click(); - cy.wait(2000); // checkbox being clicked has a small delay before enabling action button - cy.get('[data-test-subj="appAnalyticsActionsButton"]').click(); - cy.get('[data-test-subj="renameApplicationContextMenuItem"]').click(); - cy.get('[data-test-subj="customModalFieldText"]').clear().click().type(newName); - cy.get('[data-test-subj="runModalButton"]').click(); + cy.get('[data-test-subj="renameApplication"]').eq(0).click(); + cy.get('input[type="text"]').clear().click().type(newName); + cy.get('.euiButton__text').contains('Rename').click(); cy.get('.euiToast').contains(`Application successfully renamed to "${newName}"`); cy.get('.euiTableRow').first().within(($row) => { cy.get('.euiLink').contains(newName).should('exist'); @@ -563,23 +557,16 @@ describe('Application Analytics home page', () => { }); it('Deletes application', () => { - cy.get('[data-test-subj="appAnalyticsActionsButton"]').click(); - cy.get('[data-test-subj="deleteApplicationContextMenuItem"]').should('exist'); - cy.get('[data-test-subj="appAnalyticsActionsButton"]').click(); - cy.get('.euiTableRow').first().within(($row) => { - cy.get('.euiCheckbox').click(); - }); - cy.get('.euiTableRow').eq(1).within(($row) => { - cy.get('.euiCheckbox').click(); - }); - cy.get('.euiTableRow').eq(2).within(($row) => { - cy.get('.euiCheckbox').click(); - }); - cy.get('[data-test-subj="appAnalyticsActionsButton"]').click(); - cy.get('[data-test-subj="deleteApplicationContextMenuItem"]').click(); + cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); cy.get('[data-test-subj="popoverModal__deleteButton"').click(); cy.get('.euiToast').contains(`Applications successfully deleted!`); + cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); + cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); + cy.get('[data-test-subj="popoverModal__deleteButton"').click(); + cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); + cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); + cy.get('[data-test-subj="popoverModal__deleteButton"').click(); cy.get(`[data-test-subj="${newName}ApplicationLink"]`).should('not.exist'); }); }); diff --git a/public/components/application_analytics/components/app_table.tsx b/public/components/application_analytics/components/app_table.tsx index d9d702334d..c9cb8f3a84 100644 --- a/public/components/application_analytics/components/app_table.tsx +++ b/public/components/application_analytics/components/app_table.tsx @@ -138,6 +138,7 @@ export function AppTable(props: AppTableProps) { description: 'Rename this application', icon: 'pencil', type: 'icon', + 'data-test-subj': 'renameApplication', onClick: (app: ApplicationType) => renameApp(app), }, { @@ -146,6 +147,7 @@ export function AppTable(props: AppTableProps) { icon: 'trash', type: 'icon', color: 'danger', + 'data-test-subj': 'deleteApplication', onClick: (app: ApplicationType) => deleteApp(app), }, ]; @@ -231,7 +233,7 @@ export function AppTable(props: AppTableProps) { {!newNavigation && ( - +

Applications {` (${applications.length})`}

)} diff --git a/public/components/application_analytics/components/application.tsx b/public/components/application_analytics/components/application.tsx index 140c156930..ff2536f3b9 100644 --- a/public/components/application_analytics/components/application.tsx +++ b/public/components/application_analytics/components/application.tsx @@ -294,7 +294,7 @@ export function Application(props: AppDetailProps) { ([]); const [isLoading, setIsLoading] = useState(true); const [isError, setIsError] = useState({} as VizContainerError); + const onActionsMenuClick = () => setIsPopoverOpen((currPopoverOpen) => !currPopoverOpen); const closeActionsMenu = () => setIsPopoverOpen(false); const { http, pplService } = coreRefs; const { setToast } = useToast(); @@ -368,6 +373,37 @@ export const VisualizationContainer = ({ + + {editMode ? ( + { + removeVisualization(visualizationId); + }} + /> + ) : ( + + } + isOpen={isPopoverOpen} + closePopover={closeActionsMenu} + anchorPosition="downLeft" + panelPaddingSize="none" + > + + + )} + {inlineEditor} From cdad04489bf46eac3d8614d451ef46812ec8f580 Mon Sep 17 00:00:00 2001 From: Ritvi Bhatt Date: Fri, 22 Nov 2024 15:40:52 -0800 Subject: [PATCH 2/9] replace wait Signed-off-by: Ritvi Bhatt --- .../integration/app_analytics_test/app_analytics.spec.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.cypress/integration/app_analytics_test/app_analytics.spec.js b/.cypress/integration/app_analytics_test/app_analytics.spec.js index 0a13e125e8..e9fe5f4239 100644 --- a/.cypress/integration/app_analytics_test/app_analytics.spec.js +++ b/.cypress/integration/app_analytics_test/app_analytics.spec.js @@ -431,12 +431,14 @@ describe('Viewing application', () => { it('Changes availability visualization', () => { + cy.intercept('PUT', `**/api/observability/application`).as('selectUpdate'); + cy.intercept('GET', `**/api/observability/operational_panels/panels/**`).as('loadingPanels') cy.get('[data-test-subj="app-analytics-configTab"]').click(); cy.get('select').select(visOneName); - cy.intercept('PUT', `**/api/observability/application`).as('selectUpdate'); - cy.wait('@selectUpdate') + cy.wait('@selectUpdate'); + moveToHomePage(); - cy.intercept('GET', `**/api/observability/operational_panels/panels/**`).as('loadingPanels') + cy.reload() cy.wait('@loadingPanels'); cy.get('[data-test-subj="AvailableAvailabilityBadge"][style="background-color: rgb(84, 179, 153); color: rgb(0, 0, 0);"]').should('contain', 'Available'); moveToApplication(nameOne); From 8b5aef1a4b67a532b4a11e39b8af60fd4480be76 Mon Sep 17 00:00:00 2001 From: Ritvi Bhatt Date: Mon, 25 Nov 2024 11:15:46 -0800 Subject: [PATCH 3/9] change action menu for metrics Signed-off-by: Ritvi Bhatt --- .../visualization_container/visualization_container.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/public/components/custom_panels/panel_modules/visualization_container/visualization_container.tsx b/public/components/custom_panels/panel_modules/visualization_container/visualization_container.tsx index 669eee9068..9730eb8706 100644 --- a/public/components/custom_panels/panel_modules/visualization_container/visualization_container.tsx +++ b/public/components/custom_panels/panel_modules/visualization_container/visualization_container.tsx @@ -238,10 +238,7 @@ export const VisualizationContainer = ({ , ]; - if ( - visualizationMetaData?.metricType === PROMQL_METRIC_SUBTYPE && - actionMenuType === 'metricsGrid' - ) { + if (actionMenuType === 'metricsGrid') { popoverPanel = [showPPLQueryPanel]; } else if (usedInNotebooks) { popoverPanel = [popoverPanel[0]]; From 127bfcfb0df2d31bfdf8d050ffd4a547eaa905e8 Mon Sep 17 00:00:00 2001 From: Ritvi Bhatt Date: Mon, 25 Nov 2024 11:19:23 -0800 Subject: [PATCH 4/9] update snapshots Signed-off-by: Ritvi Bhatt --- .../visualization_container.test.tsx.snap | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/public/components/custom_panels/panel_modules/visualization_container/__tests__/__snapshots__/visualization_container.test.tsx.snap b/public/components/custom_panels/panel_modules/visualization_container/__tests__/__snapshots__/visualization_container.test.tsx.snap index 38d69afad3..b855f47d64 100644 --- a/public/components/custom_panels/panel_modules/visualization_container/__tests__/__snapshots__/visualization_container.test.tsx.snap +++ b/public/components/custom_panels/panel_modules/visualization_container/__tests__/__snapshots__/visualization_container.test.tsx.snap @@ -94,6 +94,48 @@ exports[`Visualization Container Component renders add visualization container 1 + +
+ + + + + + + +
+
From 94f1052a632c300a465b94e8cfb95f6cf84e9ae9 Mon Sep 17 00:00:00 2001 From: Ritvi Bhatt Date: Mon, 25 Nov 2024 12:10:58 -0800 Subject: [PATCH 5/9] wait for service entities and trace groups to load Signed-off-by: Ritvi Bhatt --- .cypress/integration/app_analytics_test/app_analytics.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cypress/integration/app_analytics_test/app_analytics.spec.js b/.cypress/integration/app_analytics_test/app_analytics.spec.js index e9fe5f4239..07b9166107 100644 --- a/.cypress/integration/app_analytics_test/app_analytics.spec.js +++ b/.cypress/integration/app_analytics_test/app_analytics.spec.js @@ -519,10 +519,12 @@ describe('Editing application', () => { cy.get('[data-test-subj="logSourceAccordion"]').trigger('mouseover').click(); cy.get('[data-test-subj="searchAutocompleteTextArea"]').should('be.disabled'); cy.get('[data-test-subj="servicesEntitiesAccordion"]').trigger('mouseover').click(); + cy.get('[data-test-subj="servicesEntitiesCountBadge"]').should('contain', '1'); cy.get('[data-test-subj="servicesEntitiesComboBox"]').click(); cy.get('.euiFilterSelectItem').contains(service_two).click(); cy.get('[data-test-subj="servicesEntitiesCountBadge"]').should('contain', '2'); cy.get('[data-test-subj="traceGroupsAccordion"]').trigger('mouseover').click(); + cy.get('[data-test-subj="traceGroupsCountBadge"]').should('contain', '2'); cy.get('[data-test-subj="comboBoxToggleListButton"]').eq(1).click(); cy.get('.euiFilterSelectItem').contains(trace_three).trigger('click'); cy.get('[data-test-subj="traceGroupsCountBadge"]').should('contain', '3'); From b18bc8cf933a3dcc2c0b91f27d9d4f670f77ecee Mon Sep 17 00:00:00 2001 From: Ritvi Bhatt Date: Mon, 25 Nov 2024 13:12:37 -0800 Subject: [PATCH 6/9] load deleted applications Signed-off-by: Ritvi Bhatt --- .cypress/integration/app_analytics_test/app_analytics.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.cypress/integration/app_analytics_test/app_analytics.spec.js b/.cypress/integration/app_analytics_test/app_analytics.spec.js index 07b9166107..a72ace1150 100644 --- a/.cypress/integration/app_analytics_test/app_analytics.spec.js +++ b/.cypress/integration/app_analytics_test/app_analytics.spec.js @@ -571,6 +571,7 @@ describe('Application Analytics home page', () => { cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); cy.get('[data-test-subj="popoverModal__deleteButton"').click(); + cy.reload(); cy.get(`[data-test-subj="${newName}ApplicationLink"]`).should('not.exist'); }); }); From aae07867ddf1cd68722b56aa7c273d905629f54a Mon Sep 17 00:00:00 2001 From: Ritvi Bhatt Date: Tue, 26 Nov 2024 17:05:45 -0800 Subject: [PATCH 7/9] remove deleted applications from table without reload Signed-off-by: Ritvi Bhatt --- .cypress/integration/app_analytics_test/app_analytics.spec.js | 2 -- .../components/application_analytics/components/app_table.tsx | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.cypress/integration/app_analytics_test/app_analytics.spec.js b/.cypress/integration/app_analytics_test/app_analytics.spec.js index a72ace1150..104e4b7454 100644 --- a/.cypress/integration/app_analytics_test/app_analytics.spec.js +++ b/.cypress/integration/app_analytics_test/app_analytics.spec.js @@ -438,7 +438,6 @@ describe('Viewing application', () => { cy.wait('@selectUpdate'); moveToHomePage(); - cy.reload() cy.wait('@loadingPanels'); cy.get('[data-test-subj="AvailableAvailabilityBadge"][style="background-color: rgb(84, 179, 153); color: rgb(0, 0, 0);"]').should('contain', 'Available'); moveToApplication(nameOne); @@ -571,7 +570,6 @@ describe('Application Analytics home page', () => { cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); cy.get('[data-test-subj="popoverModal__deleteButton"').click(); - cy.reload(); cy.get(`[data-test-subj="${newName}ApplicationLink"]`).should('not.exist'); }); }); diff --git a/public/components/application_analytics/components/app_table.tsx b/public/components/application_analytics/components/app_table.tsx index c9cb8f3a84..b2ff709592 100644 --- a/public/components/application_analytics/components/app_table.tsx +++ b/public/components/application_analytics/components/app_table.tsx @@ -86,7 +86,7 @@ export function AppTable(props: AppTableProps) { ); clear(); fetchApplications(); - }, [applications.length]); + }, []); const clear = () => { setFilters([]); @@ -227,6 +227,8 @@ export function AppTable(props: AppTableProps) { app.name.toLowerCase().includes(searchQuery.toLowerCase()) ); + console.log('Applications', applications); + return ( <> From 50491e8bc75d8598365d04ffa85e244c507edfc4 Mon Sep 17 00:00:00 2001 From: Ritvi Bhatt Date: Mon, 2 Dec 2024 06:28:27 -0800 Subject: [PATCH 8/9] fix deleting saved visualizations Signed-off-by: Ritvi Bhatt --- .../app_analytics_test/app_analytics.spec.js | 5 ++++- .../components/app_table.tsx | 2 -- .../components/application_analytics/home.tsx | 17 ++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.cypress/integration/app_analytics_test/app_analytics.spec.js b/.cypress/integration/app_analytics_test/app_analytics.spec.js index 104e4b7454..47c03ec369 100644 --- a/.cypress/integration/app_analytics_test/app_analytics.spec.js +++ b/.cypress/integration/app_analytics_test/app_analytics.spec.js @@ -436,6 +436,7 @@ describe('Viewing application', () => { cy.get('[data-test-subj="app-analytics-configTab"]').click(); cy.get('select').select(visOneName); cy.wait('@selectUpdate'); + cy.get('select').find('option:selected').should('have.text', visOneName); moveToHomePage(); cy.wait('@loadingPanels'); @@ -563,13 +564,15 @@ describe('Application Analytics home page', () => { cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); cy.get('[data-test-subj="popoverModal__deleteButton"').click(); - cy.get('.euiToast').contains(`Applications successfully deleted!`); + cy.get('[data-test-subj="applicationHomePageTitle"]').contains(`(2)`); cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); cy.get('[data-test-subj="popoverModal__deleteButton"').click(); + cy.get('[data-test-subj="applicationHomePageTitle"]').contains(`(1)`); cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); cy.get('[data-test-subj="popoverModal__deleteButton"').click(); + cy.get('[data-test-subj="applicationHomePageTitle"]').contains(`(0)`); cy.get(`[data-test-subj="${newName}ApplicationLink"]`).should('not.exist'); }); }); diff --git a/public/components/application_analytics/components/app_table.tsx b/public/components/application_analytics/components/app_table.tsx index b2ff709592..3141a61c7c 100644 --- a/public/components/application_analytics/components/app_table.tsx +++ b/public/components/application_analytics/components/app_table.tsx @@ -227,8 +227,6 @@ export function AppTable(props: AppTableProps) { app.name.toLowerCase().includes(searchQuery.toLowerCase()) ); - console.log('Applications', applications); - return ( <> diff --git a/public/components/application_analytics/home.tsx b/public/components/application_analytics/home.tsx index 9308262b2f..53728e033a 100644 --- a/public/components/application_analytics/home.tsx +++ b/public/components/application_analytics/home.tsx @@ -38,6 +38,7 @@ import { isNameValid, removeTabData, } from './helpers/utils'; +import { SavedObjectsActions } from '../../services/saved_objects/saved_object_client/saved_objects_actions'; export type AppAnalyticsCoreDeps = TraceAnalyticsCoreDeps; @@ -201,8 +202,7 @@ export const Home = (props: HomeProps) => { const deleteSavedVisualizationsForPanel = async (appPanelId: string) => { const savedVizIdsToDelete = await fetchPanelsVizIdList(http, appPanelId); if (!isEmpty(savedVizIdsToDelete)) { - savedObjects - .deleteSavedObjectsList({ objectIdList: savedVizIdsToDelete }) + await SavedObjectsActions.deleteBulk({ objectIdList: savedVizIdsToDelete }) .then((_res) => { deletePanelForApp(appPanelId); }) @@ -350,14 +350,10 @@ export const Home = (props: HomeProps) => { }; // Delete existing applications - const deleteApp = (appList: string[], panelList: string[], toastMessage?: string) => { + const deleteApp = async (appList: string[], panelList: string[], toastMessage?: string) => { return http - .delete(`${APP_ANALYTICS_API_PREFIX}/${appList.join(',')}`) - .then((res) => { - setApplicationList((prevApplicationList) => { - return prevApplicationList.filter((app) => !appList.includes(app.id)); - }); - + .delete(`${APP_ANALYTICS_API_PREFIX}/${[...appList].join(',')}`) + .then(async (res) => { for (let i = 0; i < appList.length; i++) { removeTabData(dispatch, appList[i], ''); } @@ -366,6 +362,9 @@ export const Home = (props: HomeProps) => { deleteSavedVisualizationsForPanel(panelList[i]); } + setApplicationList((prevApplicationList) => { + return prevApplicationList.filter((app) => !appList.includes(app.id)); + }); const message = toastMessage || `Application${appList.length > 1 ? 's' : ''} successfully deleted!`; setToast(message); From 2ecb342ba5dbdf5f488db5e21be91b04324dec12 Mon Sep 17 00:00:00 2001 From: Ritvi Bhatt Date: Tue, 3 Dec 2024 11:52:09 -0800 Subject: [PATCH 9/9] type in applications to delete Signed-off-by: Ritvi Bhatt --- .../app_analytics_test/app_analytics.spec.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.cypress/integration/app_analytics_test/app_analytics.spec.js b/.cypress/integration/app_analytics_test/app_analytics.spec.js index 47c03ec369..ce0ff7820f 100644 --- a/.cypress/integration/app_analytics_test/app_analytics.spec.js +++ b/.cypress/integration/app_analytics_test/app_analytics.spec.js @@ -206,6 +206,7 @@ describe('Setting availability', () => { cy.get('.euiTableRow').should('have.length.lessThan', 1); cy.get('[data-test-subj="applicationTitle"]').should('contain', nameThree); cy.get('.euiBreadcrumb[href="#/"]').click(); + cy.reload(); cy.get(`[data-test-subj="${nameThree}ApplicationLink"]`); cy.get('[data-test-subj="setAvailabilityHomePageLink"]').first().click(); cy.get('[data-test-subj="applicationTitle"]').should('contain', nameThree); @@ -431,15 +432,15 @@ describe('Viewing application', () => { it('Changes availability visualization', () => { - cy.intercept('PUT', `**/api/observability/application`).as('selectUpdate'); - cy.intercept('GET', `**/api/observability/operational_panels/panels/**`).as('loadingPanels') cy.get('[data-test-subj="app-analytics-configTab"]').click(); cy.get('select').select(visOneName); + cy.intercept('PUT', `**/api/observability/application`).as('selectUpdate'); cy.wait('@selectUpdate'); - cy.get('select').find('option:selected').should('have.text', visOneName); moveToHomePage(); + cy.intercept('GET', `**/api/observability/operational_panels/panels/**`).as('loadingPanels') cy.wait('@loadingPanels'); + cy.reload(); cy.get('[data-test-subj="AvailableAvailabilityBadge"][style="background-color: rgb(84, 179, 153); color: rgb(0, 0, 0);"]').should('contain', 'Available'); moveToApplication(nameOne); cy.get('[data-test-subj="app-analytics-configTab"]').click(); @@ -561,18 +562,20 @@ describe('Application Analytics home page', () => { }); it('Deletes application', () => { - cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); + cy.get('.euiFieldSearch').clear().type(nameTwo); + cy.get('[data-test-subj="deleteApplication"]').click(); cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); cy.get('[data-test-subj="popoverModal__deleteButton"').click(); - cy.get('[data-test-subj="applicationHomePageTitle"]').contains(`(2)`); - cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); + cy.get('.euiToast').contains(`Applications successfully deleted!`); + cy.get('.euiFieldSearch').clear().type(nameThree); + cy.get('[data-test-subj="deleteApplication"]').click(); cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); cy.get('[data-test-subj="popoverModal__deleteButton"').click(); - cy.get('[data-test-subj="applicationHomePageTitle"]').contains(`(1)`); - cy.get('[data-test-subj="deleteApplication"]').eq(0).click(); + cy.get('.euiFieldSearch').clear().type(newName); + cy.get('[data-test-subj="deleteApplication"]').click(); cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete'); cy.get('[data-test-subj="popoverModal__deleteButton"').click(); - cy.get('[data-test-subj="applicationHomePageTitle"]').contains(`(0)`); - cy.get(`[data-test-subj="${newName}ApplicationLink"]`).should('not.exist'); + cy.get('.euiFieldSearch').clear() + cy.get('[data-test-subj="applicationHomePageTitle"]').contains('(0)'); }); });