-
Couldn't load subscription status.
- Fork 2.8k
[ZEPPELIN-6358] Add E2E tests about /#/notebook/:noteid for New UI #5101
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
base: master
Are you sure you want to change the base?
Conversation
d6228ac to
b07b933
Compare
|
Could you rebase this onto master branch? |
There was a problem hiding this 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?
- 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?
- 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?
| 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(); | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.'); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
Line 982 in 0a768bc
| 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.
There was a problem hiding this comment.
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.
| 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); | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| 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'); | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| 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'); | ||
| } |
There was a problem hiding this comment.
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.
d244721 to
3aaaed0
Compare
45186ed to
365f64c
Compare
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: