Skip to content

Conversation

@dididy
Copy link
Contributor

@dididy dididy commented Oct 11, 2025

What is this PR for?

Addition and improvement of notebook-related E2E tests for New UI


/#/notebook/:noteId – View or edit a specific notebook
/#/notebook/:noteId/revision/:revisionId – View a specific revision of a notebook
/#/notebook/:noteId/paragraph/:paragraphId – Notebook paragraph presentation mode

PAGES.WORKSPACE.NOTEBOOK
→ src/app/pages/workspace/notebook/notebook.component

PAGES.WORKSPACE.NOTEBOOK_ACTION_BAR
→ src/app/pages/workspace/notebook/action-bar/action-bar.component

PAGES.WORKSPACE.NOTEBOOK_PARAGRAPH
→ src/app/pages/workspace/notebook/paragraph/paragraph.component

PAGES.WORKSPACE.NOTEBOOK_SIDEBAR
→ src/app/pages/workspace/notebook/sidebar/sidebar.component

PAGES.WORKSPACE.PUBLISHED_PARAGRAPH
→ src/app/pages/workspace/published/paragraph/paragraph.component

What type of PR is it?

Improvement

Todos

What is the Jira issue?

ZEPPELIN-6358

How should this be tested?

Screenshots (if appropriate)

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

@dididy dididy force-pushed the e2e/notebook branch 8 times, most recently from d6228ac to b07b933 Compare October 19, 2025 05:34
@tbonelee
Copy link
Contributor

Could you rebase this onto master branch?

Copy link
Contributor

@tbonelee tbonelee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you take a quick pass on two areas?

  1. There are places where try/catch accepts both error and non-error paths. Could we make these more explicit, either intentionally silencing with a clear rationale or failing, so we reduce false positives?
  2. For browser-specific branches (e.g., notebook-keyboard-page.ts → executePlatformShortcut), could we extract that logic so the main flow reads sequentially and the differences are isolated?

Comment on lines 57 to 75
async verifyCodeVisibilityToggle(): Promise<void> {
await expect(this.actionBarPage.showHideCodeButton).toBeVisible();
await expect(this.actionBarPage.showHideCodeButton).toBeEnabled();

await this.actionBarPage.toggleCodeVisibility();

// Verify the button is still functional after click
await expect(this.actionBarPage.showHideCodeButton).toBeEnabled();
}

async verifyOutputVisibilityToggle(): Promise<void> {
await expect(this.actionBarPage.showHideOutputButton).toBeVisible();
await expect(this.actionBarPage.showHideOutputButton).toBeEnabled();

await this.actionBarPage.toggleOutputVisibility();

// Verify the button is still functional after click
await expect(this.actionBarPage.showHideOutputButton).toBeEnabled();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about verifying the icon change as well? I'm not sure this is reliable, nz-button seems to set the data-icon attribute on the svg to the nzType value. We could assert that attribute and confirm it updates when the button is clicked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a1d9c7a
As you suggested, I modified it to capture the data-icon attribute of the SVG inside the <i> tag and compare its value before and after the click.


async navigateToNotebook(noteId: string): Promise<void> {
if (!noteId) {
console.error('noteId is undefined or null. Cannot navigate to notebook.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems better to throw an error right away when noteId is falsy, since that implies an earlier-step issue, so we don't end up silencing it. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

36977fb
Updated to handle it by throwing an Error.

await cleanupTestNotebooks();
}

async function cleanupTestNotebooks() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need authorizations to use Rest APIs. How about using test notebook directory?

ZEPPELIN_NOTEBOOK_DIR("zeppelin.notebook.dir", "notebook"),

Maybe we could set ZEPPELIN_NOTEBOOK_DIR environment variable, and let e2e script to use this to clean up test notebooks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that this approach would require restarting the server. Could you confirm if I understood that correctly? If so, it might feel a bit awkward. In the meantime, I’ll check whether a method that doesn’t rely on a REST API—such as using sockets—would be feasible.

Comment on lines 25 to 34
async verifyTitleEditingFunctionality(expectedTitle?: string): Promise<void> {
await expect(this.actionBarPage.titleEditor).toBeVisible();
const titleText = await this.actionBarPage.getTitleText();
expect(titleText).toBeDefined();
expect(titleText.length).toBeGreaterThan(0);

if (expectedTitle) {
expect(titleText).toContain(expectedTitle);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're keeping this method name, the test should assert the editing behavior, not just element presence. Otherwise, consider renaming it to reflect what it currently does.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

606ae73
Refactored verifyTitleEditingFunctionality so that it now asserts the actual title editing behavior instead of only checking for element visibility. This makes the method behavior consistent with its name.

Comment on lines 43 to 54
try {
// Try multiple possible confirmation dialog selectors
const confirmSelector = this.page
.locator('nz-popconfirm button:has-text("OK"), .ant-popconfirm button:has-text("OK"), button:has-text("OK")')
.first();
await expect(confirmSelector).toBeVisible({ timeout: 2000 });
await confirmSelector.click();
await expect(confirmSelector).not.toBeVisible();
} catch (error) {
// If no confirmation dialog appears, that's also valid behavior
console.log('Run all executed without confirmation dialog');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than catching and continuing, could we refactor (e.g., split methods) so that cases which should fail actually fail? Same note for the other similar try/catch blocks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e92d5ae
I’ve removed the try/catch blocks from tests that should fail instead of continuing. Please let me know if I missed any cases.

Comment on lines 84 to 95
try {
// Try multiple possible confirmation dialog selectors
const confirmSelector = this.page
.locator('nz-popconfirm button:has-text("OK"), .ant-popconfirm button:has-text("OK"), button:has-text("OK")')
.first();
await expect(confirmSelector).toBeVisible({ timeout: 2000 });
await confirmSelector.click();
await expect(confirmSelector).not.toBeVisible();
} catch (error) {
// If no confirmation dialog appears, that's also valid behavior
console.log('Clear output executed without confirmation dialog');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same comment as the above one.

@dididy dididy force-pushed the e2e/notebook branch 3 times, most recently from d244721 to 3aaaed0 Compare October 26, 2025 17:14
@dididy
Copy link
Contributor Author

dididy commented Oct 27, 2025

You can see that request item 1 has been addressed in e92d5ae and item 2 in eea335a. Thank you for the thorough review.

@dididy dididy force-pushed the e2e/notebook branch 9 times, most recently from 45186ed to 365f64c Compare October 29, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants