@@ -97,7 +97,7 @@ describe("e2e: speech recognize", () => {
9797 } ) ;
9898
9999 test ( "speech recognize realtime 模型报用法错误" , async ( ) => {
100- // 使用 --dry-run:跳过 auth,避免 CI 无密钥时先以 AUTH(3) 退出
100+ // Use --dry-run to skip auth so CI without API keys still hits USAGE(2)
101101 const { stderr, exitCode } = await runCommandE2e ( SPEECH_ROUTES , [
102102 "speech" ,
103103 "recognize" ,
@@ -188,6 +188,87 @@ describe("e2e: speech recognize", () => {
188188 expect ( exitCode ) . toBe ( 2 ) ;
189189 expect ( stderr ) . toMatch ( / e x a c t l y o n e - - u r l | s y n c F l a s h / i) ;
190190 } ) ;
191+
192+ test ( "speech recognize qwen3-filetrans 轮询成功后下载 result.transcription_url" , async ( ) => {
193+ const server = http . createServer ( ( request , response ) => {
194+ const url = request . url ?? "" ;
195+ const chunks : Buffer [ ] = [ ] ;
196+ request . on ( "data" , ( chunk : Buffer ) => chunks . push ( chunk ) ) ;
197+ request . on ( "end" , ( ) => {
198+ response . writeHead ( 200 , { "Content-Type" : "application/json" } ) ;
199+ if ( url . startsWith ( "/api/v1/services/audio/asr/transcription" ) ) {
200+ response . end (
201+ JSON . stringify ( {
202+ output : { task_id : "task-qwen3" , task_status : "PENDING" } ,
203+ request_id : "req-submit" ,
204+ } ) ,
205+ ) ;
206+ return ;
207+ }
208+ if ( url . startsWith ( "/api/v1/tasks/" ) ) {
209+ const address = server . address ( ) as AddressInfo ;
210+ response . end (
211+ JSON . stringify ( {
212+ output : {
213+ task_id : "task-qwen3" ,
214+ task_status : "SUCCEEDED" ,
215+ result : {
216+ transcription_url : `http://127.0.0.1:${ address . port } /transcription.json` ,
217+ } ,
218+ } ,
219+ request_id : "req-poll" ,
220+ } ) ,
221+ ) ;
222+ return ;
223+ }
224+ if ( url . startsWith ( "/transcription.json" ) ) {
225+ response . end (
226+ JSON . stringify ( {
227+ file_url : "https://example.com/a.wav" ,
228+ transcripts : [ { text : "你好世界" , sentences : [ { text : "你好世界" } ] } ] ,
229+ } ) ,
230+ ) ;
231+ return ;
232+ }
233+ response . writeHead ( 404 ) ;
234+ response . end ( JSON . stringify ( { message : `unexpected path: ${ url } ` } ) ) ;
235+ } ) ;
236+ } ) ;
237+ await new Promise < void > ( ( resolve ) => server . listen ( 0 , "127.0.0.1" , resolve ) ) ;
238+ const address = server . address ( ) as AddressInfo ;
239+ const outDir = makeE2eOutputDir ( "speech-recognize-qwen3-filetrans" ) ;
240+ const outPath = join ( outDir , "result.json" ) ;
241+
242+ try {
243+ const { stdout, stderr, exitCode } = await runCommandE2e ( SPEECH_ROUTES , [
244+ "speech" ,
245+ "recognize" ,
246+ "--model" ,
247+ "qwen3-asr-flash-filetrans" ,
248+ "--url" ,
249+ "https://example.com/a.wav" ,
250+ "--language" ,
251+ "zh" ,
252+ "--api-key" ,
253+ "sk-e2e-placeholder" ,
254+ "--base-url" ,
255+ `http://127.0.0.1:${ address . port } ` ,
256+ "--poll-interval" ,
257+ "1" ,
258+ "--out" ,
259+ outPath ,
260+ "--quiet" ,
261+ ] ) ;
262+
263+ expect ( exitCode , stderr ) . toBe ( 0 ) ;
264+ expect ( stdout ) . toContain ( "你好世界" ) ;
265+ expect ( JSON . parse ( readFileSync ( outPath , "utf8" ) ) ) . toMatchObject ( {
266+ transcripts : [ { text : "你好世界" } ] ,
267+ } ) ;
268+ } finally {
269+ await new Promise < void > ( ( resolve ) => server . close ( ( ) => resolve ( ) ) ) ;
270+ }
271+ } ) ;
191272} ) ;
192273
193274describe . skipIf ( ! isBailianE2EMediaEnabled ( ) || ! isDashScopeE2EReady ( ) ) (
0 commit comments