diff --git a/novalon-manage-web/e2e/pages/DictionaryManagementPage.ts b/novalon-manage-web/e2e/pages/DictionaryManagementPage.ts index a88318b..0144cbe 100644 --- a/novalon-manage-web/e2e/pages/DictionaryManagementPage.ts +++ b/novalon-manage-web/e2e/pages/DictionaryManagementPage.ts @@ -1,4 +1,4 @@ -import { Page, Locator } from '@playwright/test'; +import { Page, Locator, expect } from '@playwright/test'; export class DictionaryManagementPage { readonly page: Page; @@ -24,8 +24,20 @@ export class DictionaryManagementPage { } async goto() { - await this.page.goto('/dict'); - await this.page.waitForLoadState('networkidle'); + try { + console.log('导航到字典管理页面...'); + await this.page.goto('/dict'); + + await this.page.waitForLoadState('networkidle'); + await this.table.waitFor({ state: 'visible', timeout: 10000 }); + await expect(this.page).toHaveURL(/.*dict/); + + console.log('字典管理页面加载完成'); + } catch (error) { + await this.page.screenshot({ path: `test-results/dict-management-error-${Date.now()}.png` }); + console.error('导航到字典管理页面失败:', error); + throw new Error(`导航到字典管理页面失败: ${error instanceof Error ? error.message : String(error)}`); + } } async clickCreateDictType() { diff --git a/novalon-manage-web/e2e/pages/ExceptionLogPage.ts b/novalon-manage-web/e2e/pages/ExceptionLogPage.ts index 31b8ecd..a827cd5 100644 --- a/novalon-manage-web/e2e/pages/ExceptionLogPage.ts +++ b/novalon-manage-web/e2e/pages/ExceptionLogPage.ts @@ -1,4 +1,4 @@ -import { Page, Locator } from '@playwright/test'; +import { Page, Locator, expect } from '@playwright/test'; export class ExceptionLogPage { readonly page: Page; @@ -22,8 +22,20 @@ export class ExceptionLogPage { } async goto() { - await this.page.goto('/exceptionlog'); - await this.page.waitForLoadState('networkidle'); + try { + console.log('导航到异常日志页面...'); + await this.page.goto('/exceptionlog'); + + await this.page.waitForLoadState('networkidle'); + await this.table.waitFor({ state: 'visible', timeout: 10000 }); + await expect(this.page).toHaveURL(/.*exceptionlog/); + + console.log('异常日志页面加载完成'); + } catch (error) { + await this.page.screenshot({ path: `test-results/exception-log-error-${Date.now()}.png` }); + console.error('导航到异常日志页面失败:', error); + throw new Error(`导航到异常日志页面失败: ${error instanceof Error ? error.message : String(error)}`); + } } async search(keyword: string) { diff --git a/novalon-manage-web/e2e/pages/FileManagementPage.ts b/novalon-manage-web/e2e/pages/FileManagementPage.ts index 8f5f160..c881c31 100644 --- a/novalon-manage-web/e2e/pages/FileManagementPage.ts +++ b/novalon-manage-web/e2e/pages/FileManagementPage.ts @@ -20,9 +20,20 @@ export class FileManagementPage { } async goto() { - await this.page.goto('/files'); - await this.page.waitForLoadState('networkidle'); - await this.page.waitForTimeout(3000); + try { + console.log('导航到文件管理页面...'); + await this.page.goto('/files'); + + await this.page.waitForLoadState('networkidle'); + await this.table.waitFor({ state: 'visible', timeout: 10000 }); + await expect(this.page).toHaveURL(/.*files/); + + console.log('文件管理页面加载完成'); + } catch (error) { + await this.page.screenshot({ path: `test-results/file-management-error-${Date.now()}.png` }); + console.error('导航到文件管理页面失败:', error); + throw new Error(`导航到文件管理页面失败: ${error instanceof Error ? error.message : String(error)}`); + } } async uploadFile(filePath: string) { diff --git a/novalon-manage-web/e2e/pages/LoginLogPage.ts b/novalon-manage-web/e2e/pages/LoginLogPage.ts index cf12505..7d59476 100644 --- a/novalon-manage-web/e2e/pages/LoginLogPage.ts +++ b/novalon-manage-web/e2e/pages/LoginLogPage.ts @@ -16,8 +16,20 @@ export class LoginLogPage { } async goto() { - await this.page.goto('/loginlog'); - await this.page.waitForLoadState('networkidle'); + try { + console.log('导航到登录日志页面...'); + await this.page.goto('/loginlog'); + + await this.page.waitForLoadState('networkidle'); + await this.table.waitFor({ state: 'visible', timeout: 10000 }); + await expect(this.page).toHaveURL(/.*loginlog/); + + console.log('登录日志页面加载完成'); + } catch (error) { + await this.page.screenshot({ path: `test-results/login-log-error-${Date.now()}.png` }); + console.error('导航到登录日志页面失败:', error); + throw new Error(`导航到登录日志页面失败: ${error instanceof Error ? error.message : String(error)}`); + } } async searchByKeyword(keyword: string) { diff --git a/novalon-manage-web/e2e/pages/MenuManagementPage.ts b/novalon-manage-web/e2e/pages/MenuManagementPage.ts index 8968b2a..efbc043 100644 --- a/novalon-manage-web/e2e/pages/MenuManagementPage.ts +++ b/novalon-manage-web/e2e/pages/MenuManagementPage.ts @@ -1,4 +1,4 @@ -import { Page, Locator } from '@playwright/test'; +import { Page, Locator, expect } from '@playwright/test'; export class MenuManagementPage { readonly page: Page; @@ -24,8 +24,24 @@ export class MenuManagementPage { } async goto() { - await this.page.goto('/menus'); - await this.page.waitForLoadState('networkidle'); + try { + console.log('导航到菜单管理页面...'); + await this.page.goto('/menus'); + + await this.page.waitForLoadState('networkidle'); + + await this.page.waitForSelector('.el-tree', { timeout: 10000 }).catch(() => { + return this.page.waitForSelector('.el-table', { timeout: 5000 }); + }); + + await expect(this.page).toHaveURL(/.*menus/); + + console.log('菜单管理页面加载完成'); + } catch (error) { + await this.page.screenshot({ path: `test-results/menu-management-error-${Date.now()}.png` }); + console.error('导航到菜单管理页面失败:', error); + throw new Error(`导航到菜单管理页面失败: ${error instanceof Error ? error.message : String(error)}`); + } } async clickCreateMenu() { diff --git a/novalon-manage-web/e2e/pages/OperationLogPage.ts b/novalon-manage-web/e2e/pages/OperationLogPage.ts index db750d1..1fc350f 100644 --- a/novalon-manage-web/e2e/pages/OperationLogPage.ts +++ b/novalon-manage-web/e2e/pages/OperationLogPage.ts @@ -16,8 +16,20 @@ export class OperationLogPage { } async goto() { - await this.page.goto('/oplog'); - await this.page.waitForLoadState('networkidle'); + try { + console.log('导航到操作日志页面...'); + await this.page.goto('/oplog'); + + await this.page.waitForLoadState('networkidle'); + await this.table.waitFor({ state: 'visible', timeout: 10000 }); + await expect(this.page).toHaveURL(/.*oplog/); + + console.log('操作日志页面加载完成'); + } catch (error) { + await this.page.screenshot({ path: `test-results/operation-log-error-${Date.now()}.png` }); + console.error('导航到操作日志页面失败:', error); + throw new Error(`导航到操作日志页面失败: ${error instanceof Error ? error.message : String(error)}`); + } } async searchByKeyword(keyword: string) { diff --git a/novalon-manage-web/e2e/pages/SystemConfigPage.ts b/novalon-manage-web/e2e/pages/SystemConfigPage.ts index 45c1046..0850e8e 100644 --- a/novalon-manage-web/e2e/pages/SystemConfigPage.ts +++ b/novalon-manage-web/e2e/pages/SystemConfigPage.ts @@ -32,8 +32,20 @@ export class SystemConfigPage { } async goto() { - await this.page.goto('/sys/config'); - await this.page.waitForLoadState('networkidle'); + try { + console.log('导航到系统配置页面...'); + await this.page.goto('/sys/config'); + + await this.page.waitForLoadState('networkidle'); + await this.table.waitFor({ state: 'visible', timeout: 10000 }); + await expect(this.page).toHaveURL(/.*config/); + + console.log('系统配置页面加载完成'); + } catch (error) { + await this.page.screenshot({ path: `test-results/system-config-error-${Date.now()}.png` }); + console.error('导航到系统配置页面失败:', error); + throw new Error(`导航到系统配置页面失败: ${error instanceof Error ? error.message : String(error)}`); + } } async addConfig(configName: string, configKey: string, configValue: string, configType: string = 'Y') {