优化分批执行点击菜单

This commit is contained in:
dengqichen 2025-03-07 14:55:54 +08:00
parent 6221a18dd3
commit 015f8abf32

View File

@ -365,9 +365,7 @@ class LongiMainPage extends BasePage {
* @param {Object} parentMenu 父级菜单可选 * @param {Object} parentMenu 父级菜单可选
*/ */
async handleMenuClick(menuInfo, parentMenu = null) { async handleMenuClick(menuInfo, parentMenu = null) {
const menuPath = await this.getMenuPath(menuInfo, parentMenu); const menuPath = this.getMenuPath(menuInfo, parentMenu);
console.log(`点击菜单: ${menuPath}`);
if (!await this.clickByElement(menuInfo.element)) { if (!await this.clickByElement(menuInfo.element)) {
return; return;
} }
@ -390,8 +388,6 @@ class LongiMainPage extends BasePage {
try { try {
const menuPath = parentMenu.path || parentMenu.text; const menuPath = parentMenu.path || parentMenu.text;
const tabPath = `${menuPath} > ${tabInfo.text}`; const tabPath = `${menuPath} > ${tabInfo.text}`;
console.log(`🔹 处理TAB页: ${tabPath}`);
await tabInfo.element.click(); await tabInfo.element.click();
await this.waitForIBPPageLoadWithRetry(tabPath); await this.waitForIBPPageLoadWithRetry(tabPath);
} catch (error) { } catch (error) {
@ -449,11 +445,8 @@ class LongiMainPage extends BasePage {
*/ */
async closeActiveTab(parentMenu) { async closeActiveTab(parentMenu) {
try { try {
console.log(`🗑️ 正在关闭页面 "${parentMenu.text}" 的tab...`);
const activeTab = this.page.locator(this.selectors.activeTab); const activeTab = this.page.locator(this.selectors.activeTab);
const closeButton = activeTab.locator(this.selectors.closeButton); const closeButton = activeTab.locator(this.selectors.closeButton);
if (await this.canCloseTab(activeTab, closeButton)) { if (await this.canCloseTab(activeTab, closeButton)) {
await closeButton.waitFor({state: 'visible', timeout: 5000}); await closeButton.waitFor({state: 'visible', timeout: 5000});
await this.clickByElement(closeButton); await this.clickByElement(closeButton);