优化文件路径
This commit is contained in:
parent
39983043e1
commit
d793563006
@ -156,7 +156,6 @@ class BasePage {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 等待页面加载完成
|
* 等待页面加载完成
|
||||||
* @deprecated 请使用 waitForPageLoadWithRetry 方法替代
|
|
||||||
*/
|
*/
|
||||||
async waitForPageLoad() {
|
async waitForPageLoad() {
|
||||||
await this.page.waitForLoadState('networkidle', {
|
await this.page.waitForLoadState('networkidle', {
|
||||||
@ -165,15 +164,16 @@ class BasePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 等待页面加载完成,带重试机制
|
* 等待IBP系统特定页面加载完成,带重试机制
|
||||||
* @param {Object} context 上下文信息对象
|
* 此方法专门用于检查IBP系统的页面加载状态,包括:
|
||||||
* @param {string} [context.text] 页面名称或描述
|
* 1. 检查el-loading-mask是否存在
|
||||||
* @param {string} [context.path] 页面路径
|
* 2. 检查系统特定的错误提示
|
||||||
* @param {string} [subContext] 子上下文信息(可选)
|
* 3. 等待页面稳定
|
||||||
|
*
|
||||||
|
* @param {string} pageName 页面名称,用于日志显示
|
||||||
* @returns {Promise<boolean>} 页面是否加载成功
|
* @returns {Promise<boolean>} 页面是否加载成功
|
||||||
*/
|
*/
|
||||||
async waitForPageLoadWithRetry(context, subContext = '') {
|
async waitForIBPPageLoadWithRetry(pageName) {
|
||||||
const pageName = this.getContextName(context, subContext);
|
|
||||||
console.log(`等待页面 ${pageName} 数据加载...`);
|
console.log(`等待页面 ${pageName} 数据加载...`);
|
||||||
|
|
||||||
let retryCount = 0;
|
let retryCount = 0;
|
||||||
|
|||||||
@ -404,14 +404,14 @@ class LongiMainPage extends BasePage {
|
|||||||
* @param {Object} parentMenu 父级菜单(可选)
|
* @param {Object} parentMenu 父级菜单(可选)
|
||||||
*/
|
*/
|
||||||
async handleMenuClick(menuInfo, parentMenu = null) {
|
async handleMenuClick(menuInfo, parentMenu = null) {
|
||||||
const menuPath = this.getMenuPath(menuInfo, parentMenu);
|
const menuPath = await this.getMenuPath(menuInfo, parentMenu);
|
||||||
console.log(`点击菜单: ${menuPath}`);
|
console.log(`点击菜单: ${menuPath}`);
|
||||||
|
|
||||||
if (!await this.safeClick(menuInfo.element)) {
|
if (!await this.safeClick(menuInfo.element)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!await this.waitForPageLoadWithRetry(menuInfo)) {
|
if (!await this.waitForIBPPageLoadWithRetry(menuPath)) {
|
||||||
console.warn(`页面加载失败: ${menuPath}`);
|
console.warn(`页面加载失败: ${menuPath}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -428,10 +428,11 @@ class LongiMainPage extends BasePage {
|
|||||||
async handleSingleTab(tabInfo, parentMenu) {
|
async handleSingleTab(tabInfo, parentMenu) {
|
||||||
try {
|
try {
|
||||||
const menuPath = parentMenu.path || parentMenu.text;
|
const menuPath = parentMenu.path || parentMenu.text;
|
||||||
console.log(`🔹 处理TAB页: ${menuPath} > ${tabInfo.text}`);
|
const tabPath = `${menuPath} > ${tabInfo.text}`;
|
||||||
|
console.log(`🔹 处理TAB页: ${tabPath}`);
|
||||||
|
|
||||||
await tabInfo.element.click();
|
await tabInfo.element.click();
|
||||||
await this.waitForPageLoadWithRetry(parentMenu, tabInfo.text);
|
await this.waitForIBPPageLoadWithRetry(tabPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`处理TAB页失败 [${parentMenu.text} > ${tabInfo.text}]:`, error.message);
|
console.error(`处理TAB页失败 [${parentMenu.text} > ${tabInfo.text}]:`, error.message);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user