feat: publish Agent Studio integrations and setup guide
This commit is contained in:
@@ -35,6 +35,44 @@ function makeStore() {
|
||||
afterEach(() => vi.unstubAllGlobals());
|
||||
|
||||
describe("App", () => {
|
||||
it("fills a generation-approval prompt for a continued uploaded task without sending or asking for another upload", async () => {
|
||||
const store = makeStore();
|
||||
store.getSnapshot().skills.push({ name: "swads-image-to-video", description: "Image video", source: "local", filePath: "external/swads-image-to-video/SKILL.md", diagnostics: [] });
|
||||
const id = "i2v_11111111-1111-1111-1111-111111111111";
|
||||
const task = { id, revision: 4, title: "Cat", prompt: "Cat blinks", state: "awaiting_submission", durationSeconds: 3, referenceUrl: `/api/image-video/tasks/${id}/reference` };
|
||||
vi.stubGlobal("fetch", (_url: string, init?: RequestInit) => Promise.resolve(new Response(JSON.stringify(init?.method === "POST" ? { task } : { tasks: [task] }))));
|
||||
render(<App store={store} autoStart={false} modelConfigured />);
|
||||
const user = userEvent.setup();
|
||||
await user.click(await screen.findByRole("button", { name: "继续此任务" }));
|
||||
await user.click(screen.getByRole("checkbox", { name: /确认将此任务接续到当前会话/ }));
|
||||
await user.click(screen.getByRole("button", { name: "确认接续(不生成)" }));
|
||||
const composer = screen.getByRole<HTMLTextAreaElement>("textbox", { name: "消息" });
|
||||
expect(composer.value).toContain(id);
|
||||
expect(composer.value).toContain("i2v_submit");
|
||||
expect(composer.value).not.toContain("i2v_upload_reference");
|
||||
expect(composer.value).toContain("3 秒");
|
||||
expect(store.sendMessage).not.toHaveBeenCalled();
|
||||
});
|
||||
it("lets the user select a discovered Skill without submitting data immediately", async () => {
|
||||
const store = makeStore();
|
||||
render(<App store={store} autoStart={false} modelConfigured />);
|
||||
await userEvent.setup().click(screen.getByRole("button", { name: "使用 ads-analysis" }));
|
||||
expect(screen.getByRole<HTMLTextAreaElement>("textbox").value).toContain("ads-analysis");
|
||||
expect(store.sendMessage).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns to Chat after choosing a Skill in the mobile layout", async () => {
|
||||
vi.stubGlobal("matchMedia", vi.fn(() => ({ matches: true, addEventListener: vi.fn(), removeEventListener: vi.fn() })));
|
||||
const store = makeStore();
|
||||
render(<App store={store} autoStart={false} modelConfigured />);
|
||||
const user = userEvent.setup();
|
||||
await user.click(screen.getByRole("tab", { name: "Skills" }));
|
||||
await user.click(screen.getByRole("button", { name: "使用 ads-analysis" }));
|
||||
expect(screen.getByRole("tab", { name: "Chat" })).toHaveAttribute("aria-selected", "true");
|
||||
expect(screen.getByRole<HTMLTextAreaElement>("textbox").value).toContain("ads-analysis");
|
||||
expect(store.sendMessage).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("renders the three primary work areas", () => {
|
||||
render(<App store={makeStore()} autoStart={false} modelConfigured />);
|
||||
expect(screen.getByRole("region", { name: "Skills Catalog" })).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user