refactor(game): 重构游戏模块并添加WebSocket客户端
- 修改开发环境配置中的代理目标地址 - 移除旧的活动房间状态管理模块 - 移除成都麻将游戏相关的测试用例 - 添加新的游戏动作发送功能 - 实现WebSocket客户端类并支持自动重连 - 添加WebSocket消息处理器注册机制 - 创建游戏相关状态类型定义 - 添加ID生成工具函数 - 移除废弃的游戏相关模块和常量定义 - 添加WebSocket消息结构定义 - 重构游戏状态相关类型定义
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
|
||||
function uniqueUser() {
|
||||
const stamp = Date.now().toString()
|
||||
return {
|
||||
username: `pw${stamp.slice(-8)}`,
|
||||
phone: `13${stamp.slice(-9)}`,
|
||||
email: `pw${stamp}@example.com`,
|
||||
password: 'playwright123',
|
||||
roomName: `pw-room-${stamp.slice(-6)}`,
|
||||
}
|
||||
}
|
||||
|
||||
test('register, login, create room, enter game, and back to hall', async ({ page }) => {
|
||||
const user = uniqueUser()
|
||||
|
||||
await page.goto('/register')
|
||||
|
||||
const registerInputs = page.locator('.auth-card .form input')
|
||||
await registerInputs.nth(0).fill(user.username)
|
||||
await registerInputs.nth(1).fill(user.phone)
|
||||
await registerInputs.nth(2).fill(user.email)
|
||||
await registerInputs.nth(3).fill(user.password)
|
||||
await registerInputs.nth(4).fill(user.password)
|
||||
await page.locator('.auth-card .primary-btn[type="submit"]').click()
|
||||
|
||||
await page.waitForURL(/\/login/)
|
||||
|
||||
const loginInputs = page.locator('.auth-card .form input')
|
||||
await expect(loginInputs.nth(0)).toHaveValue(user.phone)
|
||||
await loginInputs.nth(1).fill(user.password)
|
||||
await page.locator('.auth-card .primary-btn[type="submit"]').click()
|
||||
|
||||
await page.waitForURL(/\/hall/)
|
||||
await expect(page.locator('.hall-page')).toBeVisible()
|
||||
|
||||
await page.locator('.room-actions-footer .primary-btn').click()
|
||||
await expect(page.locator('.modal-card')).toBeVisible()
|
||||
|
||||
await page.locator('.modal-card .field input').first().fill(user.roomName)
|
||||
await page.locator('.modal-card .modal-actions .primary-btn').click()
|
||||
|
||||
await expect(page.locator('.copy-line')).toHaveCount(2)
|
||||
await page.locator('.modal-card .modal-actions .primary-btn').click()
|
||||
|
||||
await page.waitForURL(/\/game\/chengdu\//)
|
||||
await expect(page.locator('.game-page')).toBeVisible()
|
||||
await expect(page.locator('.table-felt')).toBeVisible()
|
||||
|
||||
await page.locator('.topbar-back-btn').click()
|
||||
await page.waitForURL(/\/hall/)
|
||||
await expect(page.locator('.hall-page')).toBeVisible()
|
||||
})
|
||||
Reference in New Issue
Block a user