Skip to content

Commit

Permalink
Merge pull request opensearch-project#604 from TackAdam/cypApps
Browse files Browse the repository at this point in the history
Cypress v12.8.1 - Fixes for apps
  • Loading branch information
TackAdam authored Jul 17, 2023
2 parents 0272355 + f1cf307 commit 4e33b99
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 60 deletions.
92 changes: 46 additions & 46 deletions .cypress/integration/7_app_analytics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

/// <reference types="cypress" />
import { suppressResizeObserverIssue } from '../utils/constants';

import {
delay,
Expand Down Expand Up @@ -33,13 +34,14 @@ import {
TYPING_DELAY,
timeoutDelay
} from '../utils/app_constants';
import { suppressResizeObserverIssue } from '../utils/constants';

suppressResizeObserverIssue();//needs to be in file once

describe('Creating application', () => {
beforeEach(() => {
moveToCreatePage();
});

it('Suggests correct autocompletion', () => {
cy.get('[data-test-subj="logSourceAccordion"]').trigger('mouseover').click();
cy.get('[data-test-subj="searchAutocompleteTextArea"]').click();
Expand Down Expand Up @@ -85,15 +87,15 @@ describe('Creating application', () => {
cy.get('[data-test-subj="createButton"]').should('not.be.disabled');
cy.get('[data-test-subj="createAndSetButton"]').should('be.disabled');
expectMessageOnHover('createAndSetButton', 'Log source is required to set availability.');
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type(baseQuery, {delay: TYPING_DELAY});
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type(' ' + baseQuery);
cy.get('[data-test-subj="traceGroupsAccordion"]').trigger('mouseover').click();
cy.get('[data-test-subj="traceGroupsComboBox"]').scrollIntoView().type('http');
cy.get('.euiFilterSelectItem').contains(trace_one).trigger('click');
cy.get('.euiFilterSelectItem').contains(trace_two).trigger('click');
cy.get('[data-test-subj="traceGroupsCountBadge"]').should('contain', '2');
cy.get('[data-test-subj="createButton"]').should('not.be.disabled');
cy.get('[data-test-subj="createButton"]').click();
cy.wait(delay * 3);
cy.get('.euiTableRow').should('have.length.lessThan', 2);//Replaces Wait
cy.get('[data-test-subj="applicationTitle"]').should('contain', nameOne);
cy.get('[data-test-subj="app-analytics-panelTab"]').click();
cy.get('[data-test-subj="addFirstVisualizationText"]').should('exist');
Expand All @@ -112,10 +114,12 @@ describe('Creating application', () => {
cy
.get('[data-test-subj="searchAutocompleteTextArea"]')
.focus()
.type(baseQuery, {delay: TYPING_DELAY});
.type(' ' + baseQuery);
cy.get('[data-test-subj="servicesEntitiesAccordion"]').trigger('mouseover').click();
cy.get('[data-test-subj="servicesEntitiesComboBox"]').scrollIntoView();
cy.wait(delay*3);
cy.get('[data-test-subj="servicesEntitiesComboBox"]').trigger('mouseover').click();
cy.wait(delay*3);//Dropdown menu needs to work properly
cy.get('.euiFilterSelectItem').contains(service_one).click({ force: true });
cy.get('[data-test-subj="servicesEntitiesCountBadge"]').should('contain', '1');
cy.get('[data-test-subj="traceGroupsAccordion"]').trigger('mouseover').click();
Expand All @@ -124,7 +128,6 @@ describe('Creating application', () => {
cy.get('.euiFilterSelectItem').contains(trace_two).trigger('click');
cy.get('[data-test-subj="traceGroupsCountBadge"]').should('contain', '2');
cy.reload();
cy.wait(delay);
cy.get('[data-test-subj="nameFormRow"]').find('.euiFieldText').should('contain.value', nameOne);
cy.get('[data-test-subj="descriptionFormRow"]').find('.euiFieldText').should('contain.value', description);
cy.get('[data-test-subj="logSourceAccordion"]').trigger('mouseover').click();
Expand All @@ -136,7 +139,7 @@ describe('Creating application', () => {
it('Shows clear modals before clearing', () => {
cy.get('[data-test-subj="logSourceAccordion"]').trigger('mouseover').click();
cy.get('[data-test-subj="clearLogSourceButton"]').should('be.disabled');
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type(baseQuery, {delay: TYPING_DELAY});
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type(' ' + baseQuery);
cy.get('[data-test-subj="clearLogSourceButton"]').click();
cy.get('.euiButton--danger').contains('Clear').click();
cy.get('[data-test-subj="searchAutocompleteTextArea"]').should('contain.value', '');
Expand All @@ -159,25 +162,31 @@ describe('Creating application', () => {
});

it('Saves time range for each application', () => {
cy.wait(delay);//Fail to load without
cy.get('[data-test-subj="nameFormRow"]').type(nameTwo);
cy.get('[data-test-subj="logSourceAccordion"]').trigger('mouseover').click();
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type(baseQuery, {delay: TYPING_DELAY});
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type(' ' +baseQuery);
cy.get('[data-test-subj="createButton"]').should('not.be.disabled');
cy.get('[data-test-subj="createButton"]').click();
cy.get('.euiTableRow').should('have.length.lessThan', 1);
cy.get('[data-test-subj="applicationTitle"]').should('contain', nameTwo);
changeTimeTo24('weeks');
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 weeks');
cy.get('.euiBreadcrumb[href="#/application_analytics"]').click();
cy.wait(delay);
cy.get('.euiBreadcrumb[href="#/"]').click();
cy.get('.euiTableRow').should('have.length.greaterThan', 1);
cy.get(`[data-test-subj="${nameOne}ApplicationLink"]`).click();
cy.wait(delay*3);
cy.get('.euiTableRow').should('have.length.lessThan', 1);
cy.get('[data-test-subj="applicationTitle"]').should('contain', nameOne);
changeTimeTo24('months');
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
cy.get('.euiBreadcrumb[href="#/application_analytics"]').click();
cy.get('.euiBreadcrumb[href="#/"]').click();
cy.get('.euiTableRow').should('have.length.greaterThan', 1);
cy.get(`[data-test-subj="${nameTwo}ApplicationLink"]`).click();
cy.get('.euiTableRow').should('have.length.lessThan', 1);
cy.get('[data-test-subj="applicationTitle"]').should('contain', nameTwo);
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 weeks');
cy.get('.euiBreadcrumb[href="#/application_analytics"]').click();
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-applications#/`);
cy.get(`[data-test-subj="${nameOne}ApplicationLink"]`).click();
cy.get('[data-test-subj="applicationTitle"]').should('contain', nameOne);
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
Expand All @@ -190,18 +199,20 @@ describe('Setting availability', () => {
cy.get('[data-test-subj="nameFormRow"]').type(nameThree);
cy.get('[data-test-subj="logSourceAccordion"]').trigger('mouseover').click();
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus();
cy.focused().type('source = ', { delay: TYPING_DELAY });
cy.focused().type(' source = ',);
cy.focused().type('{enter}');
cy.get('[data-test-subj="createAndSetButton"]').click();
cy.wait(delay);//needed for page to create correctly
cy.get('[data-test-subj="createAndSetButton"]').click({ force: true });
cy.get('.euiTableRow').should('have.length.lessThan', 1);
cy.get('[data-test-subj="applicationTitle"]').should('contain', nameThree);
cy.get('.euiBreadcrumb[href="#/application_analytics"]').click();
cy.get('.euiBreadcrumb[href="#/"]').click();
cy.get('[data-test-subj="setAvailabilityHomePageLink"]').first().click();
cy.get('[data-test-subj="applicationTitle"]').should('contain', nameThree);
cy.get('.euiTab-isSelected[id="app-analytics-log"]').should('exist', { timeout: timeoutDelay });
cy.get('[data-test-subj="searchAutocompleteTextArea"]').should('contain.value', availability_default);
cy.get('[id="explorerPlotComponent"]').should('exist');
cy.get('.euiTab-isSelected[id="availability-panel"]').should('exist');
cy.get('.euiBreadcrumb[href="#/application_analytics"]').click();
cy.get('.euiBreadcrumb[href="#/"]').click();
cy.get(`[data-test-subj="${nameThree}ApplicationLink"]`).click();
cy.get('[data-test-subj="applicationTitle"]').should('contain', nameThree);
cy.get('[data-test-subj="app-analytics-configTab"]').click();
Expand All @@ -219,12 +230,13 @@ describe('Viewing application', () => {
});

it('Has working breadcrumbs', () => {
cy.wait(delay);//List not loading without
cy.get('.euiBreadcrumb').contains(nameOne).click();
cy.get('[data-test-subj="applicationTitle"]').should('contain', nameOne);
cy.get('.euiBreadcrumb[href="#/application_analytics"]').click();
cy.get('.euiBreadcrumb[href="#/"]').click();
cy.get('[data-test-subj="applicationHomePageTitle"]').should('contain', 'Applications');
cy.get('.euiBreadcrumb[href="observability-dashboards#/"]').click();
cy.get('[data-test-subj="eventHomePageTitle"]').should('contain', 'Event analytics');
cy.get('.euiBreadcrumb[href="observability-logs#/"]').click();
cy.get('[data-test-subj="eventHomePageTitle"]').should('contain', 'Logs');
});

it('Shares time range among tabs', () => {
Expand All @@ -233,7 +245,6 @@ describe('Viewing application', () => {
cy.get('[data-test-subj="app-analytics-serviceTab"]').click();
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
cy.get('[data-test-subj="app-analytics-traceTab"]').click();
suppressResizeObserverIssue();
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
cy.get('[data-test-subj="app-analytics-logTab"]').click();
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
Expand All @@ -249,6 +260,7 @@ describe('Viewing application', () => {
});

it('Adds filter when Trace group name is clicked', () => {
cy.wait(delay);//List not loading without
cy.get('[data-test-subj="app-analytics-overviewTab"]').click();
cy.get('[data-test-subj="dashboard-table-trace-group-name-button"]').contains('client_create_order').click();
cy.get('.euiTableRow').should('have.length', 1, { timeout: timeoutDelay });
Expand All @@ -260,9 +272,7 @@ describe('Viewing application', () => {

it('Opens service detail flyout when Service Name is clicked', () => {
cy.get('[data-test-subj="app-analytics-serviceTab"]').click();
cy.wait(delay);
cy.get('.euiLink').contains('authentication').click();
suppressResizeObserverIssue();
cy.get('[data-test-subj="serviceDetailFlyoutTitle"]').should('be.visible');
cy.get('[data-test-subj="serviceDetailFlyout"]').within(($flyout) => {
cy.get('[data-test-subj="Number of connected servicesDescriptionList"]').should('contain', '3');
Expand All @@ -273,34 +283,29 @@ describe('Viewing application', () => {
cy.get('[data-test-subj="spanDetailFlyout"]').contains('Span detail').should('be.visible');
cy.get('[data-test-subj="ServiceDescriptionList"]').should('contain', 'authentication');
cy.get('[data-test-subj="euiFlyoutCloseButton"]').click();
cy.get('[data-test-subj="serviceDetailFlyout"]').should('not.be.visible');
cy.get('[data-test-subj="spanDetailFlyout"]').should('not.be.visible');
cy.get('[data-test-subj="serviceDetailFlyout"]').should('not.exist');
cy.get('[data-test-subj="spanDetailFlyout"]').should('not.exist');
});

it('Opens trace detail flyout when Trace ID is clicked', () => {
cy.get('[data-test-subj="app-analytics-traceTab"]').click();
suppressResizeObserverIssue();
cy.wait(delay);
cy.get('[title="03f9c770db5ee2f1caac0afc36db49ba"]').click();
cy.get('[data-test-subj="traceDetailFlyoutTitle"]').should('be.visible');
cy.get('[data-test-subj="traceDetailFlyout"]').within(($flyout) => {
cy.get('[data-test-subj="LatencyDescriptionList"]').should('contain', '224.99');
});
cy.get('[data-test-subj="euiFlyoutCloseButton"]').click();
cy.wait(delay);
cy.get('[data-test-subj="traceDetailFlyout"]').should('not.be.visible');
cy.get('[data-test-subj="traceDetailFlyout"]').should('not.exist');
cy.get('[title="03f9c770db5ee2f1caac0afc36db49ba"]').click();
cy.get('[data-text="Span list"]').click();
cy.wait(delay);
cy.get('[data-test-subj="dataGridRowCell"] button').contains('d67c5bb617ba9203').click();
cy.get('[data-test-subj="spanDetailFlyout"]').should('be.visible');
cy.get('[data-test-subj="euiFlyoutCloseButton"]').click();
cy.get('[data-test-subj="spanDetailFlyout"]').should('not.be.visible');
cy.get('[data-test-subj="spanDetailFlyout"]').should('not.exist');
});

it('Opens span detail flyout when Span ID is clicked', () => {
cy.get('[data-test-subj="app-analytics-traceTab"]').click();
suppressResizeObserverIssue();
cy.wait(delay);
cy.get('[data-test-subj="dataGridRowCell"]').contains('5ff3516909562c60').click();
cy.get('[data-test-subj="spanDetailFlyout"]').should('be.visible');
Expand All @@ -326,18 +331,14 @@ describe('Viewing application', () => {
it('Saves visualization #1 to panel', () => {
cy.get('[data-test-subj="app-analytics-panelTab"]').click();
cy.get('[data-test-subj="addVisualizationButton"]').first().click();
cy.wait(delay);
cy.get('[id="explorerPlotComponent"]').should('exist');
cy.get('[data-test-subj="searchAutocompleteTextArea"]').click();
cy.get('.aa-List').find('.aa-Item').should('have.length', 11);
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type(query_one, {delay: TYPING_DELAY});
changeTimeTo24('months');
cy.wait(delay * 2);
cy.get('[data-test-subj="main-content-visTab"]').click();
suppressResizeObserverIssue();
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click();
cy.get('[data-test-subj="eventExplorer__querySaveName"]').click().type(visOneName);
cy.wait(delay);
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]').click();
cy.wait(delay);
cy.get('[data-test-subj="app-analytics-panelTab"]').click();
Expand All @@ -351,12 +352,14 @@ describe('Viewing application', () => {
cy.get('[data-test-subj="app-analytics-panelTab"]').click();
cy.get('[aria-label="actionMenuButton"]').click();
cy.get('[data-test-subj="editVizContextMenuItem"]').click();
suppressResizeObserverIssue();
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
cy.get('.euiTab[id="availability-panel"]').click();
cy.get('[title="Bar"]').click();
cy.focused().type('{downArrow}');

cy.wait(delay);
cy.get('[data-test-subj="comboBoxInput"]').click();
cy.get('[data-test-subj="comboBoxOptionsList "] button span').contains('Time series').click({ force: true });
cy.focused().type('{enter}');

cy.get('[data-test-subj="addAvailabilityButton"]').click();
cy.get('[data-test-subj="euiColorPickerAnchor"]').click();
cy.get('[aria-label="Select #54B399 as the color"]').click();
Expand All @@ -376,7 +379,7 @@ describe('Viewing application', () => {
cy.get('[id="explorerPlotComponent"]').should('exist');
cy.get('[class="lines"]').should('exist');
cy.get('.textpoint').contains('Available').should('exist');
cy.get('.euiBreadcrumb[href="#/application_analytics"]').click();
cy.get('.euiBreadcrumb[href="#/"]').click();
cy.get('[data-test-subj="AvailableAvailabilityBadge"]').should('contain', 'Available');
cy.get('[data-test-subj="AvailableAvailabilityBadge"][style="background-color: rgb(84, 179, 153); color: rgb(0, 0, 0);"]').should('exist');
});
Expand All @@ -389,12 +392,10 @@ describe('Viewing application', () => {
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
cy.wait(delay);
cy.get('[data-test-subj="main-content-visTab"]').click();
suppressResizeObserverIssue();
cy.get('.euiTab[id="availability-panel"]').click();
cy.get('[title="Bar"]').click();
cy.focused().type('{downArrow}');
cy.focused().type('{enter}');
cy.wait(delay);
cy.get('[data-test-subj="comboBoxInput"]').click();
cy.get('[data-test-subj="comboBoxOptionsList "] button span').contains('Time series').click({ force: true });
cy.get('[data-test-subj="addAvailabilityButton"]').click();
cy.get('[data-test-subj="euiColorPickerAnchor"]').click();
cy.get('[aria-label="Select #9170B8 as the color"]').click();
Expand Down Expand Up @@ -483,7 +484,7 @@ describe('Separate from other plugins', () => {

it('Hides application visualizations in Operational Panels', () => {
cy.visit(
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/operational_panels/`
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/`
);
cy.get('[data-test-subj="operationalPanelsActionsButton"]', { timeout: timeoutDelay }).click();
cy.get('[data-test-subj="addSampleContextMenuItem"]', { timeout: timeoutDelay }).click();
Expand All @@ -499,7 +500,7 @@ describe('Separate from other plugins', () => {

it('Hides application panels in Operational Panels', () => {
cy.visit(
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/operational_panels/`
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/`
);
cy.get('[data-test-subj="operationalPanelSearchBar"]', { timeout: timeoutDelay }).type(`${nameOne}'s Panel`, {delay: TYPING_DELAY});
cy.get('.euiTableCellContent__text').contains('No items found').should('exist');
Expand Down Expand Up @@ -589,7 +590,6 @@ describe('Application Analytics home page', () => {
cy.get('[data-test-subj="deleteApplicationContextMenuItem"]').click();
cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete');
cy.get('[data-test-subj="popoverModal__deleteButton"').click();
cy.wait(delay);
cy.get('.euiToast').contains(`Applications successfully deleted!`);
cy.get(`[data-test-subj="${newName}ApplicationLink"]`).should('not.exist');
});
Expand Down
Loading

0 comments on commit 4e33b99

Please sign in to comment.