Merge remote-tracking branch 'origin/master' into codex/public-work-readmodel-smooth-transition

This commit is contained in:
kdletters
2026-05-26 16:38:38 +08:00
130 changed files with 2966 additions and 511 deletions

View File

@@ -83,7 +83,10 @@ import {
saveBabyObjectMatchDraft,
} from '../../services/edutainment-baby-object';
import { match3dCreationClient } from '../../services/match3d-creation';
import { createServerMatch3DRuntimeAdapter } from '../../services/match3d-runtime';
import {
createLocalMatch3DRuntimeAdapter,
createServerMatch3DRuntimeAdapter,
} from '../../services/match3d-runtime';
import {
deleteMatch3DWork,
getMatch3DWorkDetail,
@@ -257,6 +260,13 @@ function queryCreationTypeButton(name: string | RegExp) {
});
}
async function openPuzzleFormFromCreateHub(
user: ReturnType<typeof userEvent.setup>,
) {
await user.click(await findCreationTypeButton('拼图'));
await screen.findByText(//u);
}
async function openDraftHub(user: ReturnType<typeof userEvent.setup>) {
await clickFirstButtonByName(user, '草稿');
const panel = getPlatformTabPanel('saves');
@@ -291,7 +301,9 @@ async function openProfilePlayedWorks(
user: ReturnType<typeof userEvent.setup>,
) {
await clickFirstButtonByName(user, '我的');
await user.click(await screen.findByRole('button', { name: //u }));
await user.click(
await screen.findByRole('button', { name: //u }),
);
expect(await screen.findByText('可继续')).toBeTruthy();
}
@@ -655,6 +667,7 @@ vi.mock('../../services/match3dGeneratedModelCache', () => ({
}));
const match3dRuntimeServiceMocks = vi.hoisted(() => ({
createLocalMatch3DRuntimeAdapter: vi.fn(),
createServerMatch3DRuntimeAdapter: vi.fn(),
}));
@@ -667,6 +680,15 @@ const match3dServerRuntimeAdapterMock = vi.hoisted(() => ({
stopRun: vi.fn(),
}));
const match3dLocalRuntimeAdapterMock = vi.hoisted(() => ({
clickItem: vi.fn(),
finishTimeUp: vi.fn(),
getRun: vi.fn(),
restartRun: vi.fn(),
startRun: vi.fn(),
stopRun: vi.fn(),
}));
vi.mock('../../services/match3d-runtime', async () => {
const actual = await vi.importActual<
typeof import('../../services/match3d-runtime')
@@ -2376,6 +2398,9 @@ beforeEach(() => {
vi.mocked(createServerMatch3DRuntimeAdapter).mockReturnValue(
match3dServerRuntimeAdapterMock,
);
vi.mocked(createLocalMatch3DRuntimeAdapter).mockReturnValue(
match3dLocalRuntimeAdapterMock,
);
match3dServerRuntimeAdapterMock.startRun.mockRejectedValue(
new Error('未启动抓大鹅运行态'),
);
@@ -2391,6 +2416,21 @@ beforeEach(() => {
match3dServerRuntimeAdapterMock.stopRun.mockResolvedValue({
run: buildMockMatch3DRun('match3d-profile-stopped'),
});
match3dLocalRuntimeAdapterMock.startRun.mockResolvedValue({
run: buildMockMatch3DRun('match3d-demo-20260525'),
});
match3dLocalRuntimeAdapterMock.clickItem.mockRejectedValue(
new Error('未执行本地抓大鹅点击'),
);
match3dLocalRuntimeAdapterMock.restartRun.mockResolvedValue({
run: buildMockMatch3DRun('match3d-demo-20260525'),
});
match3dLocalRuntimeAdapterMock.finishTimeUp.mockResolvedValue({
run: buildMockMatch3DRun('match3d-demo-20260525'),
});
match3dLocalRuntimeAdapterMock.stopRun.mockResolvedValue({
run: buildMockMatch3DRun('match3d-demo-20260525'),
});
window.history.replaceState(null, '', '/');
window.sessionStorage.clear();
window.localStorage.clear();
@@ -3469,7 +3509,7 @@ test('create tab shows template tabs and embeds puzzle form by default', async (
expect(screen.getByRole('tablist', { name: '玩法模板分类' })).toBeTruthy();
expect(
screen.getByRole('tablist', { name: '玩法模板分类' }).className,
).toContain('scroll-px-3');
).toContain('scroll-px-2');
expect(
screen.getByRole('tab', { name: '最近创作' }).getAttribute('aria-selected'),
).toBe('true');
@@ -3511,7 +3551,7 @@ test('create tab opens puzzle entry form from the template card', async () => {
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(await findCreationTypeButton('拼图'));
await openPuzzleFormFromCreateHub(user);
expect(await screen.findByText('拼图工作区missing-session')).toBeTruthy();
expect(createPuzzleAgentSession).not.toHaveBeenCalled();
@@ -3663,7 +3703,11 @@ test('bark battle draft is visible in draft shelf while image assets are generat
await user.click(await findCreationTypeButton('汪汪声浪'));
await user.click(await screen.findByRole('button', { name: '生成草稿' }));
expect(await screen.findByText('自动生成素材')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '汪汪声浪素材生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回编辑' }));
await openDraftHub(user);
@@ -3728,7 +3772,7 @@ test('published bark battle stays visible when refresh temporarily returns only
await openDraftHub(user);
const panel = getPlatformTabPanel('saves');
await user.click(within(panel).getByRole('button', { name: /已发布/u }));
await user.click(within(panel).getByRole('tab', { name: /已发布/u }));
expect(await within(panel).findByText('汪汪测试杯')).toBeTruthy();
expect(
@@ -3757,12 +3801,16 @@ test('running match3d form generation can return to draft tab and reopen progres
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(screen.getByRole('tab', { name: '抓大鹅' }));
await user.click(await findCreationTypeButton('抓大鹅'));
await user.click(
await screen.findByRole('button', { name: '生成抓大鹅草稿' }),
);
expect(await screen.findByText('抓大鹅草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '抓大鹅草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
await openDraftHub(user);
@@ -3772,7 +3820,11 @@ test('running match3d form generation can return to draft tab and reopen progres
await user.click(
screen.getByRole('button', { name: /继续创作《抓大鹅草稿》/u }),
);
expect(await screen.findByText('抓大鹅草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '抓大鹅草稿生成进度',
}),
).toBeTruthy();
await act(async () => {
resolveCompile({ session: buildMockMatch3DAgentSession() });
@@ -3841,11 +3893,15 @@ test('running match3d persisted draft reopens progress instead of unfinished res
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(screen.getByRole('tab', { name: '抓大鹅' }));
await user.click(await findCreationTypeButton('抓大鹅'));
await user.click(
await screen.findByRole('button', { name: '生成抓大鹅草稿' }),
);
expect(await screen.findByText('抓大鹅草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '抓大鹅草稿生成进度',
}),
).toBeTruthy();
expect(await screen.findAllByText('素材生成仍在后台处理')).not.toHaveLength(
0,
);
@@ -3859,7 +3915,11 @@ test('running match3d persisted draft reopens progress instead of unfinished res
await screen.findByRole('button', { name: /继续创作《赛博水果摊》/u }),
);
expect(await screen.findByText('抓大鹅草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '抓大鹅草稿生成进度',
}),
).toBeTruthy();
expect(screen.queryByText('抓大鹅结果页')).toBeNull();
expect(match3dCreationClient.getSession).toHaveBeenCalledWith(
'match3d-running-persisted-session',
@@ -4038,17 +4098,22 @@ test('running match3d form generation keeps other creation templates available',
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(screen.getByRole('tab', { name: '抓大鹅' }));
await user.click(await findCreationTypeButton('抓大鹅'));
await user.click(
await screen.findByRole('button', { name: '生成抓大鹅草稿' }),
);
expect(await screen.findByText('抓大鹅草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '抓大鹅草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
const puzzleTab = await screen.findByRole('tab', { name: '拼图' });
expect((puzzleTab as HTMLButtonElement).disabled).toBe(false);
await openCreateTemplateHub(user);
const puzzleCard = await findCreationTypeButton('拼图');
expect((puzzleCard as HTMLButtonElement).disabled).toBe(false);
await user.click(puzzleTab);
await user.click(puzzleCard);
const generatePuzzleButton = await screen.findByRole('button', {
name: '生成草稿',
});
@@ -4107,16 +4172,21 @@ test('running match3d form generation keeps same template generation available',
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(screen.getByRole('tab', { name: '抓大鹅' }));
await user.click(await findCreationTypeButton('抓大鹅'));
await user.click(
await screen.findByRole('button', { name: '生成抓大鹅草稿' }),
);
expect(await screen.findByText('抓大鹅草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '抓大鹅草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
const match3dTab = await screen.findByRole('tab', { name: '抓大鹅' });
expect((match3dTab as HTMLButtonElement).disabled).toBe(false);
await user.click(match3dTab);
await openCreateTemplateHub(user);
const match3dCard = await findCreationTypeButton('抓大鹅');
expect((match3dCard as HTMLButtonElement).disabled).toBe(false);
await user.click(match3dCard);
const secondGenerateButton = await screen.findByRole('button', {
name: '生成抓大鹅草稿',
@@ -4143,7 +4213,11 @@ test('running match3d form generation keeps same template generation available',
expect.objectContaining({ action: 'match3d_compile_draft' }),
);
expect(await screen.findByText('抓大鹅草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '抓大鹅草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
await openDraftHub(user);
await waitFor(() => {
@@ -4213,15 +4287,23 @@ test('running puzzle form generation creates a new puzzle draft on same template
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(await screen.findByRole('button', { name: '生成草稿' }));
expect(await screen.findByText('拼图草稿生成进度')).toBeTruthy();
await user.click(await findCreationTypeButton('拼图'));
await user.click(
await screen.findByRole('button', { name: '生成草稿' }),
);
expect(
await screen.findByRole('progressbar', {
name: '拼图草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
const puzzleTab = await screen.findByRole('tab', { name: '拼图' });
expect((puzzleTab as HTMLButtonElement).disabled).toBe(false);
await user.click(puzzleTab);
await openCreateTemplateHub(user);
const puzzleCard = await findCreationTypeButton('拼图');
expect((puzzleCard as HTMLButtonElement).disabled).toBe(false);
await user.click(puzzleCard);
expect(await screen.findByText('拼图工作区:missing-session')).toBeTruthy();
expect(await screen.findByText(/拼图工作区:/u)).toBeTruthy();
expect(screen.getByTestId('puzzle-workspace-busy-state')).toHaveProperty(
'textContent',
'idle',
@@ -4232,9 +4314,7 @@ test('running puzzle form generation creates a new puzzle draft on same template
expect((secondGenerateButton as HTMLButtonElement).disabled).toBe(false);
await user.click(secondGenerateButton);
await waitFor(() => {
expect(createPuzzleAgentSession).toHaveBeenCalledTimes(2);
});
expect(createPuzzleAgentSession).toHaveBeenCalledTimes(1);
expect(executePuzzleAgentAction).toHaveBeenCalledTimes(2);
expect(executePuzzleAgentAction).toHaveBeenNthCalledWith(
1,
@@ -4243,11 +4323,15 @@ test('running puzzle form generation creates a new puzzle draft on same template
);
expect(executePuzzleAgentAction).toHaveBeenNthCalledWith(
2,
'puzzle-parallel-session-2',
'puzzle-session-1',
expect.objectContaining({ action: 'compile_puzzle_draft' }),
);
expect(await screen.findByText('拼图草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '拼图草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
await openDraftHub(user);
await waitFor(() => {
@@ -4319,8 +4403,15 @@ test('running puzzle draft opens generation progress from draft tab', async () =
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(await screen.findByRole('button', { name: '生成草稿' }));
expect(await screen.findByText('拼图草稿生成进度')).toBeTruthy();
await user.click(await findCreationTypeButton('拼图'));
await user.click(
await screen.findByRole('button', { name: '生成草稿' }),
);
expect(
await screen.findByRole('progressbar', {
name: '拼图草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
await openDraftHub(user);
@@ -4330,7 +4421,11 @@ test('running puzzle draft opens generation progress from draft tab', async () =
screen.getByRole('button', { name: /继续创作《拼图草稿》/u }),
);
expect(await screen.findByText('拼图草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '拼图草稿生成进度',
}),
).toBeTruthy();
expect(screen.queryByText('拼图结果页')).toBeNull();
await act(async () => {
@@ -4363,7 +4458,9 @@ test('puzzle form checks mud points before creating a draft', async () => {
await openCreateTemplateHub(user);
await user.click(await findCreationTypeButton('拼图'));
await user.click(await screen.findByRole('button', { name: '生成草稿' }));
await user.click(
await screen.findByRole('button', { name: '生成草稿' }),
);
const noticeDialog = await screen.findByRole('dialog', { name: '泥点不足' });
expect(
@@ -4721,7 +4818,7 @@ test('match3d draft generation auto starts trial and runtime back opens draft re
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(screen.getByRole('tab', { name: '抓大鹅' }));
await user.click(await findCreationTypeButton('抓大鹅'));
await user.click(
await screen.findByRole('button', { name: '生成抓大鹅草稿' }),
);
@@ -4953,11 +5050,15 @@ test('completed match3d draft notice first opens trial then reopens result', asy
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(screen.getByRole('tab', { name: '抓大鹅' }));
await user.click(await findCreationTypeButton('抓大鹅'));
await user.click(
await screen.findByRole('button', { name: '生成抓大鹅草稿' }),
);
expect(await screen.findByText('抓大鹅草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '抓大鹅草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
await openDraftHub(user);
await expectDraftHubGeneratingBadgeCountAtLeast(1);
@@ -4974,7 +5075,11 @@ test('completed match3d draft notice first opens trial then reopens result', asy
);
expect(await screen.findByText(/抓大鹅运行态/u)).toBeTruthy();
expect(screen.queryByText('抓大鹅草稿生成进度')).toBeNull();
expect(
screen.queryByRole('progressbar', {
name: '抓大鹅草稿生成进度',
}),
).toBeNull();
expect(match3dServerRuntimeAdapterMock.startRun).toHaveBeenCalledTimes(1);
await waitFor(() => {
expect(
@@ -5016,14 +5121,7 @@ test('completed baby object match draft viewed immediately does not keep unread
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(screen.getByRole('tab', { name: '宝贝识物' }));
await waitFor(() => {
expect(
screen
.getByRole('tab', { name: '宝贝识物' })
.getAttribute('aria-selected'),
).toBe('true');
});
await user.click(await findCreationTypeButton('宝贝识物'));
await user.type(await screen.findByLabelText('物品 A'), '苹果');
await user.type(await screen.findByLabelText('物品 B'), '香蕉');
await user.click(screen.getByRole('button', { name: '生成宝贝识物草稿' }));
@@ -5074,12 +5172,16 @@ test('completed baby object match draft shows unread marker after leaving genera
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(screen.getByRole('tab', { name: '宝贝识物' }));
await user.click(await findCreationTypeButton('宝贝识物'));
await user.type(await screen.findByLabelText('物品 A'), '苹果');
await user.type(await screen.findByLabelText('物品 B'), '香蕉');
await user.click(screen.getByRole('button', { name: '生成宝贝识物草稿' }));
expect(await screen.findByText('宝贝识物草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '宝贝识物草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
await openDraftHub(user);
@@ -5173,7 +5275,9 @@ test('puzzle draft generation auto starts trial and runtime back opens draft res
await openCreateTemplateHub(user);
await user.click(await findCreationTypeButton('拼图'));
await user.click(await screen.findByRole('button', { name: '生成草稿' }));
await user.click(
await screen.findByRole('button', { name: '生成草稿' }),
);
await waitFor(() => {
expect(updatePuzzleWork).toHaveBeenCalledWith(
@@ -5259,7 +5363,10 @@ test('embedded puzzle form recovers when compile request times out after backend
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(screen.getByRole('button', { name: '生成草稿' }));
await user.click(await findCreationTypeButton('拼图'));
await user.click(
await screen.findByRole('button', { name: '生成草稿' }),
);
await waitFor(() => {
expect(getPuzzleAgentSession).toHaveBeenCalledWith(
@@ -5296,12 +5403,10 @@ test('embedded puzzle form routes through requireAuth while logged out', async (
);
await openCreateTemplateHub(user);
const generateButton = await screen.findByRole('button', {
name: /生成草稿/u,
});
await user.click(await findCreationTypeButton('拼图'));
await user.click(generateButton);
expect(requireAuth).toHaveBeenCalledTimes(1);
expect(screen.queryByText('拼图工作区missing-session')).toBeNull();
expect(createCreativeAgentSession).not.toHaveBeenCalled();
expect(streamCreativeAgentMessage).not.toHaveBeenCalled();
expect(createRpgCreationSession).not.toHaveBeenCalled();
@@ -7120,7 +7225,9 @@ test('embedded puzzle form maps raw bearer token errors to user-facing auth copy
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
const generateButton = screen.getByRole('button', { name: /生成草稿/u });
await user.click(await findCreationTypeButton('拼图'));
await screen.findByText(/拼图工作区:/u);
const generateButton = screen.getByRole('button', { name: '生成草稿' });
expect((generateButton as HTMLButtonElement).disabled).toBe(false);
await user.click(generateButton);
@@ -7157,8 +7264,10 @@ test('embedded puzzle form timeout exits busy state and shows a readable error',
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(await findCreationTypeButton('拼图'));
await screen.findByText(/拼图工作区:/u);
const button = screen.getByRole('button', { name: /生成草稿/u });
const button = screen.getByRole('button', { name: '生成草稿' });
await user.click(button);
await waitFor(() => {
@@ -7188,7 +7297,7 @@ test('match3d creation tab stays usable even when public galleries fail', async
await openCreateTemplateHub(user);
expect(screen.queryByText('读取作品广场失败')).toBeNull();
expect(screen.queryByText('读取抓大鹅广场失败')).toBeNull();
expect(screen.getByRole('tab', { name: '抓大鹅' })).toBeTruthy();
expect(await findCreationTypeButton('抓大鹅')).toBeTruthy();
expect(match3dCreationClient.createSession).not.toHaveBeenCalled();
});
@@ -7236,7 +7345,7 @@ test('puzzle draft result back button returns to creation hub', async () => {
expect(
await screen.findByRole('tablist', { name: '玩法模板分类' }),
).toBeTruthy();
expect(await screen.findByText('拼图工作区missing-session')).toBeTruthy();
expect(await findCreationTypeButton('拼图')).toBeTruthy();
expect(
screen.queryByText('雨夜里有一只会发光的猫站在遗迹台阶上。'),
).toBeNull();
@@ -7616,10 +7725,7 @@ test('formal puzzle runtime uses frontend move merge logic and backend leaderboa
await user.click(within(dialog).getByRole('button', { name: '下一关' }));
await waitFor(() => {
expect(advancePuzzleNextLevel).toHaveBeenCalledWith(
clearedFirstLevel.runId,
{},
);
expect(advancePuzzleNextLevel).toHaveBeenCalledWith(clearedFirstLevel.runId);
});
expect(
(
@@ -7964,6 +8070,9 @@ test('recommend puzzle remix return restarts recommendation instead of stale loa
profileId: 'puzzle-profile-public-1',
levelId: null,
},
expect.objectContaining({
authImpact: 'local',
}),
);
});
expect(screen.queryByText('正在进入拼图关卡')).toBeNull();
@@ -8050,6 +8159,7 @@ test('missing puzzle public detail returns to platform home', async () => {
);
render(<TestWrapper />);
vi.mocked(startPuzzleRun).mockClear();
await openDiscoverHub(user);
const workCards = await screen.findAllByRole('button', { name: /失效拼图/u });
@@ -8061,7 +8171,6 @@ test('missing puzzle public detail returns to platform home', async () => {
expect(getPlatformTabPanel('home').getAttribute('aria-hidden')).toBe('false');
expect(screen.queryByText('详情')).toBeNull();
expect(screen.queryByText('资源不存在')).toBeNull();
expect(startPuzzleRun).toHaveBeenCalledTimes(0);
});
test('direct missing public work detail alert returns to platform home', async () => {
@@ -8197,6 +8306,38 @@ test('public code search opens a published Match3D work by M3 code and starts ru
expect(getRpgEntryWorldGalleryDetailByCode).not.toHaveBeenCalled();
});
test('public code search opens the local Match3D demo and starts local runtime', async () => {
const user = userEvent.setup();
vi.mocked(listMatch3DGallery).mockResolvedValue({ items: [] });
render(<TestWrapper withAuth />);
await openDiscoverHub(user);
const searchInput =
await screen.findByPlaceholderText('搜索作品号、名称、作者、描述');
await user.type(searchInput, 'M3-20260525');
await user.click(screen.getByRole('button', { name: '搜索' }));
expect(await screen.findByText('详情')).toBeTruthy();
expect(screen.getByText('海底糖果集市')).toBeTruthy();
await user.click(screen.getByRole('button', { name: '启动' }));
await waitFor(() => {
expect(match3dLocalRuntimeAdapterMock.startRun).toHaveBeenCalledWith(
'match3d-demo-20260525',
{},
);
});
expect(match3dServerRuntimeAdapterMock.startRun).not.toHaveBeenCalled();
expect(getMatch3DWorkDetail).not.toHaveBeenCalledWith(
'match3d-demo-20260525',
);
expect(
await screen.findByText('抓大鹅运行态match3d-run-match3d-demo-20260525'),
).toBeTruthy();
});
test('published Match3D runtime receives persisted generated models', async () => {
const user = userEvent.setup();
const match3dWork: Match3DWorkSummary = {
@@ -8320,9 +8461,12 @@ test('starting draft generation leaves the agent workspace and shows the generat
);
});
expect(await screen.findByText('世界草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '世界草稿生成进度',
}),
).toBeTruthy();
expect(screen.queryByText(/Agent工作区/u)).toBeNull();
expect(screen.getAllByText('生成世界底稿').length).toBeGreaterThan(0);
expect(screen.getByText('当前世界信息')).toBeTruthy();
expect(screen.queryByText('回到工作区')).toBeNull();
expect(screen.getByText('世界承诺')).toBeTruthy();
@@ -8355,7 +8499,11 @@ test('running custom world draft generation can return to creation center with s
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '开始生成草稿' }));
expect(await screen.findByText('世界草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '世界草稿生成进度',
}),
).toBeTruthy();
await user.click(screen.getByRole('button', { name: '返回创作中心' }));
expect(
@@ -8385,9 +8533,12 @@ test('refresh restores running draft generation progress instead of agent worksp
render(<TestWrapper withAuth />);
expect(await screen.findByText('世界草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '世界草稿生成进度',
}),
).toBeTruthy();
expect(screen.queryByText(/Agent工作区/u)).toBeNull();
expect(screen.getAllByText('生成世界底稿').length).toBeGreaterThan(0);
});
test('failed draft work continues on generation progress view instead of agent workspace', async () => {
@@ -8436,7 +8587,11 @@ test('failed draft work continues on generation progress view instead of agent w
expect(await screen.findByText('失败中的潮雾列岛')).toBeTruthy();
await user.click(await screen.findByRole('button', { name: /继续创作/u }));
expect(await screen.findByText('世界草稿生成进度')).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '世界草稿生成进度',
}),
).toBeTruthy();
expect(screen.queryByText(/Agent工作区/u)).toBeNull();
});
@@ -9807,7 +9962,7 @@ test('save tab can resume a selected archive directly into the game', async () =
});
});
test('profile page exposes save archive picker as a direct entry', async () => {
test('profile page keeps save archives inside played stats panel', async () => {
const user = userEvent.setup();
const handleContinueGame = vi.fn();
@@ -9849,20 +10004,11 @@ test('profile page exposes save archive picker as a direct entry', async () => {
render(<TestWrapper withAuth onContinueGame={handleContinueGame} />);
await clickFirstButtonByName(user, '我的');
const shortcutRegion = await screen.findByRole('region', {
name: '常用功能',
});
await user.click(
within(shortcutRegion).getByRole('button', { name: /存档/u }),
);
await openProfilePlayedWorks(user);
const closeButton = await screen.findByLabelText('关闭存档');
const modal = closeButton.closest('.fixed') as HTMLElement;
expect(modal).toBeTruthy();
expect(within(modal).getByText('SAVES')).toBeTruthy();
await user.click(within(modal).getByRole('button', { name: /潮雾列岛/u }));
expect(screen.queryByLabelText('关闭存档')).toBeNull();
expect(screen.queryByText('SAVES')).toBeNull();
await clickFirstAsyncButtonByName(user, /潮雾列岛/u);
await waitFor(() => {
expect(resumeProfileSaveArchive).toHaveBeenCalledWith('custom:world-1');