diff --git a/.cypress/integration/2_notebooks.spec.js b/.cypress/integration/2_notebooks.spec.js
index 5743cd07a..bd78ef24a 100644
--- a/.cypress/integration/2_notebooks.spec.js
+++ b/.cypress/integration/2_notebooks.spec.js
@@ -21,17 +21,26 @@ 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.visit(`${Cypress.env('opensearchDashboards')}/app/observability-logs#/`);
cy.wait(delay * 3);
};
const moveToPanelHome = () => {
- cy.visit(
- `${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/operational_panels/`
- );
+ cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/`);
cy.wait(delay * 3);
};
+const moveToTestNotebook = () => {
+ cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-notebooks#/`, {
+ timeout: 6000,
+ });
+ cy.get('.euiTableCellContent')
+ .contains(TEST_NOTEBOOK, {
+ timeout: 6000,
+ })
+ .click();
+};
+
describe('Adding sample data and visualization', () => {
it('Adds sample flights data for visualization paragraph', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/home#/tutorial_directory/sampleData`);
@@ -41,20 +50,20 @@ describe('Adding sample data and visualization', () => {
});
it('Add sample observability data', () => {
- moveToPanelHome();
- cy.get('.euiButton__text').contains('Actions').trigger('mouseover').click();
+ moveToEventsHome();
+ cy.get('button[data-test-subj="eventHomeAction"]').trigger('mouseover').click();
cy.wait(100);
- cy.get('.euiContextMenuItem__text').contains('Add samples').trigger('mouseover').click();
+ 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('.euiButton__text').contains('Yes').trigger('mouseover').click();
+ cy.get('button[data-test-subj="confirmModalConfirmButton"]').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.get('.euiToastHeader__title').should('contain', 'successfully');
});
cy.wait(100);
});
@@ -62,7 +71,8 @@ describe('Adding sample data and visualization', () => {
describe('Testing notebooks table', () => {
beforeEach(() => {
- cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/notebooks`);
+ cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-notebooks#/`);
+ cy.wait(delay);
});
it('Notebooks table empty state', () => {
@@ -178,7 +188,7 @@ describe('Testing notebooks table', () => {
describe('Test reporting integration if plugin installed', () => {
beforeEach(() => {
- cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/notebooks`);
+ cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-notebooks#/`);
cy.get('.euiTableCellContent').contains(TEST_NOTEBOOK).click();
cy.wait(delay * 3);
cy.get('body').then(($body) => {
@@ -222,8 +232,7 @@ describe('Test reporting integration if plugin installed', () => {
describe('Testing paragraphs', () => {
beforeEach(() => {
- cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/notebooks`);
- cy.get('.euiTableCellContent').contains(TEST_NOTEBOOK).click();
+ moveToTestNotebook();
});
it('Goes into a notebook and creates paragraphs', () => {
@@ -550,7 +559,5 @@ describe('clean up all test data', () => {
});
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');
});
});
diff --git a/public/components/notebooks/components/__tests__/__snapshots__/note_table.test.tsx.snap b/public/components/notebooks/components/__tests__/__snapshots__/note_table.test.tsx.snap
index 552a09624..ae60cd740 100644
--- a/public/components/notebooks/components/__tests__/__snapshots__/note_table.test.tsx.snap
+++ b/public/components/notebooks/components/__tests__/__snapshots__/note_table.test.tsx.snap
@@ -1085,7 +1085,7 @@ exports[` spec renders the empty component 1`] = `
{
};
// Renames an existing notebook
- renameNotebook = (editedNoteName: string, editedNoteID: string) => {
+ renameNotebook = (editedNoteName: string, editedNoteID: string): Promise => {
if (editedNoteName.length >= 50 || editedNoteName.length === 0) {
this.setToast('Invalid notebook name', 'danger');
return;
@@ -143,6 +143,7 @@ export class Main extends React.Component {
return { data: newData };
});
this.setToast(`Notebook successfully renamed into "${editedNoteName}"`);
+ return res;
})
.catch((err) => {
this.setToast(
diff --git a/public/components/notebooks/components/note_table.tsx b/public/components/notebooks/components/note_table.tsx
index 5624b4601..9c63e0008 100644
--- a/public/components/notebooks/components/note_table.tsx
+++ b/public/components/notebooks/components/note_table.tsx
@@ -120,8 +120,9 @@ export function NoteTable({
};
const onDelete = async () => {
- const toastMessage = `Notebook${selectedNotebooks.length > 1 ? 's' : ' "' + selectedNotebooks[0].path + '"'
- } successfully deleted!`;
+ const toastMessage = `Notebook${
+ selectedNotebooks.length > 1 ? 's' : ' "' + selectedNotebooks[0].path + '"'
+ } successfully deleted!`;
await deleteNotebook(
selectedNotebooks.map((note) => note.id),
toastMessage
@@ -350,8 +351,8 @@ export function NoteTable({
items={
searchQuery
? notebooks.filter((notebook) =>
- notebook.path.toLowerCase().includes(searchQuery.toLowerCase())
- )
+ notebook.path.toLowerCase().includes(searchQuery.toLowerCase())
+ )
: notebooks
}
itemId="id"
@@ -390,7 +391,7 @@ export function NoteTable({
diff --git a/public/components/notebooks/components/notebook.tsx b/public/components/notebooks/components/notebook.tsx
index 083987ba3..e5494ebed 100644
--- a/public/components/notebooks/components/notebook.tsx
+++ b/public/components/notebooks/components/notebook.tsx
@@ -75,7 +75,7 @@ interface NotebookProps {
http: CoreStart['http'];
parentBreadcrumb: ChromeBreadcrumb;
setBreadcrumbs: (newBreadcrumbs: ChromeBreadcrumb[]) => void;
- renameNotebook: (newNoteName: string, noteId: string) => void;
+ renameNotebook: (newNoteName: string, noteId: string) => Promise;
cloneNotebook: (newNoteName: string, noteId: string) => Promise;
deleteNotebook: (noteList: string[], toastMessage?: string) => void;
setToast: (title: string, color?: string, text?: string) => void;
@@ -282,9 +282,13 @@ export class Notebook extends Component {
this.setState({
modalLayout: getCustomModal(
(newName: string) => {
- this.props.renameNotebook(newName, this.props.openedNoteId);
- this.setState({ isModalVisible: false });
- this.loadNotebook();
+ this.props.renameNotebook(newName, this.props.openedNoteId).then((res) => {
+ this.setState({ isModalVisible: false });
+ window.location.assign(`#/${res.message.objectId}`);
+ setTimeout(() => {
+ this.loadNotebook();
+ }, 300);
+ });
},
() => this.setState({ isModalVisible: false }),
'Name',