diff --git a/cypress/integration/plugins/custom-import-map-dashboards/5_add_map_to_dashboard.spec.js b/cypress/integration/plugins/custom-import-map-dashboards/5_add_map_to_dashboard.spec.js index d143601c0..98fe83183 100644 --- a/cypress/integration/plugins/custom-import-map-dashboards/5_add_map_to_dashboard.spec.js +++ b/cypress/integration/plugins/custom-import-map-dashboards/5_add_map_to_dashboard.spec.js @@ -4,8 +4,8 @@ */ import { BASE_PATH } from '../../../utils/constants'; -import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; import { CURRENT_TENANT } from '../../../utils/commands'; +import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; const miscUtils = new MiscUtils(cy); @@ -17,21 +17,24 @@ describe('Add map to dashboard', () => { cy.wait(15000); }); + after(() => { + miscUtils.removeSampleData(); + }); + it('Add new map to dashboard', () => { const testMapName = 'saved-map-' + Date.now().toString(); - cy.visit(`${BASE_PATH}/app/dashboards`); - cy.get('[data-test-subj="newItemButton"]').click(); - cy.get('button[data-test-subj="dashboardAddNewPanelButton"]').click(); - cy.get('button[data-test-subj="visType-customImportMap"]').click(); + cy.visit(`${BASE_PATH}/app/dashboards#/create`); + cy.wait(5000) + .get('button[data-test-subj="addVisualizationButton"]') + .click(); + cy.wait(5000) + .get('button[data-test-subj="visType-customImportMap"]') + .click(); cy.wait(5000).get('button[data-test-subj="mapSaveButton"]').click(); cy.wait(5000).get('[data-test-subj="savedObjectTitle"]').type(testMapName); cy.wait(5000) .get('[data-test-subj="confirmSaveSavedObjectButton"]') .click(); - cy.get('.embPanel__titleText').should('contain', testMapName); - }); - - after(() => { - miscUtils.removeSampleData(); + cy.wait(5000).get('.embPanel__titleText').should('contain', testMapName); }); }); diff --git a/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js b/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js new file mode 100644 index 000000000..ec1d1d5ff --- /dev/null +++ b/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js @@ -0,0 +1,78 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { BASE_PATH } from '../../../utils/constants'; +import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; +import { CURRENT_TENANT } from '../../../utils/commands'; + +const miscUtils = new MiscUtils(cy); + +describe('Add flights dataset saved object', () => { + before(() => { + CURRENT_TENANT.newTenant = 'global'; + cy.deleteAllIndices(); + miscUtils.addSampleData(); + cy.wait(10000); + + // Enable the new home UI + cy.visit(`${BASE_PATH}/app/settings`); + cy.get( + '[data-test-subj="advancedSetting-editField-home:useNewHomePage"]' + ).then(($switch) => { + if ($switch.attr('aria-checked') === 'false') { + cy.wrap($switch).click(); + cy.get('[data-test-subj="advancedSetting-saveButton"]').click(); + cy.get('button.euiButton--primary.euiButton--small', { + timeout: 15000, + }).click(); + } else { + cy.log('The switch is already on.'); + } + }); + }); + + after(() => { + miscUtils.removeSampleData(); + // Disable the new home UI + cy.visit(`${BASE_PATH}/app/settings`); + cy.get( + '[data-test-subj="advancedSetting-editField-home:useNewHomePage"]' + ).then(($switch) => { + if ($switch.attr('aria-checked') === 'true') { + cy.wrap($switch).click(); + cy.get('[data-test-subj="advancedSetting-saveButton"]').click(); + cy.get('button.euiButton--primary.euiButton--small', { + timeout: 15000, + }).click(); + } else { + cy.log('The switch is already off.'); + } + }); + }); + + it('Verify component in maps listing page', () => { + cy.visit(`${BASE_PATH}/app/maps-dashboards`); + + // Verify the presence of the headerRightControl component + cy.get('[data-test-subj="headerRightControl"]').should('exist'); + + // Verify the presence of the maps createButton within the headerRightControl + cy.get('[data-test-subj="headerRightControl"]') + .find('[data-test-subj="createButton"]') + .should('exist'); + }); + + it('Verify component in maps visualization page', () => { + cy.visit(`${BASE_PATH}/app/maps-dashboards/create`); + + // Verify the presence of the top-nav component + cy.get('[data-test-subj="top-nav"]').should('exist'); + + // Verify the presence of the mapSaveButton inside the top-nav component + cy.get('[data-test-subj="top-nav"]') + .find('[data-test-subj="mapSaveButton"]') + .should('exist'); + }); +});