优化文件路径
This commit is contained in:
parent
23020e7825
commit
25c56b2e14
@ -1,8 +1,4 @@
|
||||
/**
|
||||
* 龙蛟IBP系统登录页面对象模型
|
||||
*/
|
||||
const BasePage = require('../utils/BasePage');
|
||||
const { getEnv } = require('../utils/env');
|
||||
const BasePage = require('./BasePage');
|
||||
|
||||
class LongiLoginPage extends BasePage {
|
||||
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
/**
|
||||
* 龙蛟IBP系统主页面对象模型
|
||||
*/
|
||||
const BasePage = require('../utils/BasePage');
|
||||
const BasePage = require('./BasePage');
|
||||
const FileUtils = require('../utils/FileUtils');
|
||||
|
||||
class LongiMainPage extends BasePage {
|
||||
@ -120,7 +117,7 @@ class LongiMainPage extends BasePage {
|
||||
*/
|
||||
async clickExpandMenu() {
|
||||
const toggleButton = this.page.locator(this.selectors.menuToggle).first();
|
||||
if (!await this.waitForElement(this.selectors.menuToggle, { returnBoolean: true, firstOnly: true })) {
|
||||
if (!await this.waitForElement(this.selectors.menuToggle, {returnBoolean: true, firstOnly: true})) {
|
||||
console.log('菜单切换按钮不可见,尝试其他方法');
|
||||
return;
|
||||
}
|
||||
@ -556,11 +553,11 @@ class LongiMainPage extends BasePage {
|
||||
* @returns {Promise<boolean>} 页面是否加载成功
|
||||
*/
|
||||
async waitForPageLoadWithRetry(menu, subMenuText = '') {
|
||||
const pageName = this.getMenuPath(menu, { text: subMenuText });
|
||||
const pageName = this.getMenuPath(menu, {text: subMenuText});
|
||||
console.log(`等待页面 ${pageName} 数据加载...`);
|
||||
|
||||
let retryCount = 0;
|
||||
const { maxRetries, retryInterval, stabilityDelay } = this.config.pageLoad;
|
||||
const {maxRetries, retryInterval, stabilityDelay} = this.config.pageLoad;
|
||||
|
||||
try {
|
||||
while (retryCount < maxRetries) {
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
/**
|
||||
* 环境变量工具类
|
||||
* 提供环境变量的读取和类型转换功能
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取环境变量值
|
||||
* @param {string} key 环境变量名
|
||||
* @param {string} defaultValue 默认值
|
||||
* @returns {string} 环境变量值或默认值
|
||||
*/
|
||||
function getEnv(key, defaultValue = '') {
|
||||
return process.env[key] || defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取布尔类型的环境变量值
|
||||
* @param {string} key 环境变量名
|
||||
* @param {boolean} defaultValue 默认值
|
||||
* @returns {boolean} 环境变量的布尔值
|
||||
*/
|
||||
function getBoolEnv(key, defaultValue = false) {
|
||||
const value = process.env[key];
|
||||
if (value === undefined) return defaultValue;
|
||||
return value.toLowerCase() === 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数字类型的环境变量值
|
||||
* @param {string} key 环境变量名
|
||||
* @param {number} defaultValue 默认值
|
||||
* @returns {number} 环境变量的数字值
|
||||
*/
|
||||
function getNumEnv(key, defaultValue = 0) {
|
||||
const value = process.env[key];
|
||||
if (value === undefined) return defaultValue;
|
||||
const num = Number(value);
|
||||
return isNaN(num) ? defaultValue : num;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getEnv,
|
||||
getBoolEnv,
|
||||
getNumEnv
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user