diff --git a/e2e/specs/mock/chat.spec.ts b/e2e/specs/mock/chat.spec.ts index 6efb445781..4d05341b66 100644 --- a/e2e/specs/mock/chat.spec.ts +++ b/e2e/specs/mock/chat.spec.ts @@ -179,7 +179,9 @@ test.describe('core chat loop', () => { const firstAssistantMessage = messagesView(page).locator('.message-render').nth(1); await firstAssistantMessage.hover(); - const regenerateButton = firstAssistantMessage.locator('button[title="Regenerate"]').last(); + const regenerateButton = firstAssistantMessage + .getByRole('button', { name: 'Regenerate', exact: true }) + .last(); await expect(regenerateButton).toBeVisible(); const [regenerateResponse] = await Promise.all([ @@ -215,7 +217,9 @@ test.describe('core chat loop', () => { // turn does not belong to. const firstAssistant = messagesView(page).locator('.message-render').nth(1); await firstAssistant.hover(); - const regenInitial = firstAssistant.locator('button[title="Regenerate"]').last(); + const regenInitial = firstAssistant + .getByRole('button', { name: 'Regenerate', exact: true }) + .last(); await expect(regenInitial).toBeVisible(); [response] = await Promise.all([ page.waitForResponse(isAgentsStream, { timeout: 30000 }), @@ -235,7 +239,9 @@ test.describe('core chat loop', () => { // original thread; the view must stay put. const latestAssistant = messagesView(page).locator('.message-render').last(); await latestAssistant.hover(); - const regenLatest = latestAssistant.locator('button[title="Regenerate"]').last(); + const regenLatest = latestAssistant + .getByRole('button', { name: 'Regenerate', exact: true }) + .last(); await expect(regenLatest).toBeVisible(); [response] = await Promise.all([ page.waitForResponse(isAgentsStream, { timeout: 30000 }), @@ -276,7 +282,9 @@ test.describe('core chat loop', () => { // forks a fresh root branch that does not contain the later turns. const earlyAssistant = messagesView(page).locator('.message-render').nth(1); await earlyAssistant.hover(); - const regenEarly = earlyAssistant.locator('button[title="Regenerate"]').last(); + const regenEarly = earlyAssistant + .getByRole('button', { name: 'Regenerate', exact: true }) + .last(); await expect(regenEarly).toBeVisible(); let [response] = await Promise.all([ page.waitForResponse(isAgentsStream, { timeout: 30000 }), @@ -299,7 +307,7 @@ test.describe('core chat loop', () => { // long original thread; it must stay intact. const lateAssistant = messagesView(page).locator('.message-render').last(); await lateAssistant.hover(); - const regenLate = lateAssistant.locator('button[title="Regenerate"]').last(); + const regenLate = lateAssistant.getByRole('button', { name: 'Regenerate', exact: true }).last(); await expect(regenLate).toBeVisible(); [response] = await Promise.all([ page.waitForResponse(isAgentsStream, { timeout: 30000 }), diff --git a/e2e/specs/mock/message-tree.spec.ts b/e2e/specs/mock/message-tree.spec.ts index 2f5b46ca1a..8ac3959c2c 100644 --- a/e2e/specs/mock/message-tree.spec.ts +++ b/e2e/specs/mock/message-tree.spec.ts @@ -586,7 +586,7 @@ async function clickMessageTitleButton(page: Page, messageTextValue: string, tit const render = messageRender(page, messageTextValue); await render.scrollIntoViewIfNeeded(); await render.hover(); - await render.locator(`button[title="${title}"]`).last().click(); + await render.getByRole('button', { name: title, exact: true }).last().click(); } async function clickSibling(page: Page, messageTextValue: string, direction: 'Previous' | 'Next') { diff --git a/e2e/specs/mock/thread-fold.spec.ts b/e2e/specs/mock/thread-fold.spec.ts index 5fc26f615f..7db9f293d3 100644 --- a/e2e/specs/mock/thread-fold.spec.ts +++ b/e2e/specs/mock/thread-fold.spec.ts @@ -146,7 +146,7 @@ test.describe('thread fold regressions', () => { .filter({ hasText: firstReply }) .last(); await render.hover(); - await render.locator('button[title="Regenerate"]').last().click(); + await render.getByRole('button', { name: 'Regenerate', exact: true }).last().click(); await expect(messagesView(page).getByText(regeneratedReply)).toBeVisible({ timeout: 30000 }); await expect(siblingCounter(page)).toHaveText('2 / 2'); diff --git a/e2e/specs/mock/usage.spec.ts b/e2e/specs/mock/usage.spec.ts index 1d85487094..94b203e713 100644 --- a/e2e/specs/mock/usage.spec.ts +++ b/e2e/specs/mock/usage.spec.ts @@ -124,7 +124,9 @@ test.describe('context usage gauge', () => { /** Regenerate to create a sibling branch (B). */ const assistantMessage = messagesView(page).locator('.message-render').nth(1); await assistantMessage.hover(); - const regenerateButton = assistantMessage.locator('button[title="Regenerate"]').last(); + const regenerateButton = assistantMessage + .getByRole('button', { name: 'Regenerate', exact: true }) + .last(); await expect(regenerateButton).toBeVisible(); const [regen] = await Promise.all([ page.waitForResponse(isAgentsStream, { timeout: 30000 }), @@ -166,7 +168,9 @@ test.describe('context usage gauge', () => { * chat.spec.ts's branch test). */ const assistantMessage = messagesView(page).locator('.message-render').nth(1); await assistantMessage.hover(); - const regenerateButton = assistantMessage.locator('button[title="Regenerate"]').last(); + const regenerateButton = assistantMessage + .getByRole('button', { name: 'Regenerate', exact: true }) + .last(); await expect(regenerateButton).toBeVisible(); const [regen] = await Promise.all([ page.waitForResponse(isAgentsStream, { timeout: 30000 }),