Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress v12.8.1 - Fixes for apps #604

Merged
merged 4 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 50 additions & 45 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);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-06-29 at 2 23 47 PM This field seemed to incorrectly type regardless of delay applied. The error always occurred in the first 3-5 letters, adding whitespace allows it to execute correctly and the whitespace is ignored in the application. This greatly increases run-speed as well as preventing the mis-typed log source.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know this hack 😄 Also, did you try looking deeper on why it fails to type correctly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to find any specific cause for the mis-typing just that it is a known issue and most people add very long delays to attempt to fix it. This field specifically was only encountering the error at the start after testing a lot of possible fixes / ideas I had this seemed to be the only 100% reliable one.

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with 0 or something more clear?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-07-17 at 10 57 17 AM

Other objects on the new page are considered table but have nothing in them so below 0 doesn't work.

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 @@ -325,19 +330,15 @@ 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('[data-test-subj="addVisualizationButton"]').last().click();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why changing from first to last?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both options perform the same, not sure why i switched it, replacing it with first as it was originally

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,15 @@ 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.wait(delay);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe a button use to be required to be hit before adding availability that no longer exist.

cy.get('[data-test-subj="comboBoxInput"]').click();
cy.focused().type('{downArrow}');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate to below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was used to select TimeSeries as the third option by going down twice, adding a commit to make this more clear and select it in a better way. It previously selected Horizontal Bar which did not have the availability function.

cy.focused().type('{downArrow}');
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 @@ -372,11 +376,12 @@ describe('Viewing application', () => {
cy.get('[data-test-subj="visualizeEditorRenderButton"]').click();
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click();
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]').click();
cy.wait(delay*5);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think its safe to remove, was a problem originally but seems to be working without.

cy.get('[data-test-subj="app-analytics-panelTab"]').click();
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 +394,13 @@ 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.wait(delay);
cy.get('[data-test-subj="comboBoxInput"]').click();
cy.focused().type('{downArrow}');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate to line below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was used to select TimeSeries as the third option by going down twice, adding a commit to make this more clear and select it in a better way. It previously selected Horizontal Bar which did not have the availability function.

cy.focused().type('{downArrow}');
cy.focused().type('{enter}');
cy.wait(delay);

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 +489,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 +505,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 +595,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
Loading