feat(game): 添加成都麻将打牌功能和E2E测试

- 添加discardPending状态控制丢弃牌操作
- 实现canDiscardTiles计算属性判断是否可以丢弃牌
- 新增handleRoomStateResponse函数处理房间状态响应
- 实现discardTile函数发送丢弃牌消息
- 在游戏页面添加手牌操作栏显示可丢弃的牌
- 为定缺按钮和准备按钮添加data-testid标识
- 在大厅页面为房间操作元素添加data-testid标识
- 添加手牌操作相关的CSS样式
- 配置Playwright E2E测试框架
- 创建房间流程到打牌的完整E2E测试用例
This commit is contained in:
2026-03-29 16:47:56 +08:00
parent 4f7a54cf08
commit 5c9c2a180d
6 changed files with 681 additions and 6 deletions

20
playwright.config.ts Normal file
View File

@@ -0,0 +1,20 @@
import { defineConfig } from 'playwright/test'
export default defineConfig({
testDir: './tests/e2e',
timeout: 60_000,
expect: {
timeout: 10_000,
},
use: {
baseURL: 'http://127.0.0.1:4173',
headless: true,
trace: 'on-first-retry',
},
webServer: {
command: 'pnpm dev --host 127.0.0.1 --port 4173',
url: 'http://127.0.0.1:4173',
reuseExistingServer: true,
timeout: 120_000,
},
})