|
| 1 | +/* |
| 2 | + * Copyright OpenSearch Contributors |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
| 6 | +/* eslint-disable */ |
| 7 | +import { |
| 8 | + MiscUtils, |
| 9 | + CommonUI, |
| 10 | + LoginPage, |
| 11 | +} from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; |
| 12 | + |
| 13 | +const miscUtils = new MiscUtils(cy); |
| 14 | +const commonUI = new CommonUI(cy); |
| 15 | +const loginPage = new LoginPage(cy); |
| 16 | + |
| 17 | +describe('check dashboards filter and query', () => { |
| 18 | + beforeEach(() => { |
| 19 | + miscUtils.visitPage('app/dashboards#'); |
| 20 | + loginPage.enterUserName('admin'); |
| 21 | + loginPage.enterPassword('admin'); |
| 22 | + loginPage.submit(); |
| 23 | + }); |
| 24 | + |
| 25 | + afterEach(() => { |
| 26 | + cy.clearCookies(); |
| 27 | + }); |
| 28 | + |
| 29 | + it('tenant-switch-modal page should show and be clicked', () => { |
| 30 | + cy.get('[data-test-subj="tenant-switch-modal"]'); |
| 31 | + cy.get('[data-test-subj="confirm"]').click(); |
| 32 | + }); |
| 33 | + |
| 34 | + describe('osx filter and query should work in [Logs] Web Traffic dashboards', () => { |
| 35 | + beforeEach(() => { |
| 36 | + cy.get('[data-test-subj="dashboardListingTitleLink-[Logs]-Web-Traffic"]').click(); |
| 37 | + cy.get('[data-test-subj="breadcrumb last"]') |
| 38 | + .invoke('attr', 'title') |
| 39 | + .should('eq', '[Logs] Web Traffic'); |
| 40 | + }); |
| 41 | + |
| 42 | + it('osx filter and query should exist and be named correctly', () => { |
| 43 | + cy.get('[data-test-subj="saved-query-management-popover-button"]').click(); |
| 44 | + cy.get('[data-test-subj="saved-query-management-popover"]') |
| 45 | + .find('[class="osdSavedQueryListItem__labelText"]') |
| 46 | + .should('have.text', 'test-query') |
| 47 | + .click(); |
| 48 | + cy.get('[data-test-subj="queryInput"]').should('have.text', 'resp=200'); |
| 49 | + cy.get( |
| 50 | + '[data-test-subj="filter filter-enabled filter-key-machine.os filter-value-osx filter-unpinned "]' |
| 51 | + ) |
| 52 | + .should('have.text', 'osx filter') |
| 53 | + .click(); |
| 54 | + cy.get('[data-test-subj="editFilter"]').click(); |
| 55 | + cy.get('[data-test-subj="filterFieldSuggestionList"]') |
| 56 | + .find('[data-test-subj="comboBoxInput"]') |
| 57 | + .should('have.text', 'machine.os'); |
| 58 | + cy.get('[data-test-subj="filterOperatorList"]') |
| 59 | + .find('[data-test-subj="comboBoxInput"]') |
| 60 | + .should('have.text', 'is'); |
| 61 | + cy.get('[data-test-subj="filterParams"]').find('input').should('have.value', 'osx'); |
| 62 | + }); |
| 63 | + |
| 64 | + it('osx filter and query should function correctly', () => { |
| 65 | + cy.get('[data-test-subj="saved-query-management-popover-button"]').click(); |
| 66 | + cy.get('[data-test-subj="saved-query-management-popover"]') |
| 67 | + .find('[class="osdSavedQueryListItem__labelText"]') |
| 68 | + .should('have.text', 'test-query') |
| 69 | + .click(); |
| 70 | + commonUI.setDateRange('Dec 1, 2021 @ 00:00:00.000', 'Jan 1, 2021 @ 00:00:00.000'); |
| 71 | + |
| 72 | + //[Logs] vistor chart should show osx 100% |
| 73 | + cy.get('[data-title="[Logs] Visitors by OS"]') |
| 74 | + .find('[class="label"]') |
| 75 | + .should('have.text', 'osx (100%)'); |
| 76 | + |
| 77 | + //[Logs] Response chart should show 200 label |
| 78 | + cy.get('[data-title="[Logs] Response Codes Over Time + Annotations"]') |
| 79 | + .find('[title="200"]') |
| 80 | + .should('have.text', '200'); |
| 81 | + }); |
| 82 | + }); |
| 83 | +}); |
0 commit comments