From a198922ad029d1280cbecb553d89be9736918768 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Mon, 21 Sep 2026 15:41:03 +0700 Subject: [PATCH] test(e2e): reach the chat panel's toggle by its own handle A role query by name matched both the panel toggle and the board's pill, since the pill's label contains the panel's. The spec now names the control it means. --- web/e2e/helpers.js | 1 + web/e2e/pvp-game.spec.js | 4 ++-- web/src/lib/components/ChatPanel.svelte | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/web/e2e/helpers.js b/web/e2e/helpers.js index 05dbe11..30f8aed 100644 --- a/web/e2e/helpers.js +++ b/web/e2e/helpers.js @@ -100,6 +100,7 @@ export function chat(page) { log: page.getByTestId('chat-log'), input: page.getByTestId('chat-input'), send: page.getByTestId('chat-send'), + toggle: page.getByTestId('chat-toggle'), unread: page.getByTestId('chat-unread') }; } diff --git a/web/e2e/pvp-game.spec.js b/web/e2e/pvp-game.spec.js index 0e4861f..b4ebfd6 100644 --- a/web/e2e/pvp-game.spec.js +++ b/web/e2e/pvp-game.spec.js @@ -484,11 +484,11 @@ test.describe('playing a stranger', () => { // And it does start counting what actually arrives while folded. The // guest's panel is folded too, so it has to be opened before there is // anything to type into. - await guest.getByRole('button', { name: 'Trò chuyện' }).click(); + await chat(guest).toggle.click(); await say(guest, 'ba'); await expect(chat(host).unread).toHaveText('1 tin mới'); - await host.getByRole('button', { name: 'Trò chuyện' }).click(); + await chat(host).toggle.click(); await expect(chat(host).unread).toHaveCount(0); await close(); diff --git a/web/src/lib/components/ChatPanel.svelte b/web/src/lib/components/ChatPanel.svelte index 3f3ecc9..df14383 100644 --- a/web/src/lib/components/ChatPanel.svelte +++ b/web/src/lib/components/ChatPanel.svelte @@ -139,7 +139,7 @@
{#if collapsible} -