-
Notifications
You must be signed in to change notification settings - Fork 183
reorganize e2e tests (split Python and TS) #329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fe489db
speed up test
marcusschiesser 2a43ebd
split e2e tests in python and ts
marcusschiesser fb91ddd
readd framework to python deps
marcusschiesser 44315fd
fix ts typing
leehuwuj d1b2811
enhance e2e pipeline
leehuwuj 0778b39
Update templates/types/streaming/express/src/controllers/chat-upload.…
marcusschiesser ee36dcf
fix lint
marcusschiesser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { expect, test } from "@playwright/test"; | ||
import { exec } from "child_process"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import util from "util"; | ||
import { TemplateFramework, TemplateVectorDB } from "../../helpers/types"; | ||
import { createTestDir, runCreateLlama } from "../utils"; | ||
|
||
const execAsync = util.promisify(exec); | ||
|
||
const templateFramework: TemplateFramework = process.env.FRAMEWORK | ||
? (process.env.FRAMEWORK as TemplateFramework) | ||
: "nextjs"; | ||
const dataSource: string = process.env.DATASOURCE | ||
? process.env.DATASOURCE | ||
: "--example-file"; | ||
|
||
// vectorDBs combinations to test | ||
const vectorDbs: TemplateVectorDB[] = [ | ||
"mongo", | ||
"pg", | ||
"qdrant", | ||
"pinecone", | ||
"milvus", | ||
"astra", | ||
"chroma", | ||
"llamacloud", | ||
"weaviate", | ||
]; | ||
|
||
test.describe("Test resolve TS dependencies", () => { | ||
// Test vector DBs without LlamaParse | ||
for (const vectorDb of vectorDbs) { | ||
const optionDescription = `vectorDb: ${vectorDb}, dataSource: ${dataSource}`; | ||
|
||
test(`Vector DB test - ${optionDescription}`, async () => { | ||
await runTest(vectorDb, false); | ||
}); | ||
} | ||
|
||
// Test LlamaParse with vectorDB 'none' | ||
test(`LlamaParse test - vectorDb: none, dataSource: ${dataSource}, llamaParse: true`, async () => { | ||
await runTest("none", true); | ||
}); | ||
|
||
async function runTest( | ||
vectorDb: TemplateVectorDB | "none", | ||
useLlamaParse: boolean, | ||
) { | ||
const cwd = await createTestDir(); | ||
|
||
const result = await runCreateLlama({ | ||
cwd: cwd, | ||
templateType: "streaming", | ||
templateFramework: templateFramework, | ||
dataSource: dataSource, | ||
vectorDb: vectorDb, | ||
port: 3000, | ||
externalPort: 8000, | ||
postInstallAction: "none", | ||
templateUI: undefined, | ||
appType: templateFramework === "nextjs" ? "" : "--no-frontend", | ||
llamaCloudProjectName: undefined, | ||
llamaCloudIndexName: undefined, | ||
tools: undefined, | ||
useLlamaParse: useLlamaParse, | ||
}); | ||
const name = result.projectName; | ||
|
||
// Check if the app folder exists | ||
const appDir = path.join(cwd, name); | ||
const dirExists = fs.existsSync(appDir); | ||
expect(dirExists).toBeTruthy(); | ||
|
||
// Install dependencies using pnpm | ||
try { | ||
const { stderr: installStderr } = await execAsync( | ||
"pnpm install --prefer-offline", | ||
{ | ||
cwd: appDir, | ||
}, | ||
); | ||
} catch (error) { | ||
console.error("Error installing dependencies:", error); | ||
throw error; | ||
} | ||
|
||
// Run tsc type check and capture the output | ||
try { | ||
const { stdout, stderr } = await execAsync( | ||
"pnpm exec tsc -b --diagnostics", | ||
{ | ||
cwd: appDir, | ||
}, | ||
); | ||
// Check if there's any error output | ||
expect(stderr).toBeFalsy(); | ||
|
||
leehuwuj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Log the stdout for debugging purposes | ||
console.log("TypeScript type-check output:", stdout); | ||
} catch (error) { | ||
console.error("Error running tsc:", error); | ||
throw error; | ||
} | ||
} | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.