dididy commented on code in PR #5101: URL: https://github.com/apache/zeppelin/pull/5101#discussion_r2466218139
########## zeppelin-web-angular/e2e/models/notebook-action-bar-page.util.ts: ########## @@ -0,0 +1,193 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { expect, Page } from '@playwright/test'; +import { NotebookActionBarPage } from './notebook-action-bar-page'; + +export class NotebookActionBarUtil { + private page: Page; + private actionBarPage: NotebookActionBarPage; + + constructor(page: Page) { + this.page = page; + this.actionBarPage = new NotebookActionBarPage(page); + } + + 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); + } + } + + async verifyRunAllWorkflow(): Promise<void> { + await expect(this.actionBarPage.runAllButton).toBeVisible(); + await expect(this.actionBarPage.runAllButton).toBeEnabled(); + + await this.actionBarPage.clickRunAll(); + + // Check if confirmation dialog appears (it might not in some configurations) + 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'); + } + } + + 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(); + } Review Comment: 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
