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 automation for Notebooks application #809

Merged
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
Expand Up @@ -12,6 +12,8 @@ import {
SAMPLE_URL,
SQL_QUERY_TEXT,
PPL_QUERY_TEXT,
NOTEBOOK_TEXT,
OPENSEARCH_URL,
} from '../utils/constants';

import { SAMPLE_PANEL } from '../utils/panel_constants';
Expand Down Expand Up @@ -63,6 +65,13 @@ describe('Testing notebooks table', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/notebooks`);
});

it('Notebooks table empty state', () => {
cy.get('#notebookArea').contains('Notebooks (0)').should('exist');
cy.get('.euiTextAlign.euiTextAlign--center').contains('No notebooks');
cy.get('.euiButton__text').eq(2).contains('Create notebook');
cy.get('.euiButton__text').eq(3).contains('Add samples');
});

it('Displays error toast for invalid notebook name', () => {
cy.get('.euiButton__text').contains('Create notebook').click();
cy.wait(delay);
Expand Down Expand Up @@ -125,6 +134,21 @@ describe('Testing notebooks table', () => {
.should('exist');
});

it('Notebooks table columns headers and pagination', () => {
cy.get('.euiTitle.euiTitle--small').contains('Notebooks').should('exist');
cy.get('.euiTableCellContent__text[title="Name"]').should('exist');
cy.get('.euiTableCellContent__text[title="Last updated"]').should('exist');
cy.get('.euiTableCellContent__text[title="Created"]').should('exist');
cy.get('[data-test-subj="tablePaginationPopoverButton"]').should('exist');
});

it('"Learn more" link under Notebooks header', () => {
cy.get('.euiTitle.euiTitle--small').contains('Notebooks');
cy.get('.euiTextColor.euiTextColor--subdued').contains(NOTEBOOK_TEXT);
cy.get('a.euiLink.euiLink--primary').contains('Learn more').click();
cy.get(`a[href="${OPENSEARCH_URL}"]`).should('exist');
});

it('Deletes notebooks', () => {
cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]').click();
cy.wait(delay);
Expand Down Expand Up @@ -231,6 +255,16 @@ describe('Testing paragraphs', () => {
cy.get('.euiTitle').contains('Event analytics').should('exist');
});

it('Paragraph actions layout', () => {
cy.get('button[data-test-subj="notebook-paragraph-actions-button"]').should('exist').click();
cy.get('.euiContextMenuPanelTitle').contains('Actions');
cy.get('.euiContextMenuItem__text').eq(0).contains('Add paragraph to top');
cy.get('.euiContextMenuItem__text').eq(1).contains('Add paragraph to bottom');
cy.get('.euiContextMenuItem__text').eq(2).contains('Run all paragraphs');
cy.get('.euiContextMenuItem__text').eq(3).contains('Clear all outputs');
cy.get('.euiContextMenuItem__text').eq(4).contains('Delete all paragraphs');
});

it('Renders markdown', () => {
cy.get('.euiTextArea').should('not.exist');
cy.get(`a[href="${SAMPLE_URL}"]`).should('exist');
Expand Down
2 changes: 2 additions & 0 deletions dashboards-observability/.cypress/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => {
// notebooks
export const TEST_NOTEBOOK = 'Test Notebook';
export const SAMPLE_URL = 'https://github.com/opensearch-project/sql/tree/main/sql-jdbc';
export const NOTEBOOK_TEXT = 'Use Notebooks to interactively and collaboratively develop rich reports backed by live data. Common use cases for notebooks includes creating postmortem reports, designing run books, building live infrastructure reports, or even documentation.';
export const OPENSEARCH_URL = 'https://opensearch.org/docs/latest/observability-plugin/notebooks/';
export const MARKDOWN_TEXT = `%md
# Heading 1

Expand Down