|
|
@@ -35,8 +35,8 @@ test.describe('LSS管理 CRUD 测试', () => {
|
|
|
await login(page)
|
|
|
await page.goto('/lss')
|
|
|
|
|
|
- // 验证页面标题
|
|
|
- await expect(page.locator('text=LSS 管理')).toBeVisible()
|
|
|
+ // 验证页面标题 (Bug #4537: 页面标题从 "LSS 管理" 改为 "LSS 列表")
|
|
|
+ await expect(page.locator('text=LSS 列表')).toBeVisible()
|
|
|
|
|
|
// 验证搜索表单元素
|
|
|
await expect(page.getByPlaceholder('LSS ID')).toBeVisible()
|
|
|
@@ -171,12 +171,12 @@ test.describe('LSS管理 CRUD 测试', () => {
|
|
|
test('从侧边栏导航到LSS管理', async ({ page }) => {
|
|
|
await login(page)
|
|
|
|
|
|
- // 点击侧边栏 LSS 管理菜单项
|
|
|
- await page.getByText('LSS 管理').first().click()
|
|
|
+ // 点击侧边栏 LSS 列表菜单项 (Bug #4537: 菜单标题从 "LSS 管理" 改为 "LSS 列表")
|
|
|
+ await page.getByText('LSS 列表').first().click()
|
|
|
|
|
|
// 验证跳转到 LSS 管理页面
|
|
|
await expect(page).toHaveURL(/\/lss/)
|
|
|
- await expect(page.locator('text=LSS 管理')).toBeVisible()
|
|
|
+ await expect(page.locator('text=LSS 列表')).toBeVisible()
|
|
|
})
|
|
|
})
|
|
|
|
|
|
@@ -1023,3 +1023,491 @@ test.describe('LSS管理 - 摄像头未创建 Live Stream 对话框测试', () =
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+test.describe('LSS管理 - Bug修复验证测试', () => {
|
|
|
+ // 登录辅助函数
|
|
|
+ async function login(page: Page) {
|
|
|
+ await page.goto('/login')
|
|
|
+ await page.evaluate(() => {
|
|
|
+ localStorage.clear()
|
|
|
+ document.cookie.split(';').forEach((c) => {
|
|
|
+ document.cookie = c.replace(/^ +/, '').replace(/=.*/, `=;expires=${new Date().toUTCString()};path=/`)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ await page.reload()
|
|
|
+
|
|
|
+ await page.getByPlaceholder('用户名').fill(TEST_USERNAME)
|
|
|
+ await page.getByPlaceholder('密码').fill(TEST_PASSWORD)
|
|
|
+ await page.getByRole('button', { name: '登录' }).click()
|
|
|
+ await expect(page).not.toHaveURL(/\/login/, { timeout: 15000 })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4535: 重置按钮需要清除所有搜索条件(包括排序状态)
|
|
|
+ */
|
|
|
+ test('Bug #4535 - 重置按钮清除所有搜索条件包括排序状态', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+
|
|
|
+ // 等待表格加载
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 填入搜索条件
|
|
|
+ await page.getByPlaceholder('LSS ID').fill('test-id')
|
|
|
+ await page.getByPlaceholder('名称').fill('test-name')
|
|
|
+
|
|
|
+ // 点击表头进行排序
|
|
|
+ const lssIdHeader = page.locator('th:has-text("LSS ID")')
|
|
|
+ await lssIdHeader.click()
|
|
|
+ await page.waitForTimeout(300)
|
|
|
+
|
|
|
+ // 验证排序图标出现
|
|
|
+ await expect(lssIdHeader.locator('.ascending, .descending, .caret-wrapper')).toBeVisible()
|
|
|
+
|
|
|
+ // 点击重置
|
|
|
+ await page.getByRole('button', { name: 'Reset' }).click()
|
|
|
+ await page.waitForTimeout(300)
|
|
|
+
|
|
|
+ // 验证搜索条件已清空
|
|
|
+ await expect(page.getByPlaceholder('LSS ID')).toHaveValue('')
|
|
|
+ await expect(page.getByPlaceholder('名称')).toHaveValue('')
|
|
|
+
|
|
|
+ // 验证排序状态已重置(表头不再显示排序方向)
|
|
|
+ // 排序图标应该恢复到默认状态(无 ascending 或 descending 类)
|
|
|
+ const sortIcon = lssIdHeader.locator('.ascending')
|
|
|
+ const hasAscending = await sortIcon.count()
|
|
|
+ const sortIconDesc = lssIdHeader.locator('.descending')
|
|
|
+ const hasDescending = await sortIconDesc.count()
|
|
|
+ // 排序应该被清除
|
|
|
+ expect(hasAscending + hasDescending).toBe(0)
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4536: 心跳状态显示为英文(active/hold/dead)而非中文
|
|
|
+ */
|
|
|
+ test('Bug #4536 - 心跳状态显示为英文格式', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+
|
|
|
+ // 等待表格加载
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 获取心跳列的内容
|
|
|
+ const heartbeatColumn = page.locator('tbody tr').first().locator('td').nth(4)
|
|
|
+ const heartbeatText = await heartbeatColumn.textContent()
|
|
|
+
|
|
|
+ // 验证心跳状态是英文格式(active/hold/dead),而非中文(活跃/待机/离线)
|
|
|
+ // 心跳列格式: "status | time" 例如 "active | 2024-01-26 10:00:00"
|
|
|
+ expect(heartbeatText).toMatch(/active|hold|dead/i)
|
|
|
+ // 不应该包含中文状态
|
|
|
+ expect(heartbeatText).not.toMatch(/活跃|待机|离线/)
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4537: 页面标题从"LSS 管理"改为"LSS 列表"
|
|
|
+ */
|
|
|
+ test('Bug #4537 - 页面标题显示为"LSS 列表"', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+
|
|
|
+ // 等待页面加载
|
|
|
+ await page.waitForTimeout(500)
|
|
|
+
|
|
|
+ // 验证侧边栏菜单显示"LSS 列表"
|
|
|
+ await expect(page.locator('.el-menu-item.is-active, .el-sub-menu.is-active').first()).toContainText('LSS 列表')
|
|
|
+
|
|
|
+ // 验证页面内容区域标题(如果有面包屑或页面标题)
|
|
|
+ // 注意:根据实际UI调整选择器
|
|
|
+ const pageTitle = page.locator('text=LSS 列表').first()
|
|
|
+ await expect(pageTitle).toBeVisible()
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4538: 分页默认显示15条/页
|
|
|
+ */
|
|
|
+ test('Bug #4538 - 分页默认显示15条/页', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+
|
|
|
+ // 等待表格加载
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 验证分页选择器的默认值是15
|
|
|
+ const pageSizeSelector = page.locator(
|
|
|
+ '.el-pagination .el-select .el-input__inner, .el-pagination .el-select-v2__placeholder'
|
|
|
+ )
|
|
|
+ const pageSizeText = (await pageSizeSelector.first().textContent()) || (await pageSizeSelector.first().inputValue())
|
|
|
+
|
|
|
+ // 验证默认每页显示15条
|
|
|
+ expect(pageSizeText).toContain('15')
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4538: 分页选项包含15
|
|
|
+ */
|
|
|
+ test('Bug #4538 - 分页选项包含15条/页选项', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+
|
|
|
+ // 等待表格加载
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 点击分页选择器打开下拉菜单
|
|
|
+ const pageSizeSelector = page.locator('.el-pagination .el-select')
|
|
|
+ await pageSizeSelector.click()
|
|
|
+ await page.waitForTimeout(300)
|
|
|
+
|
|
|
+ // 验证下拉菜单中包含15选项
|
|
|
+ const dropdown = page.locator('.el-select-dropdown, .el-popper')
|
|
|
+ await expect(dropdown.locator('text=15')).toBeVisible()
|
|
|
+
|
|
|
+ // 验证选项顺序正确: 10, 15, 20, 50, 100
|
|
|
+ const options = dropdown.locator('.el-select-dropdown__item')
|
|
|
+ const optionsText = await options.allTextContents()
|
|
|
+
|
|
|
+ // 验证包含所有期望的选项
|
|
|
+ expect(optionsText.some((t) => t.includes('10'))).toBeTruthy()
|
|
|
+ expect(optionsText.some((t) => t.includes('15'))).toBeTruthy()
|
|
|
+ expect(optionsText.some((t) => t.includes('20'))).toBeTruthy()
|
|
|
+ expect(optionsText.some((t) => t.includes('50'))).toBeTruthy()
|
|
|
+ expect(optionsText.some((t) => t.includes('100'))).toBeTruthy()
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4540: 查询按钮使用蓝底(409EFF)白字
|
|
|
+ */
|
|
|
+ test('Bug #4540 - 查询按钮使用蓝底白字', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+
|
|
|
+ // 等待页面加载
|
|
|
+ await page.waitForTimeout(500)
|
|
|
+
|
|
|
+ // 获取查询按钮
|
|
|
+ const searchButton = page.locator('[data-id="btn-search"]')
|
|
|
+ await expect(searchButton).toBeVisible()
|
|
|
+
|
|
|
+ // 验证按钮有 el-button--primary 类(蓝色按钮)
|
|
|
+ await expect(searchButton).toHaveClass(/el-button--primary/)
|
|
|
+
|
|
|
+ // 验证按钮背景色接近 #409EFF
|
|
|
+ const bgColor = await searchButton.evaluate((el) => {
|
|
|
+ return window.getComputedStyle(el).backgroundColor
|
|
|
+ })
|
|
|
+ // #409EFF 的 RGB 值为 rgb(64, 158, 255)
|
|
|
+ expect(bgColor).toMatch(/rgb\(64,\s*158,\s*255\)|rgba\(64,\s*158,\s*255/)
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4541: 重置按钮使用灰底(909399)白字
|
|
|
+ */
|
|
|
+ test('Bug #4541 - 重置按钮使用灰底白字', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+
|
|
|
+ // 等待页面加载
|
|
|
+ await page.waitForTimeout(500)
|
|
|
+
|
|
|
+ // 获取重置按钮
|
|
|
+ const resetButton = page.locator('[data-id="btn-reset"]')
|
|
|
+ await expect(resetButton).toBeVisible()
|
|
|
+
|
|
|
+ // 验证按钮有 el-button--info 类(灰色按钮)
|
|
|
+ await expect(resetButton).toHaveClass(/el-button--info/)
|
|
|
+
|
|
|
+ // 验证按钮背景色接近 #909399
|
|
|
+ const bgColor = await resetButton.evaluate((el) => {
|
|
|
+ return window.getComputedStyle(el).backgroundColor
|
|
|
+ })
|
|
|
+ // #909399 的 RGB 值为 rgb(144, 147, 153)
|
|
|
+ expect(bgColor).toMatch(/rgb\(144,\s*147,\s*153\)|rgba\(144,\s*147,\s*153/)
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4542: 分页当前页背景色使用蓝底(409EFF)白字
|
|
|
+ */
|
|
|
+ test('Bug #4542 - 分页当前页使用蓝底白字', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+
|
|
|
+ // 等待表格加载
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 获取分页组件中当前激活的页码按钮
|
|
|
+ const activePager = page.locator('.el-pagination .el-pager .is-active, .el-pagination .el-pager .active')
|
|
|
+ await expect(activePager).toBeVisible()
|
|
|
+
|
|
|
+ // 验证当前页背景色接近 #409EFF
|
|
|
+ const bgColor = await activePager.evaluate((el) => {
|
|
|
+ return window.getComputedStyle(el).backgroundColor
|
|
|
+ })
|
|
|
+ // #409EFF 的 RGB 值为 rgb(64, 158, 255)
|
|
|
+ expect(bgColor).toMatch(/rgb\(64,\s*158,\s*255\)|rgba\(64,\s*158,\s*255/)
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4557: 摄像头列表状态下拉框显示 active/hold/dead
|
|
|
+ */
|
|
|
+ test('Bug #4557 - 摄像头列表状态下拉框显示英文选项', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+
|
|
|
+ // 等待表格加载
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 点击编辑按钮进入 LSS 编辑抽屉
|
|
|
+ const editButton = page.locator('tbody tr').first().locator('button').nth(1)
|
|
|
+ await expect(editButton).toBeVisible({ timeout: 10000 })
|
|
|
+ await editButton.click()
|
|
|
+
|
|
|
+ // 等待 LSS 编辑抽屉打开
|
|
|
+ const drawer = page.locator('.el-drawer').filter({ hasText: 'LSS详情' })
|
|
|
+ await expect(drawer).toBeVisible({ timeout: 5000 })
|
|
|
+
|
|
|
+ // 点击"摄像头列表" Tab
|
|
|
+ await drawer.locator('.el-tabs__item').filter({ hasText: '摄像头列表' }).click()
|
|
|
+ await page.waitForTimeout(500)
|
|
|
+
|
|
|
+ // 点击状态下拉框
|
|
|
+ const statusSelect = drawer.locator('.camera-toolbar .el-select').first()
|
|
|
+ await statusSelect.click()
|
|
|
+ await page.waitForTimeout(300)
|
|
|
+
|
|
|
+ // 验证下拉选项包含 active/hold/dead 而非中文
|
|
|
+ const dropdown = page.locator('.el-select-dropdown, .el-popper').last()
|
|
|
+ const options = dropdown.locator('.el-select-dropdown__item')
|
|
|
+ const optionsText = await options.allTextContents()
|
|
|
+
|
|
|
+ // 验证包含英文选项
|
|
|
+ expect(optionsText.some((t) => t.includes('active'))).toBeTruthy()
|
|
|
+ expect(optionsText.some((t) => t.includes('hold'))).toBeTruthy()
|
|
|
+ expect(optionsText.some((t) => t.includes('dead'))).toBeTruthy()
|
|
|
+
|
|
|
+ // 验证不包含中文状态
|
|
|
+ expect(optionsText.some((t) => t.includes('在线'))).toBeFalsy()
|
|
|
+ expect(optionsText.some((t) => t.includes('离线'))).toBeFalsy()
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4558: 摄像头列表没有数据时表头要显示
|
|
|
+ */
|
|
|
+ test('Bug #4558 - 摄像头列表无数据时显示表头', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+
|
|
|
+ // Mock 摄像头列表 API 返回空数据
|
|
|
+ await page.route('**/admin/camera/list*', async (route) => {
|
|
|
+ await route.fulfill({
|
|
|
+ status: 200,
|
|
|
+ contentType: 'application/json',
|
|
|
+ body: JSON.stringify({
|
|
|
+ success: true,
|
|
|
+ errCode: 0,
|
|
|
+ data: {
|
|
|
+ list: [],
|
|
|
+ total: 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ await page.goto('/lss')
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 点击编辑按钮进入 LSS 编辑抽屉
|
|
|
+ const editButton = page.locator('tbody tr').first().locator('button').nth(1)
|
|
|
+ await expect(editButton).toBeVisible({ timeout: 10000 })
|
|
|
+ await editButton.click()
|
|
|
+
|
|
|
+ // 等待 LSS 编辑抽屉打开
|
|
|
+ const drawer = page.locator('.el-drawer').filter({ hasText: 'LSS详情' })
|
|
|
+ await expect(drawer).toBeVisible({ timeout: 5000 })
|
|
|
+
|
|
|
+ // 点击"摄像头列表" Tab
|
|
|
+ await drawer.locator('.el-tabs__item').filter({ hasText: '摄像头列表' }).click()
|
|
|
+ await page.waitForTimeout(500)
|
|
|
+
|
|
|
+ // 验证表头可见(即使没有数据)
|
|
|
+ await expect(drawer.locator('th:has-text("设备ID")')).toBeVisible()
|
|
|
+ await expect(drawer.locator('th:has-text("名称")')).toBeVisible()
|
|
|
+ await expect(drawer.locator('th:has-text("状态")')).toBeVisible()
|
|
|
+
|
|
|
+ // 验证空状态提示显示
|
|
|
+ await expect(drawer.locator('.el-empty')).toBeVisible()
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4593: 删除提示显示正确的设备名称而非undefined
|
|
|
+ */
|
|
|
+ test('Bug #4593 - 删除提示显示正确的设备名称', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+
|
|
|
+ // Mock 摄像头列表 API 返回有数据
|
|
|
+ const testCameraName = '测试摄像头001'
|
|
|
+ await page.route('**/admin/camera/list*', async (route) => {
|
|
|
+ await route.fulfill({
|
|
|
+ status: 200,
|
|
|
+ contentType: 'application/json',
|
|
|
+ body: JSON.stringify({
|
|
|
+ success: true,
|
|
|
+ errCode: 0,
|
|
|
+ data: {
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ cameraId: 'CAM_TEST_001',
|
|
|
+ cameraName: testCameraName,
|
|
|
+ lssId: 'LSS_001',
|
|
|
+ status: 'active',
|
|
|
+ streamSn: 'STREAM_001'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ total: 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ await page.goto('/lss')
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 点击编辑按钮进入 LSS 编辑抽屉
|
|
|
+ const editButton = page.locator('tbody tr').first().locator('button').nth(1)
|
|
|
+ await expect(editButton).toBeVisible({ timeout: 10000 })
|
|
|
+ await editButton.click()
|
|
|
+
|
|
|
+ // 等待 LSS 编辑抽屉打开
|
|
|
+ const drawer = page.locator('.el-drawer').filter({ hasText: 'LSS详情' })
|
|
|
+ await expect(drawer).toBeVisible({ timeout: 5000 })
|
|
|
+
|
|
|
+ // 点击"摄像头列表" Tab
|
|
|
+ await drawer.locator('.el-tabs__item').filter({ hasText: '摄像头列表' }).click()
|
|
|
+ await page.waitForTimeout(500)
|
|
|
+
|
|
|
+ // 点击删除按钮
|
|
|
+ const deleteButton = drawer
|
|
|
+ .locator('tbody tr')
|
|
|
+ .first()
|
|
|
+ .locator('button[type="button"]')
|
|
|
+ .filter({ hasText: '' })
|
|
|
+ .last()
|
|
|
+ // 使用 Icon 选择器更精确
|
|
|
+ const deleteIcon = drawer.locator('tbody tr').first().locator('.iconify--mdi[data-icon*="delete"]').first()
|
|
|
+ if ((await deleteIcon.count()) > 0) {
|
|
|
+ await deleteIcon.click()
|
|
|
+ } else {
|
|
|
+ // 备选方案:点击最后一个按钮(删除按钮)
|
|
|
+ await drawer.locator('tbody tr').first().locator('button').last().click()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 等待确认对话框
|
|
|
+ const messageBox = page.locator('.el-message-box')
|
|
|
+ await expect(messageBox).toBeVisible({ timeout: 5000 })
|
|
|
+
|
|
|
+ // 验证对话框中显示正确的设备名称,而非 "undefined"
|
|
|
+ const messageText = await messageBox.locator('.el-message-box__message').textContent()
|
|
|
+ expect(messageText).toContain(testCameraName)
|
|
|
+ expect(messageText).not.toContain('undefined')
|
|
|
+
|
|
|
+ // 关闭对话框
|
|
|
+ await messageBox.locator('button:has-text("取消")').click()
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4569: 编辑摄像头标题改为"摄像头详情"
|
|
|
+ */
|
|
|
+ test('Bug #4569 - 编辑摄像头抽屉标题显示"摄像头详情"', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+ await page.goto('/lss')
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 点击编辑按钮进入 LSS 编辑抽屉
|
|
|
+ const editButton = page.locator('tbody tr').first().locator('button').nth(1)
|
|
|
+ await expect(editButton).toBeVisible({ timeout: 10000 })
|
|
|
+ await editButton.click()
|
|
|
+
|
|
|
+ // 等待 LSS 编辑抽屉打开
|
|
|
+ const drawer = page.locator('.el-drawer').filter({ hasText: 'LSS详情' })
|
|
|
+ await expect(drawer).toBeVisible({ timeout: 5000 })
|
|
|
+
|
|
|
+ // 点击"摄像头列表" Tab
|
|
|
+ await drawer.locator('.el-tabs__item').filter({ hasText: '摄像头列表' }).click()
|
|
|
+ await page.waitForTimeout(500)
|
|
|
+
|
|
|
+ // 点击摄像头编辑按钮
|
|
|
+ const cameraEditButton = drawer.locator('tbody tr').first().locator('button').first()
|
|
|
+ if ((await cameraEditButton.count()) > 0) {
|
|
|
+ await cameraEditButton.click()
|
|
|
+
|
|
|
+ // 等待摄像头详情抽屉打开
|
|
|
+ const cameraDrawer = page.locator('.el-drawer').filter({ hasText: '摄像头详情' })
|
|
|
+ await expect(cameraDrawer).toBeVisible({ timeout: 5000 })
|
|
|
+
|
|
|
+ // 验证标题是"摄像头详情"而非"编辑摄像头"
|
|
|
+ await expect(cameraDrawer.locator('.el-drawer__header, .el-drawer__title')).toContainText('摄像头详情')
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bug #4570: 摄像头详情增加"添加时间"字段
|
|
|
+ */
|
|
|
+ test('Bug #4570 - 摄像头详情显示添加时间', async ({ page }) => {
|
|
|
+ await login(page)
|
|
|
+
|
|
|
+ // Mock 摄像头详情 API 返回带有 createdAt 的数据
|
|
|
+ await page.route('**/admin/camera/get*', async (route) => {
|
|
|
+ await route.fulfill({
|
|
|
+ status: 200,
|
|
|
+ contentType: 'application/json',
|
|
|
+ body: JSON.stringify({
|
|
|
+ success: true,
|
|
|
+ errCode: 0,
|
|
|
+ data: {
|
|
|
+ id: 1,
|
|
|
+ cameraId: 'CAM_TEST_001',
|
|
|
+ cameraName: '测试摄像头',
|
|
|
+ lssId: 'LSS_001',
|
|
|
+ status: 'active',
|
|
|
+ vendorName: 'hikvision',
|
|
|
+ model: 'DS-2CD2043G0-I',
|
|
|
+ createdAt: '2024-01-15T10:30:00Z'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ await page.goto('/lss')
|
|
|
+ await page.waitForTimeout(1000)
|
|
|
+
|
|
|
+ // 点击编辑按钮进入 LSS 编辑抽屉
|
|
|
+ const editButton = page.locator('tbody tr').first().locator('button').nth(1)
|
|
|
+ await expect(editButton).toBeVisible({ timeout: 10000 })
|
|
|
+ await editButton.click()
|
|
|
+
|
|
|
+ // 等待 LSS 编辑抽屉打开
|
|
|
+ const drawer = page.locator('.el-drawer').filter({ hasText: 'LSS详情' })
|
|
|
+ await expect(drawer).toBeVisible({ timeout: 5000 })
|
|
|
+
|
|
|
+ // 点击"摄像头列表" Tab
|
|
|
+ await drawer.locator('.el-tabs__item').filter({ hasText: '摄像头列表' }).click()
|
|
|
+ await page.waitForTimeout(500)
|
|
|
+
|
|
|
+ // 点击摄像头编辑按钮
|
|
|
+ const cameraEditButton = drawer.locator('tbody tr').first().locator('button').first()
|
|
|
+ if ((await cameraEditButton.count()) > 0) {
|
|
|
+ await cameraEditButton.click()
|
|
|
+
|
|
|
+ // 等待摄像头详情抽屉打开
|
|
|
+ const cameraDrawer = page.locator('.el-drawer').filter({ hasText: '摄像头详情' })
|
|
|
+ await expect(cameraDrawer).toBeVisible({ timeout: 5000 })
|
|
|
+
|
|
|
+ // 验证有"添加时间"字段
|
|
|
+ await expect(cameraDrawer.locator('label:has-text("添加时间")')).toBeVisible()
|
|
|
+
|
|
|
+ // 验证添加时间值显示正确格式
|
|
|
+ const timeValue = cameraDrawer.locator('label:has-text("添加时间")').locator('..').locator('.form-value')
|
|
|
+ const timeText = await timeValue.textContent()
|
|
|
+ // 验证时间格式或包含日期
|
|
|
+ expect(timeText).toMatch(/\d{4}-\d{2}-\d{2}|\-/)
|
|
|
+ }
|
|
|
+ })
|
|
|
+})
|