优化分批执行点击菜单

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