Skip to content

Commit

Permalink
Add more bwc tests for osd with bundles
Browse files Browse the repository at this point in the history
This PR adds the following bwc tests:
1)verify sample data work properly for bwc
2)verify timeline visualization work properly for bwc

Partically Resolved:
opensearch-project/opensearch-build#705

Signed-off-by: Anan Zhuang <[email protected]>
  • Loading branch information
ananzh committed Nov 5, 2021
1 parent cde8a78 commit f1bd528
Show file tree
Hide file tree
Showing 2 changed files with 209 additions and 0 deletions.
122 changes: 122 additions & 0 deletions cypress/integration/bundled-osd/check_sample_data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/* es-lint-disable for missing definitions */
/* eslint-disable */
import { MiscUtils, CommonUI, LoginPage } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';

const miscUtils = new MiscUtils(cy);
const commonUI = new CommonUI(cy);
const loginPage = new LoginPage(cy);

describe('verify sample data work properly for bwc', () => {
beforeEach(() => {
miscUtils.visitPage('app/dashboards#');
loginPage.enterUserName('admin');
loginPage.enterPassword('admin');
loginPage.submit();
});

afterEach(() => {
cy.clearCookies();
});

it('sample data should be loaded to dashboards', () => {
let items = cy.get('[data-test-subj="itemsInMemTable"]');

items.get('[data-test-subj="dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard"]')
.should('have.text', '[Flights] Global Flight Dashboard');

items.get('[data-test-subj="dashboardListingTitleLink-[Logs]-Web-Traffic"]')
.should('have.text', '[Logs] Web Traffic');

items.get('[data-test-subj="dashboardListingTitleLink-[eCommerce]-Revenue-Dashboard"]')
.should('have.text', '[eCommerce] Revenue Dashboard');
});

describe('Global Flight Dashboard should function properly', () => {
beforeEach(() => {
cy.get('[data-test-subj="itemsInMemTable"]')
.get('[data-test-subj="dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard"]')
.click();
commonUI.removeAllFilters();
});

it('Global Flight Dashboard is loaded when clicked', () => {
cy.get('[data-test-subj="breadcrumb last"]').should('have.text', '[Flights] Global Flight Dashboard');
cy.get('[data-title="[Flights] Total Flights"]').should('exist');
cy.get('[data-title="[Flights] Average Ticket Price"]').should('exist');
});

it('If set filter for carrier, [Flights] Airline Carrier should show correct carrier', () => {
commonUI.addFilterRetrySelection('Carrier', 'is', 'JetBeats');
cy.get('[data-title="[Flights] Airline Carrier"]')
.find('[class="label-text"]')
.should('have.text', 'JetBeats (100%)');
});

it('If set filter for OriginCityName, [Flights] Flight Log should only display flights from correct city', () => {
commonUI.addFilterRetrySelection('OriginCityName', 'is', 'Osaka');
cy.get('[data-test-subj="docTableExpandToggleColumn"]').each($item => {
cy.wrap($item)
.click()
.get('[data-test-subj="tableDocViewRow-OriginCityName-value"]')
.contains('Osaka');
});
});
});

describe('eCommerce Revenue Dashboard should function properly', () => {
beforeEach(() => {
cy.get('[data-test-subj="itemsInMemTable"]')
.get('[data-test-subj="dashboardListingTitleLink-[eCommerce]-Revenue-Dashboard"]')
.click();
commonUI.removeAllFilters();
});

it('eCommerce Revenue Dashboard is loaded when clicked', () => {
cy.get('[data-test-subj="breadcrumb last"]').should('have.text', '[eCommerce] Revenue Dashboard');
cy.get('[data-title="[eCommerce] Average Sales Price"]').should('exist');
cy.get('[data-title="[eCommerce] Average Sold Quantity"]').should('exist');
});

it('If set filter for gender, [eCommerce] Sales by Gender should show one gender', () => {
commonUI.addFilterRetrySelection('customer_gender', 'is', 'FEMALE');
cy.get('[data-title="[eCommerce] Sales by Gender"]')
.find('[class="label-text"]')
.should('have.text', 'FEMALE (100%)');
})

it('If filter out Women\'s Clothing, [eCommerce] Sales by Category should not show this category', () => {
commonUI.addFilterRetrySelection('category', 'is not', "Women's Clothing");
let category = cy.get('[data-title="[eCommerce] Sales by Category"]')
category.find('[data-label="Men\'s Clothing"]').should('exist');
category.find('[data-label="Women\'s Clothing"]').should('not.exist');
});
});
});
87 changes: 87 additions & 0 deletions cypress/integration/bundled-osd/check_timeline.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/* es-lint-disable for missing definitions */
/* eslint-disable */
import { MiscUtils, LoginPage } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';

const miscUtils = new MiscUtils(cy);
const loginPage = new LoginPage(cy);

describe('verify timeline visualization work properly for bwc', () => {
beforeEach(() => {
miscUtils.visitPage('app/visualize#');
loginPage.enterUserName('admin');
loginPage.enterPassword('admin');
loginPage.submit();
});

afterEach(() => {
cy.clearCookies();
});

it('tenant-switch-modal page should show and be clicked', () => {
cy.get('[data-test-subj="tenant-switch-modal"]');
cy.get('[data-test-subj="confirm"]').click();
});

it('timeline visualizations should be saved and named correctly', () => {
cy.get('[data-test-subj="visualizationLandingPage"]')
.find('[class="euiFormControlLayout__childrenWrapper"]')
.type('timeline');
cy.get('[data-test-subj="visListingTitleLink-test-timeline"]').should('have.text', 'test-timeline').click();
cy.get('[class="view-line"]').contains('.es(*)');
});

describe('timeline visualizations should work properly', () => {
beforeEach(() => {
cy.get('[data-test-subj="visualizationLandingPage"]')
.find('[data-test-subj="newItemButton"]')
.click();
cy.get('[data-test-subj="visType-timelion"]').click();
});

it('.es(*, kibana1=true should report search error', () => {
cy.get('[class="view-line"]').type('{selectall}{backspace}, kibana1=true)');
cy.get('[data-test-subj="visualizeEditorRenderButton"]').click();
cy.get('[data-test-subj="globalToastList"]').find('[data-test-subj="errorToastMessage"]').contains('Timeline request error: undefined Error: Unknown argument to es: kibana1')
});

it('.es(*, kibana=true should not report search error', () => {
cy.get('[class="view-line"]').type('{selectall}{backspace}, kibana=true)');
cy.get('[data-test-subj="visualizeEditorRenderButton"]').click();
cy.get('[data-test-subj="globalToastList"]').find('[data-test-subj="errorToastMessage"]').should('not.exist')
});

it('.es(*, opensearchDashboards=true should not report search error', () => {
cy.get('[class="view-line"]').type('{selectall}{backspace}, opensearchDashboards=true)');
cy.get('[data-test-subj="visualizeEditorRenderButton"]').click();
cy.get('[data-test-subj="globalToastList"]').find('[data-test-subj="errorToastMessage"]').should('not.exist')
});
});
});

0 comments on commit f1bd528

Please sign in to comment.