diff --git a/apps/web/tests/cot-translation-paid.e2e.ts b/apps/web/tests/cot-translation-paid.e2e.ts index 64ba6577e1..c4efd12ee4 100644 --- a/apps/web/tests/cot-translation-paid.e2e.ts +++ b/apps/web/tests/cot-translation-paid.e2e.ts @@ -193,10 +193,9 @@ it.skipIf(MODE === 'record')('reuses saved native Account Flash translations acr expect(calls).toHaveLength(1) await compareOrRefreshGolden(join(EXPECTED, 'paid-result.expected.md'), await captureStableAria(page, '[data-variant="think"]', scaffold.workspaceCwd), MODE) - await reasoning.hover() - await reasoning.getByRole('button', { name: '查看原文', exact: true }).click() + await translated.getByRole('button', { name: '查看原文', exact: true }).click() await translated.getByText(ORIGINAL, { exact: true }).waitFor() - await reasoning.getByRole('button', { name: '查看译文', exact: true }).click() + await translated.getByRole('button', { name: '查看译文', exact: true }).click() expect(calls).toHaveLength(1) const saved = await readPersistedEvents(scaffold, auditSessionId) expect(saved.filter(event => !isTranslationRecord(event))).toEqual(events) diff --git a/apps/web/tests/cot-translation.e2e.ts b/apps/web/tests/cot-translation.e2e.ts index 3bbb7da033..29e9ed0470 100644 --- a/apps/web/tests/cot-translation.e2e.ts +++ b/apps/web/tests/cot-translation.e2e.ts @@ -226,10 +226,11 @@ it.skipIf(MODE === 'record')('persists Bing reasoning translation across reopen return [style.fontFamily, style.fontSize, style.fontWeight, style.lineHeight, style.color, style.padding, style.margin] }) const translatedTypography = await typography() - const originalAction = reasoning.getByRole('button', { name: '查看原文', exact: true }) + const originalAction = body.getByRole('button', { name: '查看原文', exact: true }) await composer.focus() await page.mouse.move(0, 0) - await expect.poll(() => originalAction.evaluate(element => getComputedStyle(element).opacity)).toBe('0') + await expect.poll(() => originalAction.evaluate(element => getComputedStyle(element).opacity)).toBe('1') + expect(await originalAction.evaluate(element => element.closest('[data-disclosure-header]') === null)).toBe(true) await originalAction.focus() await expect.poll(() => originalAction.evaluate(element => getComputedStyle(element).opacity)).toBe('1') await originalAction.press('Enter') @@ -237,11 +238,11 @@ it.skipIf(MODE === 'record')('persists Bing reasoning translation across reopen expect(await body.getAttribute('data-translation-view')).toBe('original') expect(await typography()).toEqual(translatedTypography) await page.mouse.move(0, 0) - const translationAction = reasoning.getByRole('button', { name: '查看译文', exact: true }) + const translationAction = body.getByRole('button', { name: '查看译文', exact: true }) const titleBox = await reasoning.getByRole('button', { name: '思考', exact: true }).boundingBox() const actionBox = await translationAction.boundingBox() if (titleBox === null || actionBox === null) throw new Error('Reasoning title and translation action must be visible') - expect(actionBox.y + actionBox.height / 2).toBeCloseTo(titleBox.y + titleBox.height / 2, 1) + expect(actionBox.y).toBeGreaterThanOrEqual(titleBox.y + titleBox.height) expect(await translationAction.evaluate(element => getComputedStyle(element).opacity)).toBe('1') await translationAction.click() await composer.focus()