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

Fix observability event analytics and notebook failing tests #948

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

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

describe('Click actions', () => {
beforeEach(() => {
landOnEventHome();
});

it('Actions - add sample data', () => {
cy.get('[data-test-subj="eventHomeAction"]').click();
cy.wait(delayTime);
cy.get('[data-test-subj="eventHomeAction__addSamples"]').click();
cy.get('[data-test-subj="confirmModalConfirmButton"]').click();
cy.contains('Sample events added successfully.', { timeout: 10000 });
});
});

describe('Delete saved objects', () => {
it('Delete visualizations/queries from event analytics', () => {
landOnEventHome();
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(delayTime);
cy.get('.euiButton__text').contains('Actions').click();
cy.wait(delayTime);
cy.get('.euiContextMenuItem__text').contains('Delete').click();
cy.wait(delayTime);
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(delayTime * 4);
cy.get('.euiTextAlign')
.contains('No Queries or Visualizations')
.should('exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@
import {
delayTime,
TEST_NOTEBOOK,
MARKDOWN_TEXT,
SAMPLE_URL,
SQL_QUERY_TEXT,
PPL_QUERY_TEXT,
BASE_PATH,
} from '../../../utils/constants';

const moveToEventsHome = () => {
cy.visit(`${BASE_PATH}/app/observability-logs#/`);
cy.wait(delayTime * 3);
};

const moveToPanelHome = () => {
cy.visit(`${BASE_PATH}/app/observability-dashboards#/`);
cy.wait(delayTime * 3);
};
const moveToTestNotebook = () => {
cy.visit(`${BASE_PATH}/app/observability-notebooks#/`, {
timeout: delayTime * 3,
Expand All @@ -25,11 +35,123 @@ const moveToTestNotebook = () => {
.click();
};

describe('Adding sample visualization', () => {
it('Add sample observability data', () => {
moveToEventsHome();
cy.get('button[data-test-subj="eventHomeAction"]')
.trigger('mouseover')
.click();
cy.wait(100);
cy.get('button[data-test-subj="eventHomeAction__addSamples"]')
.trigger('mouseover')
.click();
cy.wait(100 * 3);
cy.get('.euiModalHeader__title[data-test-subj="confirmModalTitleText"]')
.contains('Add samples')
.should('exist');
cy.wait(100);

cy.get('button[data-test-subj="confirmModalConfirmButton"]')
.trigger('mouseover')
.click();
cy.wait(100 * 5);
cy.get('.euiToastHeader__title', { timeout: delayTime * 3 }).should(
'contain',
'successfully'
);
cy.wait(100);
});
});

describe('Testing notebooks table', () => {
beforeEach(() => {
cy.visit(`${BASE_PATH}/app/observability-notebooks#/`);
});

it('Creates a notebook and redirects to the notebook', () => {
cy.get('.euiButton__text').contains('Create notebook').click();
cy.wait(delayTime);
cy.get('input.euiFieldText').type(TEST_NOTEBOOK);
cy.get('.euiButton__text')
.contains(/^Create$/)
.click();
cy.wait(delayTime);

cy.contains(TEST_NOTEBOOK).should('exist');
});

it('Duplicates and renames a notebook', () => {
cy.get('.euiCheckbox__input[title="Select this row"]').eq(0).click();
cy.wait(delayTime);
cy.get('.euiButton__text').contains('Actions').click();
cy.wait(delayTime);
cy.get('.euiContextMenuItem__text').contains('Duplicate').click();
cy.wait(delayTime);
cy.get('.euiButton__text').contains('Duplicate').click();
cy.wait(delayTime);

cy.get('.euiCheckbox__input[title="Select this row"]').eq(1).click();
cy.wait(delayTime);
cy.get('.euiCheckbox__input[title="Select this row"]').eq(0).click();
cy.wait(delayTime);
cy.get('.euiButton__text').contains('Actions').click();
cy.wait(delayTime);
cy.get('.euiContextMenuItem__text').contains('Rename').click();
cy.wait(delayTime);
cy.get('input.euiFieldText').type(' (rename)');
cy.get('.euiButton__text').contains('Rename').click();
cy.wait(delayTime);
});

it('Deletes notebooks', () => {
cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]').click();
cy.wait(delayTime);
cy.get('.euiButton__text').contains('Actions').click();
cy.wait(delayTime);
cy.get('.euiContextMenuItem__text').contains('Delete').click();
cy.wait(delayTime);

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.get('.euiTextAlign').contains('No notebooks').should('exist');

// keep a notebook for testing
cy.get('.euiButton__text').contains('Create notebook').click();
cy.wait(delayTime);
cy.get('input.euiFieldText').type(TEST_NOTEBOOK);
cy.get('.euiButton__text')
.contains(/^Create$/)
.click();
cy.wait(delayTime * 2);
});
});

describe('Testing paragraphs', () => {
beforeEach(() => {
moveToTestNotebook();
});

it('Goes into a notebook and creates paragraphs', () => {
cy.get('.euiButton__text').contains('Add').click();
cy.wait(delayTime);

cy.get('.euiTextArea').should('exist');

cy.get('.euiButton__text').contains('Run').click();
cy.wait(delayTime);
cy.get('.euiTextColor').contains('Input is required.').should('exist');
cy.get('.euiTextArea').clear();
cy.get('.euiTextArea').type(MARKDOWN_TEXT);
cy.wait(delayTime);

cy.get('.euiButton__text').contains('Run').click();
cy.wait(delayTime);
});

it('Renders markdown', () => {
cy.get('.euiTextArea').should('not.exist');
cy.get(`a[href="${SAMPLE_URL}"]`).should('exist');
Expand Down Expand Up @@ -160,3 +282,58 @@ 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(delayTime);
cy.get('.euiButton__text').contains('Actions').trigger('mouseover').click();
cy.wait(delayTime);
cy.get('.euiContextMenuItem__text')
.contains('Delete')
.trigger('mouseover')
.click();
cy.wait(delayTime);
cy.get('button.euiButton--danger').should('be.disabled');
cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete', {
delayTime: 50,
});
cy.get('button.euiButton--danger').should('not.be.disabled');
cy.get('.euiButton__text').contains('Delete').trigger('mouseover').click();
cy.wait(delayTime);
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(delayTime);
cy.get('.euiButton__text').contains('Actions').trigger('mouseover').click();
cy.wait(delayTime);
cy.get('.euiContextMenuItem__text')
.contains('Delete')
.trigger('mouseover')
.click();
cy.wait(delayTime);
cy.get('button.euiButton--danger').should('be.disabled');
cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete', {
delayTime: 50,
});
cy.get('button.euiButton--danger').should('not.be.disabled');
cy.get('.euiButton__text').contains('Delete').trigger('mouseover').click();
});
});
Loading