From c2ed21d256bb52d90a2632593743ba7cd8e42535 Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Thu, 14 Oct 2021 15:40:56 +0000 Subject: [PATCH] Add bwc sample tests tests include the following cases: verify default page work verify advanced savings work verify filter and query work Disable eslint check Add eslint-disable comment Revise license content in plugins and support Simplify filter and query test modify test name and fix PR comment update license header and remove env files Particailly Resolved: https://github.com/opensearch-project/opensearch-build/issues/705 Signed-off-by: Anan Zhuang --- .../bundled-osd/check_advanced_settings.js | 43 ++++++++++++ .../bundled-osd/check_default_page.js | 27 ++++++++ .../bundled-osd/check_filter_and_query.js | 69 +++++++++++++++++++ 3 files changed, 139 insertions(+) create mode 100644 cypress/integration/bundled-osd/check_advanced_settings.js create mode 100644 cypress/integration/bundled-osd/check_default_page.js create mode 100644 cypress/integration/bundled-osd/check_filter_and_query.js diff --git a/cypress/integration/bundled-osd/check_advanced_settings.js b/cypress/integration/bundled-osd/check_advanced_settings.js new file mode 100644 index 000000000000..6524f6a19adf --- /dev/null +++ b/cypress/integration/bundled-osd/check_advanced_settings.js @@ -0,0 +1,43 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* 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 the advanced settings are saved', () => { + beforeEach(() => { + miscUtils.visitPage('app/management/opensearch-dashboards/settings'); + loginPage.enterUserName('admin'); + loginPage.enterPassword('admin'); + loginPage.submit(); + }); + + it('the dark mode is on', () => { + cy.get('[data-test-subj="advancedSetting-editField-theme:darkMode"]') + .invoke('attr', 'aria-checked') + .should('eq', 'true'); + }); + + it('the Timeline default columns field is set to 4', () => { + cy.get('[data-test-subj="advancedSetting-editField-timeline:default_columns"]').should( + 'have.value', + 4 + ); + }); + + it('the Timeline Maximum buckets field is set to 4', () => { + cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').should( + 'have.value', + 4 + ); + }); +}); diff --git a/cypress/integration/bundled-osd/check_default_page.js b/cypress/integration/bundled-osd/check_default_page.js new file mode 100644 index 000000000000..b4c46a383def --- /dev/null +++ b/cypress/integration/bundled-osd/check_default_page.js @@ -0,0 +1,27 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* 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 default landing page work for bwc', () => { + beforeEach(() => { + miscUtils.visitPage(''); + loginPage.enterUserName('admin'); + loginPage.enterPassword('admin'); + loginPage.submit(); + }); + + it('the overview page is set as the default landing page', () => { + cy.url().should('include', '/app/opensearch_dashboards_overview#/'); + }); +}); diff --git a/cypress/integration/bundled-osd/check_filter_and_query.js b/cypress/integration/bundled-osd/check_filter_and_query.js new file mode 100644 index 000000000000..f1de39771635 --- /dev/null +++ b/cypress/integration/bundled-osd/check_filter_and_query.js @@ -0,0 +1,69 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* es-lint-disable for missing definitions */ +/* eslint-disable */ +import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; + +const miscUtils = new MiscUtils(cy); + +describe('check dashboards filter and query', () => { + beforeEach(() => { + miscUtils.visitPage('app/dashboards#'); + }); + + afterEach(() => { + cy.clearCookies(); + }); + + describe('osx filter and query should work in [Logs] Web Traffic dashboards', () => { + beforeEach(() => { + cy.get('[data-test-subj="dashboardListingTitleLink-[Logs]-Web-Traffic"]').click(); + cy.get('[data-test-subj="breadcrumb last"]') + .invoke('attr', 'title') + .should('eq', '[Logs] Web Traffic'); + }); + + it('osx filter and query should exist and be named correctly', () => { + cy.get('[data-test-subj="saved-query-management-popover-button"]').click(); + cy.get('[data-test-subj="saved-query-management-popover"]') + .find('[class="osdSavedQueryListItem__labelText"]') + .should('have.text', 'test-query') + .click(); + cy.get('[data-test-subj="queryInput"]').should('have.text', 'resp=200'); + cy.get( + '[data-test-subj="filter filter-enabled filter-key-machine.os filter-value-osx filter-unpinned "]' + ) + .should('have.text', 'osx filter') + .click(); + cy.get('[data-test-subj="editFilter"]').click(); + cy.get('[data-test-subj="filterFieldSuggestionList"]') + .find('[data-test-subj="comboBoxInput"]') + .should('have.text', 'machine.os'); + cy.get('[data-test-subj="filterOperatorList"]') + .find('[data-test-subj="comboBoxInput"]') + .should('have.text', 'is'); + cy.get('[data-test-subj="filterParams"]').find('input').should('have.value', 'osx'); + }); + + it('osx filter and query should function correctly', () => { + cy.get('[data-test-subj="saved-query-management-popover-button"]').click(); + cy.get('[data-test-subj="saved-query-management-popover"]') + .find('[class="osdSavedQueryListItem__labelText"]') + .should('have.text', 'test-query') + .click(); + + //[Logs] vistor chart should show osx 100% + cy.get('[data-title="[Logs] Visitors by OS"]') + .find('[class="label"]') + .should('have.text', 'osx (100%)'); + + //[Logs] Response chart should show 200 label + cy.get('[data-title="[Logs] Response Codes Over Time + Annotations"]') + .find('[title="200"]') + .should('have.text', '200'); + }); + }); +}); \ No newline at end of file