Skip to content

Commit

Permalink
Merge branch 'main' into overviewCMremake
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Tackett <[email protected]>
  • Loading branch information
TackAdam authored Aug 28, 2024
2 parents 0765303 + c655eb5 commit 8346714
Show file tree
Hide file tree
Showing 32 changed files with 1,798 additions and 1,500 deletions.
65 changes: 32 additions & 33 deletions .cypress/integration/notebooks_test/notebooks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Testing notebooks table', () => {
cy.get('h3[data-test-subj="notebookTableTitle"]').contains('Notebooks (0)').should('exist');
cy.get('div[data-test-subj="notebookEmptyTableText"]').contains('No notebooks');
cy.get('a[data-test-subj="notebookEmptyTableCreateBtn"]').contains('Create notebook');
cy.get('button[data-test-subj="notebookEmptyTableAddSamplesBtn"]').contains('Add samples');
cy.get('button[data-test-subj="notebookEmptyTableAddSamplesBtn"]').contains('Add sample notebooks');
});

it('Displays error toast for invalid notebook name', () => {
Expand Down Expand Up @@ -135,7 +135,7 @@ describe('Testing paragraphs', () => {
cy.get('a[data-test-subj="createNotebookPrimaryBtn"]').click();
cy.get('input[data-test-subj="custom-input-modal-input"]').focus().type(TEST_NOTEBOOK);
cy.get('button[data-test-subj="custom-input-modal-confirm-button"]').click();
cy.get('div[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('h3[data-test-subj="notebookTableTitle"]').contains(TEST_NOTEBOOK).should('exist');
});

beforeEach(() => {
Expand Down Expand Up @@ -166,7 +166,7 @@ describe('Testing paragraphs', () => {

it('Has working breadcrumbs', () => {
cy.get('a[data-test-subj="breadcrumb last"]').contains(TEST_NOTEBOOK).click();
cy.get('div[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('h3[data-test-subj="notebookTableTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('a[data-test-subj="breadcrumb"]').contains('Notebooks').click();
cy.get('h3[data-test-subj="notebookTableTitle"]').should('exist');
cy.get('a[data-test-subj="breadcrumb first"]').contains('Observability').click();
Expand All @@ -175,12 +175,8 @@ describe('Testing paragraphs', () => {

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');
cy.get('.euiContextMenuItem__text').eq(0).contains('To top');
cy.get('.euiContextMenuItem__text').eq(1).contains('To bottom');
});

it('Shows output message', () => {
Expand Down Expand Up @@ -243,15 +239,16 @@ describe('Testing paragraphs', () => {
});

it('Adds a SQL query paragraph', () => {
cy.get('button[data-test-subj="AddParagraphButton"]').click();
cy.get('button[data-test-subj="AddCodeBlockBtn"]').click();
cy.get('button[data-test-subj="notebook-paragraph-actions-button"]').click();
cy.get('span.euiContextMenuItem__text').contains('To top').click();
cy.get('button.euiContextMenuItem').contains('Code block').click();

cy.get('textarea[data-test-subj="editorArea-3"]').clear();
cy.get('textarea[data-test-subj="editorArea-3"]').focus();
cy.get('textarea[data-test-subj="editorArea-3"]').type(SQL_QUERY_TEXT);
cy.get('button[data-test-subj="runRefreshBtn-3"]').click();
cy.get('textarea[data-test-subj="editorArea-0"]').clear();
cy.get('textarea[data-test-subj="editorArea-0"]').focus();
cy.get('textarea[data-test-subj="editorArea-0"]').type(SQL_QUERY_TEXT);
cy.get('button[data-test-subj="runRefreshBtn-0"]').click();

cy.get('textarea[data-test-subj="editorArea-3"]').should('not.exist');
cy.get('textarea[data-test-subj="editorArea-0"]').should('not.exist');
cy.get('div[data-test-subj="queryOutputText"]')
.contains('select * from opensearch_dashboards_sample_data_flights limit 20')
.should('exist');
Expand Down Expand Up @@ -301,10 +298,11 @@ describe('Testing paragraphs', () => {
});

it('Adds an observability visualization paragraph', () => {
cy.get('button[data-test-subj="AddParagraphButton"]').click();
cy.get('button[data-test-subj="AddVisualizationBlockBtn"]').click();
cy.get('button[data-test-subj="notebook-paragraph-actions-button"]').click();
cy.get('span.euiContextMenuItem__text').contains('To top').click();
cy.get('button.euiContextMenuItem').contains('Visualization').click();

cy.get('button[data-test-subj="runRefreshBtn-6"]').click();
cy.get('button[data-test-subj="runRefreshBtn-0"]').click();
cy.get('div[data-test-subj="paragraphInputErrorText"]')
.contains('Visualization is required.')
.should('exist');
Expand All @@ -314,7 +312,7 @@ describe('Testing paragraphs', () => {
.type('[Logs] Count total requests by tags');

cy.get('.euiComboBoxOption__content').contains('[Logs] Count total requests by tags').click();
cy.get('button[data-test-subj="runRefreshBtn-6"]').click();
cy.get('button[data-test-subj="runRefreshBtn-0"]').click();
cy.get('h5').contains('[Logs] Count total requests by tags').should('exist');
});

Expand All @@ -336,7 +334,7 @@ describe('Testing paragraphs', () => {
});

it('Clears outputs', () => {
cy.get('div[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('h3[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('[data-test-subj="notebook-paragraph-actions-button"]').should('exist');
cy.get('[data-test-subj="notebook-paragraph-actions-button"]').click();
cy.get('.euiContextMenuItem__text').contains('Clear all outputs').click();
Expand All @@ -346,35 +344,36 @@ describe('Testing paragraphs', () => {
});

it('Runs all paragraphs', () => {
cy.get('div[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('h3[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('[data-test-subj="notebook-paragraph-actions-button"]').click();
cy.get('.euiContextMenuItem__text').contains('Run all paragraphs').click();

cy.get(`a[href="${SAMPLE_URL}"]`).should('exist');
});

it('Adds paragraph to top', () => {
cy.get('div[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('h3[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');

cy.get('[data-test-subj="notebook-paragraph-actions-button"]').click();
cy.get('.euiContextMenuItem__text').contains('Add paragraph to top').click();
cy.get('.euiContextMenuItem__text').contains('Code block').click();
cy.get('button[data-test-subj="notebook-paragraph-actions-button"]').click();
cy.get('span.euiContextMenuItem__text').contains('To top').click();
cy.get('button.euiContextMenuItem').contains('Code block').click();

cy.get('.euiText').contains('[1] Code block').should('exist');
});

it('Adds paragraph to bottom', () => {
cy.get('div[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('[data-test-subj="notebook-paragraph-actions-button"]').click();
cy.get('.euiContextMenuItem__text').contains('Add paragraph to bottom').click();
cy.get('.euiContextMenuItem__text').contains('Code block').click();
cy.get('h3[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');

cy.get('button[data-test-subj="notebook-paragraph-actions-button"]').click();
cy.get('span.euiContextMenuItem__text').contains('To To bottom').click();
cy.get('button.euiContextMenuItem').contains('Code block').click();

cy.get('.euiText').contains('[4] Visualization').should('exist');
cy.get('.euiText').contains('[5] Code block').should('exist');
});

it('Moves paragraphs', () => {
cy.get('div[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('h3[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('.euiButtonIcon[aria-label="Open paragraph menu"').eq(0).click();
cy.get('.euiContextMenuItem-isDisabled').should('have.length.gte', 2);
cy.get('.euiContextMenuItem__text').contains('Move to bottom').click();
Expand All @@ -383,7 +382,7 @@ describe('Testing paragraphs', () => {
});

it('Duplicates and renames the notebook', () => {
cy.get('div[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('h3[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('[data-test-subj="notebook-notebook-actions-button"]').click();
cy.get('.euiContextMenuItem__text').contains('Duplicate notebook').click();
cy.get('.euiButton__text').contains('Duplicate').click();
Expand All @@ -401,7 +400,7 @@ describe('Testing paragraphs', () => {
});

it('Deletes paragraphs', () => {
cy.get('div[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('h3[data-test-subj="notebookTitle"]').contains(TEST_NOTEBOOK).should('exist');
cy.get('[data-test-subj="notebook-paragraph-actions-button"]').click();
cy.get('.euiContextMenuItem__text').contains('Delete all paragraphs').click();
cy.get('button[data-test-subj="confirmModalConfirmButton"]').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jest.mock('../../../../../public/framework/core_refs', () => ({
coreRefs: {
chrome: {
setBreadcrumbs: jest.fn(),
navGroup: {
getNavGroupEnabled: jest.fn().mockReturnValue(false),
},
},
http: {
get: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('<QueryAssistInput /> spec', () => {
);
});

it('should display toast for generate errors', async () => {
it.skip('should display toast for generate errors', async () => {
httpMock.post.mockRejectedValueOnce({ body: { statusCode: 429 } });

const { component } = renderQueryAssistInput();
Expand Down
Loading

0 comments on commit 8346714

Please sign in to comment.