From 815d6b83564a5360fe6181d8e2eb938a9ed74277 Mon Sep 17 00:00:00 2001 From: eric2788 Date: Mon, 21 Oct 2024 15:43:23 +0800 Subject: [PATCH] fixup! fixup! fixup! e2e test --- tests/features/jimaku.spec.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/features/jimaku.spec.ts b/tests/features/jimaku.spec.ts index dc939c8f..7b877bd3 100644 --- a/tests/features/jimaku.spec.ts +++ b/tests/features/jimaku.spec.ts @@ -194,7 +194,6 @@ test('测试同传字幕AI总结', { tag: "@scoped" }, async ({ room, content: p await summarizer.bringToFront() const loader = summarizer.getByText('正在加载同传字幕总结') await expect(loader).toBeVisible() - const res = await loader.elementHandle() await summarizer.waitForTimeout(3000) await expect(summarizer.getByText('错误')).toBeHidden({ timeout: 5000 }) @@ -202,14 +201,17 @@ test('测试同传字幕AI总结', { tag: "@scoped" }, async ({ room, content: p logger.info('正在測試AI总結結果... (15s)') await summarizer.waitForTimeout(15000) - logger.debug('response: ', res.innerText) - - await expect(summarizer.getByText('这位日本Vtuber')).toBeVisible() - await expect(summarizer.getByText('直播')).toBeVisible() - await expect(summarizer.getByText('观众')).toBeVisible() - await expect(summarizer.getByText('麦当劳')).toBeVisible() - await expect(summarizer.getByText('漫展')).toBeVisible() - await expect(summarizer.getByText('蟑螂')).toBeVisible() + const res = await summarizer.locator('h5.leading-snug').textContent() + logger.debug('AI Summary:', res) + + const maybe = expect.configure({ soft: true }) + maybe(res).toContain('日本Vtuber') + maybe(res).toContain('直播') + maybe(res).toContain('观众') + maybe(res).toContain('麦当劳') + maybe(res).toContain('漫展') + maybe(res).toContain('蟑螂') + })