Skip to content

Commit

Permalink
added cleanup, updated eui button clicks
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 committed Apr 11, 2022
1 parent aa125b4 commit 4c19b5d
Showing 1 changed file with 71 additions and 12 deletions.
83 changes: 71 additions & 12 deletions dashboards-observability/.cypress/integration/notebooks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ import { SAMPLE_PANEL } from '../utils/panel_constants';

import { skipOn } from '@cypress/skip-test';

const moveToEventsHome = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/event_analytics/`);
cy.wait(delay * 3);
};

const moveToPanelHome = () => {
cy.visit(
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/operational_panels/`
);
cy.wait(delay * 3);
};

describe('Adding sample data and visualization', () => {
it('Adds sample flights data for visualization paragraph', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/home#/tutorial_directory/sampleData`);
Expand All @@ -27,17 +39,22 @@ describe('Adding sample data and visualization', () => {
});

it('Add sample observability data', () => {
cy.visit(
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/operational_panels/`
);
cy.get('.euiButton__text').contains('Actions').click();
cy.get('.euiContextMenuItem__text').contains('Add samples').click();
moveToPanelHome();
cy.get('.euiButton__text').contains('Actions').trigger('mouseover').click();
cy.wait(100);
cy.get('.euiContextMenuItem__text').contains('Add samples').trigger('mouseover').click();
cy.wait(100 * 3);
cy.get('.euiModalHeader__title[data-test-subj="confirmModalTitleText"]')
.contains('Add samples')
.should('exist');
cy.get('.euiButton__text').contains('Yes').click();
cy.wait(delay * 5);
cy.get('.euiTableCellContent').contains(SAMPLE_PANEL).should('exist');
cy.wait(100);
cy.get('.euiButton__text').contains('Yes').trigger('mouseover').click();
cy.wait(100 * 5);
cy.route2('POST', '/addSamplePanels').as('addSamples');
cy.wait('@addSamples').then(() => {
cy.get('.euiTableCellContent').contains(SAMPLE_PANEL).should('exist');
});
cy.wait(100);
});
});

Expand Down Expand Up @@ -235,7 +252,7 @@ describe('Testing paragraphs', () => {
});

it('Renders input only mode', () => {
cy.get('.euiToggle__input[title="Input only"]').click();
cy.get('.euiButton__text[title="Input only"]').click();
cy.wait(delay);

cy.get('div.markdown-body').should('not.exist');
Expand All @@ -248,7 +265,7 @@ describe('Testing paragraphs', () => {
});

it('Renders output only mode', () => {
cy.get('.euiToggle__input[title="Output only"]').click();
cy.get('.euiButton__text[title="Output only"]').click();
cy.wait(delay);

cy.get('button[aria-label="Open paragraph menu"]').should('not.exist');
Expand Down Expand Up @@ -279,7 +296,9 @@ describe('Testing paragraphs', () => {

cy.get('.euiButton__text').contains('Browse').click();
cy.wait(delay);
cy.get('.euiFieldSearch').focus().type('[Flights] Flight Count and Average Ticket Price{enter}');
cy.get('.euiFieldSearch')
.focus()
.type('[Flights] Flight Count and Average Ticket Price{enter}');
cy.wait(delay);
cy.get('.euiButton__text').contains('Select').click();
cy.wait(delay);
Expand Down Expand Up @@ -444,7 +463,7 @@ describe('Testing paragraphs', () => {

cy.get('.euiButton__text').contains('Create notebook').should('exist');
});

it('Cleans up test notebooks', () => {
cy.get('[data-test-subj="notebook-notebook-actions-button"]').click();
cy.wait(delay);
Expand All @@ -461,3 +480,43 @@ describe('Testing paragraphs', () => {
cy.get('.euiText').contains('No notebooks').should('exist');
});
});

describe('clean up all test data', () => {
it('Delete visualizations from event analytics', () => {
moveToEventsHome();
cy.get('[data-test-subj="tablePaginationPopoverButton"]').trigger('mouseover').click();
cy.get('.euiContextMenuItem__text').contains('50 rows').trigger('mouseover').click();
cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]').trigger('mouseover').click();
cy.wait(delay);
cy.get('.euiButton__text').contains('Actions').trigger('mouseover').click();
cy.wait(delay);
cy.get('.euiContextMenuItem__text').contains('Delete').trigger('mouseover').click();
cy.wait(delay);
cy.get('button.euiButton--danger').should('be.disabled');
cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete', {
delay: 50,
});
cy.get('button.euiButton--danger').should('not.be.disabled');
cy.get('.euiButton__text').contains('Delete').trigger('mouseover').click();
cy.wait(delay);
cy.get('.euiTextAlign').contains('No Queries or Visualizations').should('exist');
});

it('Deletes test panel', () => {
moveToPanelHome();
cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]').trigger('mouseover').click();
cy.wait(delay);
cy.get('.euiButton__text').contains('Actions').trigger('mouseover').click();
cy.wait(delay);
cy.get('.euiContextMenuItem__text').contains('Delete').trigger('mouseover').click();
cy.wait(delay);
cy.get('button.euiButton--danger').should('be.disabled');
cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete', {
delay: 50,
});
cy.get('button.euiButton--danger').should('not.be.disabled');
cy.get('.euiButton__text').contains('Delete').trigger('mouseover').click();

cy.get('.euiTextAlign').contains('No Operational Panels').should('exist');
});
});

0 comments on commit 4c19b5d

Please sign in to comment.