|
| 1 | +/* |
| 2 | + * SPDX-License-Identifier: Apache-2.0 |
| 3 | + * |
| 4 | + * The OpenSearch Contributors require contributions made to |
| 5 | + * this file be licensed under the Apache-2.0 license or a |
| 6 | + * compatible open source license. |
| 7 | + */ |
| 8 | + |
| 9 | +/* |
| 10 | + * SPDX-License-Identifier: Apache-2.0 |
| 11 | + * |
| 12 | + * The OpenSearch Contributors require contributions made to |
| 13 | + * this file be licensed under the Apache-2.0 license or a |
| 14 | + * compatible open source license. |
| 15 | + * |
| 16 | + * Modifications Copyright OpenSearch Contributors. See |
| 17 | + * GitHub history for details. |
| 18 | + */ |
| 19 | + |
| 20 | +/* |
| 21 | + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 22 | + * |
| 23 | + * Licensed under the Apache License, Version 2.0 (the "License"). |
| 24 | + * You may not use this file except in compliance with the License. |
| 25 | + * A copy of the License is located at |
| 26 | + * |
| 27 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 28 | + * |
| 29 | + * or in the "license" file accompanying this file. This file is distributed |
| 30 | + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 31 | + * express or implied. See the License for the specific language governing |
| 32 | + * permissions and limitations under the License. |
| 33 | + */ |
| 34 | + |
| 35 | +import { |
| 36 | + MiscUtils, |
| 37 | + CommonUI, |
| 38 | + LoginPage, |
| 39 | +} from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; |
| 40 | + |
| 41 | +const commonUI = new CommonUI(cy); |
| 42 | +const miscUtils = new MiscUtils(cy); |
| 43 | +const loginPage = new LoginPage(cy); |
| 44 | + |
| 45 | +describe('verify dashboards filter and query work properly for bwc', () => { |
| 46 | + beforeEach(() => { |
| 47 | + miscUtils.visitPage('app/dashboards#'); |
| 48 | + loginPage.enterUserName('admin'); |
| 49 | + loginPage.enterPassword('admin'); |
| 50 | + loginPage.submit(); |
| 51 | + }); |
| 52 | + |
| 53 | + afterEach(() => { |
| 54 | + cy.clearCookies(); |
| 55 | + }); |
| 56 | + |
| 57 | + it('tenant-switch-modal page should show and be clicked', () => { |
| 58 | + cy.get('[data-test-subj="tenant-switch-modal"]'); |
| 59 | + cy.get('[data-test-subj="confirm"]').click(); |
| 60 | + }); |
| 61 | + |
| 62 | + describe('osx filter and query should work in [Logs] Web Traffic dashboards', () => { |
| 63 | + beforeEach(() => { |
| 64 | + cy.get('[data-test-subj="dashboardListingTitleLink-[Logs]-Web-Traffic"]').click(); |
| 65 | + cy.get('[data-test-subj="breadcrumb last"]') |
| 66 | + .invoke('attr', 'title') |
| 67 | + .should('eq', '[Logs] Web Traffic'); |
| 68 | + }); |
| 69 | + |
| 70 | + it('osx filter and query should exist and be named correctly', () => { |
| 71 | + cy.get('[data-test-subj="saved-query-management-popover-button"]').click(); |
| 72 | + cy.get('[data-test-subj="saved-query-management-popover"]') |
| 73 | + .find('[class="osdSavedQueryListItem__labelText"]') |
| 74 | + .should('have.text', 'test-query') |
| 75 | + .click(); |
| 76 | + cy.get('[data-test-subj="queryInput"]').should('have.text', 'resp=200'); |
| 77 | + cy.get( |
| 78 | + '[data-test-subj="filter filter-enabled filter-key-machine.os filter-value-osx filter-unpinned "]' |
| 79 | + ) |
| 80 | + .should('have.text', 'osx filter') |
| 81 | + .click(); |
| 82 | + cy.get('[data-test-subj="editFilter"]').click(); |
| 83 | + cy.get('[data-test-subj="filterFieldSuggestionList"]') |
| 84 | + .find('[data-test-subj="comboBoxInput"]') |
| 85 | + .should('have.text', 'machine.os'); |
| 86 | + cy.get('[data-test-subj="filterOperatorList"]') |
| 87 | + .find('[data-test-subj="comboBoxInput"]') |
| 88 | + .should('have.text', 'is'); |
| 89 | + cy.get('[data-test-subj="filterParams"]').find('input').should('have.value', 'osx'); |
| 90 | + }); |
| 91 | + |
| 92 | + it('osx filter and query should function correctly', () => { |
| 93 | + commonUI.setDateRange('Oct 10, 2021 @ 00:00:00.000', 'Oct 4, 2021 @ 00:00:00.000'); |
| 94 | + cy.get('[data-test-subj="saved-query-management-popover-button"]').click(); |
| 95 | + cy.get('[data-test-subj="saved-query-management-popover"]') |
| 96 | + .find('[class="osdSavedQueryListItem__labelText"]') |
| 97 | + .should('have.text', 'test-query') |
| 98 | + .click(); |
| 99 | + cy.get('[data-test-subj="dashboardPanel"]').each((item) => { |
| 100 | + const vsLoader = item.get('[data-test-subj="visualizationLoader"]'); |
| 101 | + //[Logs] unique visitors should be 211 |
| 102 | + if ( |
| 103 | + vsLoader && |
| 104 | + vsLoader |
| 105 | + .get('[data-test-subj="visualizationLoader"]') |
| 106 | + .find('[class="chart-title"]') |
| 107 | + .should('have.text', 'Unique Visitors') |
| 108 | + ) { |
| 109 | + vsLoader.should('have.class', 'chart-label').should('have.text', '211'); |
| 110 | + } |
| 111 | + //[Logs] vistor chart should show osx 100% |
| 112 | + if ( |
| 113 | + vsLoader && |
| 114 | + vsLoader.get('[data-test-subj="visualizationLoader"]').invoke('css', 'data-title') === |
| 115 | + '[Logs] Visitors by OS' |
| 116 | + ) { |
| 117 | + vsLoader.should('have.class', 'label').should('have.text', 'osx (100%)'); |
| 118 | + } |
| 119 | + //[Logs] Response chart should show 200 label |
| 120 | + if ( |
| 121 | + vsLoader && |
| 122 | + vsLoader.get('[data-test-subj="visualizationLoader"]').invoke('css', 'data-title') === |
| 123 | + '[Logs] Response Codes Over Time + Annotations' |
| 124 | + ) { |
| 125 | + vsLoader |
| 126 | + .should('have.class', 'echLegendItem__label echLegendItem__label--clickable') |
| 127 | + .should('have.text', '200'); |
| 128 | + } |
| 129 | + }); |
| 130 | + }); |
| 131 | + }); |
| 132 | +}); |
0 commit comments