Skip to content

Commit

Permalink
Fix test to check for empty event analytics (#669)
Browse files Browse the repository at this point in the history
Signed-off-by: Eugene Lee <eugenesk@amazon.com>
  • Loading branch information
eugenesk24 authored Apr 19, 2022
1 parent aaeadb0 commit 4ee5d2a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
48 changes: 25 additions & 23 deletions dashboards-observability/.cypress/integration/app_analytics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
trace_one,
trace_two,
trace_three,
query_one,
query_two,
visOneName,
visTwoName,
composition,
Expand Down Expand Up @@ -348,7 +350,7 @@ describe('Viewing application', () => {
cy.get('.aa-List').find('.aa-Item').should('have.length', 11);
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type('x', {delay: TYPING_DELAY});
cy.focused().clear();
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type('where DestCityName = "Venice" | stats count() by span( timestamp , 6h )', {delay: TYPING_DELAY});
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type(query_one, {delay: TYPING_DELAY});
changeTimeTo24('months');
cy.wait(delay * 2);
cy.get('.euiTab').contains('Visualizations').click();
Expand Down Expand Up @@ -412,7 +414,7 @@ describe('Viewing application', () => {
cy.get('[data-test-subj="searchAutocompleteTextArea"]').clear();
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type('x', {delay: TYPING_DELAY});
cy.focused().clear();
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type('where DestCityName = "Venice" | stats count() by span( timestamp , 6h )', {delay: TYPING_DELAY});
cy.get('[data-test-subj="searchAutocompleteTextArea"]').focus().type(query_two, {delay: TYPING_DELAY});
cy.get('.euiButton').contains('Refresh').click();
cy.wait(delay);
cy.get('.euiTab').contains('Visualizations').click();
Expand Down Expand Up @@ -481,30 +483,30 @@ describe('Viewing application', () => {
it('Hides application visualizations in Event Analytics', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/event_analytics`);
cy.wait(delay*3);
if (cy.get('.euiFieldSearch').length > 1) {
if (cy.get('.euiButton').length == 2) {
cy.get('input.euiFieldSearch').type(visOneName, {delay: TYPING_DELAY});
cy.wait(delay);
cy.get('.euiTableCellContent__text').contains('No items found').should('exist');
cy.get('input.euiFieldSearch').clear().type(visTwoName, {delay: TYPING_DELAY});
cy.wait(delay);
cy.get('.euiTableCellContent__text').contains('No items found').should('exist');
cy.get('.euiFormControlLayoutClearButton').click();
cy.wait(delay);
cy.get('[data-test-subj="tablePaginationPopoverButton"]').click();
cy.get('.euiContextMenuItem__text').contains('50 rows').click();
cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]').click();
cy.wait(delay);
cy.get('.euiButton__text').contains('Actions').click();
cy.wait(delay);
cy.get('.euiContextMenuItem__text').contains('Delete').click();
cy.wait(delay);
cy.wait(delay);
cy.get('.euiTableCellContent__text').contains('No items found').should('exist');
cy.get('input.euiFieldSearch').clear().type(visTwoName, {delay: TYPING_DELAY});
cy.wait(delay);
cy.get('.euiTableCellContent__text').contains('No items found').should('exist');
cy.get('.euiFormControlLayoutClearButton').click();
cy.wait(delay);
cy.get('[data-test-subj="tablePaginationPopoverButton"]').click();
cy.get('.euiContextMenuItem__text').contains('50 rows').click();
cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]').click();
cy.wait(delay);
cy.get('.euiButton__text').contains('Actions').click();
cy.wait(delay);
cy.get('.euiContextMenuItem__text').contains('Delete').click();
cy.wait(delay);

cy.get('button.euiButton--danger').should('be.disabled');
cy.get('button.euiButton--danger').should('be.disabled');

cy.get('input.euiFieldText[placeholder="delete"]').type('delete');
cy.get('button.euiButton--danger').should('not.be.disabled');
cy.get('.euiButton__text').contains('Delete').click();
cy.wait(delay);
cy.get('input.euiFieldText[placeholder="delete"]').type('delete');
cy.get('button.euiButton--danger').should('not.be.disabled');
cy.get('.euiButton__text').contains('Delete').click();
cy.wait(delay);
}
});

Expand Down
8 changes: 2 additions & 6 deletions dashboards-observability/.cypress/utils/app_constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,8 @@ export const service_two = 'payment';
export const trace_one = 'HTTP POST';
export const trace_two = 'HTTP GET';
export const trace_three = 'client_pay_order';
export const spanQueryOnePartOne = 'where DestCityName ';
export const spanQueryOnePartTwo = '= "Venice" | stats count() by span( timestamp ';
export const spanQueryOnePartThree = ', 6h )';
export const spanQueryTwoPartOne = 'where OriginCityName ';
export const spanQueryTwoPartTwo = '= "Seoul" | stats count() by span( timestamp ';
export const spanQueryTwoPartThree = ', 6h )';
export const query_one = 'where DestCityName = "Venice" | stats count() by span( timestamp , 6h )';
export const query_two = 'where OriginCityName = "Seoul" | stats count() by span( timestamp , 6h )';
export const visOneName = 'Flights to Venice';
export const visTwoName = 'Flights from Seoul';
export const composition = 'order, payment, HTTP POST, HTTP GET, client_pay_order'
Expand Down

0 comments on commit 4ee5d2a

Please sign in to comment.