Spaces:
Build error
Build error
Download browser/tests/handler.internal.test.ts from Danisz/spymaster-dev-b: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/spaces/Danisz/spymaster-dev-b/resolve/main/browser/tests/handler.internal.test.ts
- Command line
-
hf download hf://spaces/Danisz/spymaster-dev-b/browser/tests/handler.internal.test.ts
-
curl -L -o handler.internal.test.ts https://huggingface.co/spaces/Danisz/spymaster-dev-b/resolve/main/browser/tests/handler.internal.test.ts
1.48 kB
| import { CodenamesGameHandler } from '../handler'; | |
| import { Selectors } from '../selectors'; | |
| // Internal/implementation tests for Playwright selectors and UI logic | |
| // Not part of the public API contract | |
| describe('Codenames Handler Internals: Room Join and Leave Flow', () => { | |
| let handler: CodenamesGameHandler; | |
| afterEach(async () => { | |
| if (handler) { | |
| await handler._cleanupResources(); | |
| handler = undefined as any; | |
| } | |
| }); | |
| it('joins the room and leaves the room, verifying both states', async () => { | |
| handler = await CodenamesGameHandler.create(); | |
| await handler.joinRoom(); | |
| await handler["page"].screenshot({ path: 'screenshots/after-join-room.png' }); | |
| // Assert user is in the room (URL contains room code) | |
| const url = await handler["page"].url(); | |
| expect(url).toContain(process.env.CODENAMES_TEST_ROOM_CODE); | |
| // Assert board is visible | |
| const isBoardVisible = await handler["page"].locator(Selectors.teamBoardBlue).isVisible(); | |
| expect(isBoardVisible).toBe(true); | |
| await handler["page"].screenshot({ path: 'screenshots/after-board-visible.png' }); | |
| // Leave the room using the handler | |
| await handler.leaveRoom(); | |
| // Assert user is out of the room (URL does not contain room code) | |
| const leftUrl = await handler["page"].url(); | |
| expect(leftUrl).not.toContain(process.env.CODENAMES_TEST_ROOM_CODE); | |
| await handler["page"].screenshot({ path: 'screenshots/after-leave-room.png' }); | |
| }, 30000); | |
| }); | |