Skip to content

Commit 0d24f46

Browse files
committed
fix(e2e): unbind wan3.0/--file dry-run tests from token-plan
1 parent 8360a9f commit 0d24f46

1 file changed

Lines changed: 70 additions & 174 deletions

File tree

packages/commands/tests/e2e/video-generate-i2v.e2e.test.ts

Lines changed: 70 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -115,46 +115,26 @@ describe("e2e: video generate (i2v)", () => {
115115

116116
test.each([
117117
// wan2.1~2.6 (legacy) use flat img_url; wan2.7+ / wan3.0 / happyhorse use media[].
118+
// 用普通 dry-run(不绑 token-plan):TP 不支持 wan3.0,绑 TP 会形成错误测试契约。
118119
["wan2.5-i2v-preview", "img_url"],
119120
["wan2.6-i2v", "img_url"],
120121
["wan2.7-i2v", "media"],
121122
["wan3.0-video", "media"],
122123
["happyhorse-1.1-i2v", "media"],
123124
])("video generate --dry-run %s 首帧走 %s 字段", async (model, field) => {
124-
const configDir = makeE2eOutputDir(`video-i2v-input-shape-${model}`);
125-
writeFileSync(
126-
join(configDir, "config.json"),
127-
JSON.stringify({
128-
"token-plan": {
129-
api_key: "sk-sp-e2e-placeholder",
130-
base_url: "https://token-plan.cn-beijing.maas.aliyuncs.com",
131-
},
132-
}),
133-
);
134-
135-
const { stdout, stderr, exitCode } = await runCommandE2e(
136-
VIDEO_ROUTES,
137-
[
138-
"video",
139-
"generate",
140-
"--config",
141-
"token-plan",
142-
"--dry-run",
143-
"--model",
144-
model,
145-
"--image",
146-
"https://example.com/placeholder.png",
147-
"--prompt",
148-
"干跑校验",
149-
"--output",
150-
"json",
151-
],
152-
{
153-
BAILIAN_CONFIG_DIR: configDir,
154-
DASHSCOPE_API_KEY: "",
155-
DASHSCOPE_BASE_URL: "",
156-
},
157-
);
125+
const { stdout, stderr, exitCode } = await runCommandE2e(VIDEO_ROUTES, [
126+
"video",
127+
"generate",
128+
"--dry-run",
129+
"--model",
130+
model,
131+
"--image",
132+
"https://example.com/placeholder.png",
133+
"--prompt",
134+
"干跑校验",
135+
"--output",
136+
"json",
137+
]);
158138
expect(exitCode, stderr).toBe(0);
159139
const data = parseStdoutJson<{
160140
request?: {
@@ -171,40 +151,19 @@ describe("e2e: video generate (i2v)", () => {
171151
});
172152

173153
test("video generate --dry-run --file 走 media file 字段", async () => {
174-
const configDir = makeE2eOutputDir("video-generate-file-url");
175-
writeFileSync(
176-
join(configDir, "config.json"),
177-
JSON.stringify({
178-
"token-plan": {
179-
api_key: "sk-sp-e2e-placeholder",
180-
base_url: "https://token-plan.cn-beijing.maas.aliyuncs.com",
181-
},
182-
}),
183-
);
184-
185-
const { stdout, stderr, exitCode } = await runCommandE2e(
186-
VIDEO_ROUTES,
187-
[
188-
"video",
189-
"generate",
190-
"--config",
191-
"token-plan",
192-
"--dry-run",
193-
"--model",
194-
"wan3.0-video",
195-
"--file",
196-
"https://example.com/reference.pdf",
197-
"--prompt",
198-
"文件生视频干跑",
199-
"--output",
200-
"json",
201-
],
202-
{
203-
BAILIAN_CONFIG_DIR: configDir,
204-
DASHSCOPE_API_KEY: "",
205-
DASHSCOPE_BASE_URL: "",
206-
},
207-
);
154+
const { stdout, stderr, exitCode } = await runCommandE2e(VIDEO_ROUTES, [
155+
"video",
156+
"generate",
157+
"--dry-run",
158+
"--model",
159+
"wan3.0-video",
160+
"--file",
161+
"https://example.com/reference.pdf",
162+
"--prompt",
163+
"文件生视频干跑",
164+
"--output",
165+
"json",
166+
]);
208167
expect(exitCode, stderr).toBe(0);
209168
const data = parseStdoutJson<{
210169
request?: {
@@ -224,122 +183,59 @@ describe("e2e: video generate (i2v)", () => {
224183
});
225184

226185
test("--file 与 --image 互斥时报用法错误并退出 (2)", async () => {
227-
const configDir = makeE2eOutputDir("video-generate-file-mutex-image");
228-
writeFileSync(
229-
join(configDir, "config.json"),
230-
JSON.stringify({
231-
"token-plan": {
232-
api_key: "sk-sp-e2e-placeholder",
233-
base_url: "https://token-plan.cn-beijing.maas.aliyuncs.com",
234-
},
235-
}),
236-
);
237-
238-
const { stderr, exitCode } = await runCommandE2e(
239-
VIDEO_ROUTES,
240-
[
241-
"video",
242-
"generate",
243-
"--config",
244-
"token-plan",
245-
"--dry-run",
246-
"--model",
247-
"wan3.0-video",
248-
"--file",
249-
"https://example.com/reference.pdf",
250-
"--image",
251-
"https://example.com/placeholder.png",
252-
"--prompt",
253-
"互斥校验",
254-
"--output",
255-
"json",
256-
],
257-
{
258-
BAILIAN_CONFIG_DIR: configDir,
259-
DASHSCOPE_API_KEY: "",
260-
DASHSCOPE_BASE_URL: "",
261-
},
262-
);
186+
const { stderr, exitCode } = await runCommandE2e(VIDEO_ROUTES, [
187+
"video",
188+
"generate",
189+
"--dry-run",
190+
"--model",
191+
"wan3.0-video",
192+
"--file",
193+
"https://example.com/reference.pdf",
194+
"--image",
195+
"https://example.com/placeholder.png",
196+
"--prompt",
197+
"互斥校验",
198+
"--output",
199+
"json",
200+
]);
263201
expect(exitCode).toBe(2);
264202
expect(stderr).toMatch(/--file.*mutually exclusive|--file.*|mutually exclusive/i);
265203
});
266204

267205
test("--file 与 --last-frame 互斥时报用法错误并退出 (2)", async () => {
268-
const configDir = makeE2eOutputDir("video-generate-file-mutex-lastframe");
269-
writeFileSync(
270-
join(configDir, "config.json"),
271-
JSON.stringify({
272-
"token-plan": {
273-
api_key: "sk-sp-e2e-placeholder",
274-
base_url: "https://token-plan.cn-beijing.maas.aliyuncs.com",
275-
},
276-
}),
277-
);
278-
279-
const { stderr, exitCode } = await runCommandE2e(
280-
VIDEO_ROUTES,
281-
[
282-
"video",
283-
"generate",
284-
"--config",
285-
"token-plan",
286-
"--dry-run",
287-
"--model",
288-
"wan3.0-video",
289-
"--file",
290-
"https://example.com/reference.pdf",
291-
"--last-frame",
292-
"https://example.com/last-frame.png",
293-
"--prompt",
294-
"互斥校验",
295-
"--output",
296-
"json",
297-
],
298-
{
299-
BAILIAN_CONFIG_DIR: configDir,
300-
DASHSCOPE_API_KEY: "",
301-
DASHSCOPE_BASE_URL: "",
302-
},
303-
);
206+
const { stderr, exitCode } = await runCommandE2e(VIDEO_ROUTES, [
207+
"video",
208+
"generate",
209+
"--dry-run",
210+
"--model",
211+
"wan3.0-video",
212+
"--file",
213+
"https://example.com/reference.pdf",
214+
"--last-frame",
215+
"https://example.com/last-frame.png",
216+
"--prompt",
217+
"互斥校验",
218+
"--output",
219+
"json",
220+
]);
304221
expect(exitCode).toBe(2);
305222
expect(stderr).toMatch(/--file.*mutually exclusive|--file.*|mutually exclusive/i);
306223
});
307224

308225
test("非 wan3.0 模型使用 --file 时报用法错误并退出 (2)", async () => {
309-
const configDir = makeE2eOutputDir("video-generate-file-model-restricted");
310-
writeFileSync(
311-
join(configDir, "config.json"),
312-
JSON.stringify({
313-
"token-plan": {
314-
api_key: "sk-sp-e2e-placeholder",
315-
base_url: "https://token-plan.cn-beijing.maas.aliyuncs.com",
316-
},
317-
}),
318-
);
319-
320-
const { stderr, exitCode } = await runCommandE2e(
321-
VIDEO_ROUTES,
322-
[
323-
"video",
324-
"generate",
325-
"--config",
326-
"token-plan",
327-
"--dry-run",
328-
"--model",
329-
"wan2.6-i2v",
330-
"--file",
331-
"https://example.com/reference.pdf",
332-
"--prompt",
333-
"模型限制校验",
334-
"--output",
335-
"json",
336-
],
337-
{
338-
BAILIAN_CONFIG_DIR: configDir,
339-
DASHSCOPE_API_KEY: "",
340-
DASHSCOPE_BASE_URL: "",
341-
},
342-
);
226+
const { stderr, exitCode } = await runCommandE2e(VIDEO_ROUTES, [
227+
"video",
228+
"generate",
229+
"--dry-run",
230+
"--model",
231+
"wan2.6-i2v",
232+
"--file",
233+
"https://example.com/reference.pdf",
234+
"--prompt",
235+
"模型限制校验",
236+
"--output",
237+
"json",
238+
]);
343239
expect(exitCode).toBe(2);
344240
expect(stderr).toMatch(
345241
/--file.*only supported by wan3\.0-video|--file.*.*wan3\.0-video|only supported by wan3\.0-video/i,

0 commit comments

Comments
 (0)