@@ -18,68 +18,72 @@ const templateUI: TemplateUI = "shadcn";
18
18
const templatePostInstallAction : TemplatePostInstallAction = "runApp" ;
19
19
const appType : AppType = templateFramework === "nextjs" ? "" : "--frontend" ;
20
20
const userMessage = "Write a blog post about physical standards for letters" ;
21
+ const templateAgents = [ "financial_report" , "blog" ] ;
21
22
22
- test . describe ( `Test multiagent template ${ templateFramework } ${ dataSource } ${ templateUI } ${ appType } ${ templatePostInstallAction } ` , async ( ) => {
23
- test . skip (
24
- process . platform !== "linux" || process . env . DATASOURCE === "--no-files" ,
25
- "The multiagent template currently only works with files. We also only run on Linux to speed up tests." ,
26
- ) ;
27
- let port : number ;
28
- let externalPort : number ;
29
- let cwd : string ;
30
- let name : string ;
31
- let appProcess : ChildProcess ;
32
- // Only test without using vector db for now
33
- const vectorDb = "none" ;
23
+ for ( const agents of templateAgents ) {
24
+ test . describe ( `Test multiagent template ${ agents } ${ templateFramework } ${ dataSource } ${ templateUI } ${ appType } ${ templatePostInstallAction } ` , async ( ) => {
25
+ test . skip (
26
+ process . platform !== "linux" || process . env . DATASOURCE === "--no-files" ,
27
+ "The multiagent template currently only works with files. We also only run on Linux to speed up tests." ,
28
+ ) ;
29
+ let port : number ;
30
+ let externalPort : number ;
31
+ let cwd : string ;
32
+ let name : string ;
33
+ let appProcess : ChildProcess ;
34
+ // Only test without using vector db for now
35
+ const vectorDb = "none" ;
34
36
35
- test . beforeAll ( async ( ) => {
36
- port = Math . floor ( Math . random ( ) * 10000 ) + 10000 ;
37
- externalPort = port + 1 ;
38
- cwd = await createTestDir ( ) ;
39
- const result = await runCreateLlama ( {
40
- cwd,
41
- templateType : "multiagent" ,
42
- templateFramework,
43
- dataSource,
44
- vectorDb,
45
- port,
46
- externalPort,
47
- postInstallAction : templatePostInstallAction ,
48
- templateUI,
49
- appType,
37
+ test . beforeAll ( async ( ) => {
38
+ port = Math . floor ( Math . random ( ) * 10000 ) + 10000 ;
39
+ externalPort = port + 1 ;
40
+ cwd = await createTestDir ( ) ;
41
+ const result = await runCreateLlama ( {
42
+ cwd,
43
+ templateType : "multiagent" ,
44
+ templateFramework,
45
+ dataSource,
46
+ vectorDb,
47
+ port,
48
+ externalPort,
49
+ postInstallAction : templatePostInstallAction ,
50
+ templateUI,
51
+ appType,
52
+ agents,
53
+ } ) ;
54
+ name = result . projectName ;
55
+ appProcess = result . appProcess ;
50
56
} ) ;
51
- name = result . projectName ;
52
- appProcess = result . appProcess ;
53
- } ) ;
54
57
55
- test ( "App folder should exist" , async ( ) => {
56
- const dirExists = fs . existsSync ( path . join ( cwd , name ) ) ;
57
- expect ( dirExists ) . toBeTruthy ( ) ;
58
- } ) ;
58
+ test ( "App folder should exist" , async ( ) => {
59
+ const dirExists = fs . existsSync ( path . join ( cwd , name ) ) ;
60
+ expect ( dirExists ) . toBeTruthy ( ) ;
61
+ } ) ;
59
62
60
- test ( "Frontend should have a title" , async ( { page } ) => {
61
- await page . goto ( `http://localhost:${ port } ` ) ;
62
- await expect ( page . getByText ( "Built by LlamaIndex" ) ) . toBeVisible ( ) ;
63
- } ) ;
63
+ test ( "Frontend should have a title" , async ( { page } ) => {
64
+ await page . goto ( `http://localhost:${ port } ` ) ;
65
+ await expect ( page . getByText ( "Built by LlamaIndex" ) ) . toBeVisible ( ) ;
66
+ } ) ;
64
67
65
- test ( "Frontend should be able to submit a message and receive the start of a streamed response" , async ( {
66
- page,
67
- } ) => {
68
- await page . goto ( `http://localhost:${ port } ` ) ;
69
- await page . fill ( "form textarea" , userMessage ) ;
68
+ test ( "Frontend should be able to submit a message and receive the start of a streamed response" , async ( {
69
+ page,
70
+ } ) => {
71
+ await page . goto ( `http://localhost:${ port } ` ) ;
72
+ await page . fill ( "form textarea" , userMessage ) ;
70
73
71
- const responsePromise = page . waitForResponse ( ( res ) =>
72
- res . url ( ) . includes ( "/api/chat" ) ,
73
- ) ;
74
+ const responsePromise = page . waitForResponse ( ( res ) =>
75
+ res . url ( ) . includes ( "/api/chat" ) ,
76
+ ) ;
74
77
75
- await page . click ( "form button[type=submit]" ) ;
78
+ await page . click ( "form button[type=submit]" ) ;
76
79
77
- const response = await responsePromise ;
78
- expect ( response . ok ( ) ) . toBeTruthy ( ) ;
79
- } ) ;
80
+ const response = await responsePromise ;
81
+ expect ( response . ok ( ) ) . toBeTruthy ( ) ;
82
+ } ) ;
80
83
81
- // clean processes
82
- test . afterAll ( async ( ) => {
83
- appProcess ?. kill ( ) ;
84
+ // clean processes
85
+ test . afterAll ( async ( ) => {
86
+ appProcess ?. kill ( ) ;
87
+ } ) ;
84
88
} ) ;
85
- } ) ;
89
+ }
0 commit comments