fix: return draft results to shelf
This commit is contained in:
@@ -324,6 +324,13 @@ function getPlatformTabPanel(tab: string) {
|
||||
return panel;
|
||||
}
|
||||
|
||||
async function findPlatformTabPanel(tab: string) {
|
||||
await waitFor(() => {
|
||||
expect(document.getElementById(`platform-tab-panel-${tab}`)).toBeTruthy();
|
||||
});
|
||||
return getPlatformTabPanel(tab);
|
||||
}
|
||||
|
||||
const testCreationEntryConfig = {
|
||||
startCard: {
|
||||
title: '新建作品',
|
||||
@@ -6938,7 +6945,7 @@ test('match3d creation tab stays usable even when public galleries fail', async
|
||||
expect(match3dCreationClient.createSession).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('puzzle draft result back button returns to creation hub', async () => {
|
||||
test('puzzle draft result back button returns to draft hub when opened from shelf', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
vi.mocked(listPuzzleWorks).mockResolvedValue({
|
||||
@@ -6979,10 +6986,16 @@ test('puzzle draft result back button returns to creation hub', async () => {
|
||||
|
||||
await user.click(screen.getByRole('button', { name: '返回' }));
|
||||
|
||||
const draftPanel = await findPlatformTabPanel('saves');
|
||||
await waitFor(() => {
|
||||
expect(draftPanel.getAttribute('aria-hidden')).toBe('false');
|
||||
});
|
||||
expect(
|
||||
await screen.findByRole('tablist', { name: '玩法模板分类' }),
|
||||
within(draftPanel).getByRole('tablist', { name: '作品筛选' }),
|
||||
).toBeTruthy();
|
||||
expect(await screen.findByText('拼图工作区:missing-session')).toBeTruthy();
|
||||
expect(within(draftPanel).getByText('雨夜猫塔')).toBeTruthy();
|
||||
expect(getPlatformTabPanel('create').getAttribute('aria-hidden')).toBe('true');
|
||||
expect(screen.queryByText('拼图工作区:missing-session')).toBeNull();
|
||||
expect(
|
||||
screen.queryByText('雨夜里有一只会发光的猫站在遗迹台阶上。'),
|
||||
).toBeNull();
|
||||
@@ -8996,7 +9009,7 @@ test('agent result view does not keep legacy publish blockers when preview uses
|
||||
expect((actionButton as HTMLButtonElement).disabled).toBe(false);
|
||||
});
|
||||
|
||||
test('agent draft result back button returns to creation hub without syncing result profile', async () => {
|
||||
test('agent draft result back button returns to draft hub without syncing result profile', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
const resultSession = {
|
||||
@@ -9153,22 +9166,32 @@ test('agent draft result back button returns to creation hub without syncing res
|
||||
},
|
||||
{ timeout: 2500 },
|
||||
);
|
||||
const syncCallsBeforeBack = vi
|
||||
.mocked(executeRpgCreationAction)
|
||||
.mock.calls.filter(
|
||||
([sessionId, payload]) =>
|
||||
sessionId === 'custom-world-agent-session-1' &&
|
||||
payload?.action === 'sync_result_profile',
|
||||
).length;
|
||||
|
||||
await user.click(screen.getByRole('button', { name: /返回创作/u }));
|
||||
|
||||
const draftPanel = await findPlatformTabPanel('saves');
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole('tablist', { name: '玩法模板分类' })).toBeTruthy();
|
||||
expect(draftPanel.getAttribute('aria-hidden')).toBe('false');
|
||||
});
|
||||
expect(within(draftPanel).getByRole('tablist', { name: '作品筛选' })).toBeTruthy();
|
||||
expect(getPlatformTabPanel('create').getAttribute('aria-hidden')).toBe('true');
|
||||
|
||||
expect(
|
||||
vi
|
||||
.mocked(executeRpgCreationAction)
|
||||
.mock.calls.some(
|
||||
.mock.calls.filter(
|
||||
([sessionId, payload]) =>
|
||||
sessionId === 'custom-world-agent-session-1' &&
|
||||
payload?.action === 'sync_result_profile',
|
||||
),
|
||||
).toBe(false);
|
||||
).length,
|
||||
).toBe(syncCallsBeforeBack);
|
||||
expect(screen.queryByText('世界档案')).toBeNull();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user