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

[Backport main] Update notebooks and traces tests with dynamic wait #1695

Merged
merged 1 commit into from
Feb 5, 2025
Merged
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
@@ -31,6 +31,7 @@ describe('Testing services table', () => {
});

it('Opens service flyout', () => {
cy.contains('6.42').should('exist');
cy.get('button[data-test-subj^="service-flyout-action-btn"]')
.first()
.click();
Original file line number Diff line number Diff line change
@@ -52,28 +52,46 @@ const makePopulatedParagraph = () => {
cy.get('textarea[data-test-subj="editorArea-0"]').focus();
cy.get('textarea[data-test-subj="editorArea-0"]').type(MARKDOWN_TEXT);
cy.get('button[data-test-subj="runRefreshBtn-0"]').click();
cy.get('textarea[data-test-subj="editorArea-0"]').should('not.exist');
cy.get(`a[href="${SAMPLE_URL}"]`).should('exist');
cy.get('code').contains('POST').should('exist');
};

const deleteNotebook = (notebookName) => {
moveToNotebookHome();
const deleteNotebook = () => {
cy.get('button[data-test-subj="notebook-delete-icon"]').click();
cy.get('input[data-test-subj="delete-notebook-modal-input"]').type('delete');
cy.get('button[data-test-subj="delete-notebook-modal-delete-button"]').should(
'not.be.disabled'
);
cy.get(
'button[data-test-subj="delete-notebook-modal-delete-button"]'
).click();
};

cy.contains('.euiTableRow', notebookName)
.find('input[type="checkbox"]')
.check();
const deleteAllNotebooks = () => {
cy.intercept(
'DELETE',
'/api/observability/notebooks/note/savedNotebook/*'
).as('deleteNotebook');
moveToNotebookHome();

cy.get('[data-test-subj="deleteSelectedNotebooks"]').click();
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');

cy.get('input[data-test-subj="delete-notebook-modal-input"]').focus();
cy.get('input[data-test-subj="checkboxSelectAll"]').should('exist');
cy.get('input[data-test-subj="checkboxSelectAll"]').click();
cy.get('button[data-test-subj="deleteSelectedNotebooks"]')
.contains('Delete 4 notebooks')
.should('exist');
cy.get('button[data-test-subj="deleteSelectedNotebooks"]').click();
cy.get('input[data-test-subj="delete-notebook-modal-input"]').type('delete');
cy.get('button[data-test-subj="delete-notebook-modal-delete-button"]').should(
'not.be.disabled'
);
cy.get(
'button[data-test-subj="delete-notebook-modal-delete-button"]'
).click();
moveToNotebookHome();

cy.contains('.euiTableRow', notebookName).should('not.exist');
cy.wait('@deleteNotebook').its('response.statusCode').should('eq', 200);
};

describe('Testing notebook actions', () => {
@@ -83,9 +101,7 @@ describe('Testing notebook actions', () => {
});

afterEach(() => {
cy.get('@notebook').then((notebook) => {
deleteNotebook(notebook.name);
});
deleteNotebook();
});

it('Creates a code paragraph', () => {
@@ -99,9 +115,6 @@ describe('Testing notebook actions', () => {

it('Renders markdown', () => {
makePopulatedParagraph();
cy.get('textarea[data-test-subj="editorArea-0"]').should('not.exist');
cy.get(`a[href="${SAMPLE_URL}"]`).should('exist');
cy.get('code').contains('POST').should('exist');
cy.get('td').contains('b2').should('exist');
});
});
@@ -114,35 +127,39 @@ describe('Test reporting integration if plugin installed', () => {
skipOn($body.find('#reportingActionsButton').length <= 0);
});
makePopulatedParagraph();
cy.get('.euiContextMenuPanel').should('not.exist');
cy.get('button[data-test-subj="reporting-actions-button"]').should(
'be.visible'
);
cy.get('button[data-test-subj="reporting-actions-button"]').click();
});

afterEach(() => {
cy.get('@notebook').then((notebook) => {
deleteNotebook(notebook.name);
});
after(() => {
deleteAllNotebooks();
});

it('Create in-context PDF report from notebook', () => {
cy.get('#reportingActionsButton').click();
cy.get('button.euiContextMenuItem:nth-child(1)')
.contains('Download PDF')
.click();
cy.get('body').contains('Please continue report generation in the new tab');
.click({ force: true });
cy.get('body')
.contains('Please continue report generation in the new tab')
.should('exist');
});

it('Create in-context PNG report from notebook', () => {
cy.get('#reportingActionsButton').click();
cy.get('button.euiContextMenuItem:nth-child(2)')
.contains('Download PNG')
.click();
cy.get('body').contains('Please continue report generation in the new tab');
.click({ force: true });
cy.get('body')
.contains('Please continue report generation in the new tab')
.should('exist');
});

it('Create on-demand report definition from context menu', () => {
cy.get('#reportingActionsButton').click();
cy.get('button.euiContextMenuItem:nth-child(3)')
.contains('Create report definition')
.click();
.click({ force: true });
cy.location('pathname', { timeout: delayTime * 3 }).should(
'include',
'/reports-dashboards'
@@ -152,10 +169,9 @@ describe('Test reporting integration if plugin installed', () => {
});

it('View reports homepage from context menu', () => {
cy.get('#reportingActionsButton').click();
cy.get('button.euiContextMenuItem:nth-child(4)')
.contains('View reports')
.click();
.click({ force: true });
cy.location('pathname', { timeout: delayTime * 3 }).should(
'include',
'/reports-dashboards'