|
|
@@ -374,7 +374,7 @@ test.describe('原型运营页面真实交互生命周期', () => { |
|
|
expect(cleanupErrors).toEqual([]) |
|
|
expect(cleanupErrors).toEqual([]) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
test('唤醒词:自定义时段页面 CRUD、唤醒测试、启停、刷新持久化与清理', async ({ page, request }, testInfo) => { |
|
|
|
|
|
|
|
|
test('唤醒词:自定义时段页面 CRUD、文本规则验证、启停、刷新持久化与清理', async ({ page, request }, testInfo) => { |
|
|
const module = '唤醒词库' |
|
|
const module = '唤醒词库' |
|
|
const activities: Activity[] = [] |
|
|
const activities: Activity[] = [] |
|
|
const cleanupErrors: string[] = [] |
|
|
const cleanupErrors: string[] = [] |
|
|
@@ -390,6 +390,10 @@ test.describe('原型运营页面真实交互生命周期', () => { |
|
|
await loginAsAdmin(page) |
|
|
await loginAsAdmin(page) |
|
|
await page.goto('/agents/wake-words') |
|
|
await page.goto('/agents/wake-words') |
|
|
await expect(page.getByRole('heading', { name: '唤醒词库' })).toBeVisible() |
|
|
await expect(page.getByRole('heading', { name: '唤醒词库' })).toBeVisible() |
|
|
|
|
|
await expect(page.getByRole('columnheader', { name: '生效时段' })).toBeVisible() |
|
|
|
|
|
await expect(page.getByRole('columnheader', { name: '触发次数' })).toBeVisible() |
|
|
|
|
|
await expect(page.getByRole('columnheader', { name: '最近触发' })).toBeVisible() |
|
|
|
|
|
await expect(page.getByRole('columnheader', { name: '触发记录' })).toHaveCount(0) |
|
|
|
|
|
|
|
|
await page.getByRole('button', { name: '新增唤醒词' }).click() |
|
|
await page.getByRole('button', { name: '新增唤醒词' }).click() |
|
|
let dialog = visibleDialog(page) |
|
|
let dialog = visibleDialog(page) |
|
|
@@ -399,7 +403,7 @@ test.describe('原型运营页面真实交互生命周期', () => { |
|
|
await fillFormItem(dialog, '首句回复', reply) |
|
|
await fillFormItem(dialog, '首句回复', reply) |
|
|
await dialog.getByRole('button', { name: '保存配置' }).click() |
|
|
await dialog.getByRole('button', { name: '保存配置' }).click() |
|
|
await expectSuccessMessage(page, '唤醒词配置已创建') |
|
|
await expectSuccessMessage(page, '唤醒词配置已创建') |
|
|
await filterByKeyword(page, '搜索名称、唤醒短语、智能体或回复内容', phrase) |
|
|
|
|
|
|
|
|
await filterByKeyword(page, '搜索名称或唤醒短语', phrase) |
|
|
let row = tableRowByText(page, phrase) |
|
|
let row = tableRowByText(page, phrase) |
|
|
await expect(row).toContainText('06:00-22:00') |
|
|
await expect(row).toContainText('06:00-22:00') |
|
|
const created = await findResource(request, headers, 'wake-words', phrase, (item) => item.phrase === phrase) |
|
|
const created = await findResource(request, headers, 'wake-words', phrase, (item) => item.phrase === phrase) |
|
|
@@ -412,15 +416,19 @@ test.describe('原型运营页面真实交互生命周期', () => { |
|
|
await row.getByRole('button', { name: '详情' }).click() |
|
|
await row.getByRole('button', { name: '详情' }).click() |
|
|
dialog = visibleDialog(page) |
|
|
dialog = visibleDialog(page) |
|
|
await expect(dialog).toContainText('06:00-22:00') |
|
|
await expect(dialog).toContainText('06:00-22:00') |
|
|
await dialog.getByRole('button', { name: '测试唤醒' }).click() |
|
|
|
|
|
const alert = page.locator('.el-message-box:visible').last() |
|
|
|
|
|
await expect(alert).toContainText(reply) |
|
|
|
|
|
await expect(alert).toContainText(phrase) |
|
|
|
|
|
await alert.getByRole('button', { name: '知道了' }).click() |
|
|
|
|
|
await expect(alert).toBeHidden() |
|
|
|
|
|
await dialog.locator('.el-dialog__headerbtn').click() |
|
|
|
|
|
|
|
|
await dialog.getByRole('button', { name: '验证规则' }).click() |
|
|
|
|
|
dialog = visibleDialog(page) |
|
|
|
|
|
await expect(dialog).toContainText('不会调用麦克风或语音识别') |
|
|
|
|
|
await fillFormItem(dialog, '待验证短语', `${phrase}-不匹配`) |
|
|
|
|
|
await dialog.getByRole('button', { name: '开始验证' }).click() |
|
|
|
|
|
await expect(dialog).toContainText('未匹配') |
|
|
|
|
|
await fillFormItem(dialog, '待验证短语', phrase) |
|
|
|
|
|
await dialog.getByRole('button', { name: '开始验证' }).click() |
|
|
|
|
|
await expect(dialog).toContainText('匹配成功') |
|
|
|
|
|
await expect(dialog).toContainText(reply) |
|
|
|
|
|
await dialog.getByRole('button', { name: '关闭' }).click() |
|
|
await expect(dialog).toBeHidden() |
|
|
await expect(dialog).toBeHidden() |
|
|
activities.push({ module, action: '页面详情与真实唤醒测试', result: 'PASS', resourceId }) |
|
|
|
|
|
|
|
|
activities.push({ module, action: '页面详情与文本规则验证', result: 'PASS', resourceId }) |
|
|
|
|
|
|
|
|
row = tableRowByText(page, phrase) |
|
|
row = tableRowByText(page, phrase) |
|
|
await row.getByRole('button', { name: '编辑' }).click() |
|
|
await row.getByRole('button', { name: '编辑' }).click() |
|
|
@@ -429,7 +437,7 @@ test.describe('原型运营页面真实交互生命周期', () => { |
|
|
await dialog.getByRole('button', { name: '保存配置' }).click() |
|
|
await dialog.getByRole('button', { name: '保存配置' }).click() |
|
|
await expectSuccessMessage(page, '唤醒词配置已更新') |
|
|
await expectSuccessMessage(page, '唤醒词配置已更新') |
|
|
await page.reload() |
|
|
await page.reload() |
|
|
await filterByKeyword(page, '搜索名称、唤醒短语、智能体或回复内容', phrase) |
|
|
|
|
|
|
|
|
await filterByKeyword(page, '搜索名称或唤醒短语', phrase) |
|
|
row = tableRowByText(page, phrase) |
|
|
row = tableRowByText(page, phrase) |
|
|
await expect(row).toContainText('06:00-22:00') |
|
|
await expect(row).toContainText('06:00-22:00') |
|
|
await expect(row).toContainText('请按更新后的步骤执行') |
|
|
await expect(row).toContainText('请按更新后的步骤执行') |
|
|
@@ -438,7 +446,7 @@ test.describe('原型运营页面真实交互生命周期', () => { |
|
|
await row.locator('.el-switch').click() |
|
|
await row.locator('.el-switch').click() |
|
|
await expectSuccessMessage(page, '唤醒词已停用') |
|
|
await expectSuccessMessage(page, '唤醒词已停用') |
|
|
await page.reload() |
|
|
await page.reload() |
|
|
await filterByKeyword(page, '搜索名称、唤醒短语、智能体或回复内容', phrase) |
|
|
|
|
|
|
|
|
await filterByKeyword(page, '搜索名称或唤醒短语', phrase) |
|
|
row = tableRowByText(page, phrase) |
|
|
row = tableRowByText(page, phrase) |
|
|
await expect(row.locator('.el-switch')).not.toHaveClass(/is-checked/) |
|
|
await expect(row.locator('.el-switch')).not.toHaveClass(/is-checked/) |
|
|
activities.push({ module, action: '页面停用并刷新验证', result: 'PASS', resourceId }) |
|
|
activities.push({ module, action: '页面停用并刷新验证', result: 'PASS', resourceId }) |
|
|
|