Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new home ui test for maps #1542

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
});
});
Original file line number Diff line number Diff line change
@@ -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');
});
});
Loading