Skip to content
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

fix: add line break for shebang #12

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
strategy:
fail-fast: true
matrix:
node-version: [18, 20]
node-version: [20]
python-version: ["3.11"]
os: [macos-latest] #, windows-latest]
os: [macos-latest, windows-latest]
defaults:
run:
shell: bash
Expand Down Expand Up @@ -49,11 +49,20 @@ jobs:
- name: Install
run: pnpm run install-local
working-directory: .
- name: Run Playwright tests
- name: Run Playwright tests (macOS)
if: matrix.os == 'macos-latest'
run: pnpm run e2e
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
working-directory: .
shell: bash
- name: Run Playwright tests (Windows)
if: matrix.os == 'windows-latest'
run: pnpm run e2e
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
working-directory: .
shell: powershell
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
136 changes: 71 additions & 65 deletions e2e/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@ import type {
} from "../helpers";
import { createTestDir, runCreateLlama, type AppType } from "./utils";

const templateTypes: TemplateType[] = ["streaming", "simple"];
const templateFrameworks: TemplateFramework[] = [
"nextjs",
"express",
"fastapi",
];
const templateEngines: TemplateEngine[] = ["simple", "context"];
const templateUIs: TemplateUI[] = ["shadcn", "html"];
const templatePostInstallActions: TemplatePostInstallAction[] = [
"none",
"runApp",
];
// const templateTypes: TemplateType[] = ["streaming", "simple"];
// const templateFrameworks: TemplateFramework[] = [
// "nextjs",
// "express",
// "fastapi",
// ];
// const templateEngines: TemplateEngine[] = ["simple", "context"];
// const templateUIs: TemplateUI[] = ["shadcn", "html"];
// const templatePostInstallActions: TemplatePostInstallAction[] = [
// "none",
// "runApp",
// ];

const templateTypes: TemplateType[] = ["streaming"];
const templateFrameworks: TemplateFramework[] = ["nextjs"];
const templateEngines: TemplateEngine[] = ["simple"];
const templateUIs: TemplateUI[] = ["shadcn"];
const templatePostInstallActions: TemplatePostInstallAction[] = ["runApp"];

for (const templateType of templateTypes) {
for (const templateFramework of templateFrameworks) {
Expand Down Expand Up @@ -77,61 +83,61 @@ for (const templateType of templateTypes) {
const dirExists = fs.existsSync(path.join(cwd, name));
expect(dirExists).toBeTruthy();
});
test("Frontend should have a title", async ({ page }) => {
test.skip(templatePostInstallAction !== "runApp");
test.skip(appType === "--no-frontend");
await page.goto(`http://localhost:${port}`);
await expect(page.getByText("Built by LlamaIndex")).toBeVisible();
});
// test("Frontend should have a title", async ({ page }) => {
// test.skip(templatePostInstallAction !== "runApp");
// test.skip(appType === "--no-frontend");
// await page.goto(`http://localhost:${port}`);
// await expect(page.getByText("Built by LlamaIndex")).toBeVisible();
// });

test("Frontend should be able to submit a message and receive a response", async ({
page,
}) => {
test.skip(templatePostInstallAction !== "runApp");
test.skip(appType === "--no-frontend");
await page.goto(`http://localhost:${port}`);
await page.fill("form input", "hello");
const [response] = await Promise.all([
page.waitForResponse(
(res) => {
return (
res.url().includes("/api/chat") && res.status() === 200
);
},
{
timeout: 1000 * 60,
},
),
page.click("form button[type=submit]"),
]);
const text = await response.text();
console.log("AI response when submitting message: ", text);
expect(response.ok()).toBeTruthy();
});
// test("Frontend should be able to submit a message and receive a response", async ({
// page,
// }) => {
// test.skip(templatePostInstallAction !== "runApp");
// test.skip(appType === "--no-frontend");
// await page.goto(`http://localhost:${port}`);
// await page.fill("form input", "hello");
// const [response] = await Promise.all([
// page.waitForResponse(
// (res) => {
// return (
// res.url().includes("/api/chat") && res.status() === 200
// );
// },
// {
// timeout: 1000 * 60,
// },
// ),
// page.click("form button[type=submit]"),
// ]);
// const text = await response.text();
// console.log("AI response when submitting message: ", text);
// expect(response.ok()).toBeTruthy();
// });

test("Backend should response when calling API", async ({
request,
}) => {
test.skip(templatePostInstallAction !== "runApp");
test.skip(appType !== "--no-frontend");
const backendPort = appType === "" ? port : externalPort;
const response = await request.post(
`http://localhost:${backendPort}/api/chat`,
{
data: {
messages: [
{
role: "user",
content: "Hello",
},
],
},
},
);
const text = await response.text();
console.log("AI response when calling API: ", text);
expect(response.ok()).toBeTruthy();
});
// test("Backend should response when calling API", async ({
// request,
// }) => {
// test.skip(templatePostInstallAction !== "runApp");
// test.skip(appType !== "--no-frontend");
// const backendPort = appType === "" ? port : externalPort;
// const response = await request.post(
// `http://localhost:${backendPort}/api/chat`,
// {
// data: {
// messages: [
// {
// role: "user",
// content: "Hello",
// },
// ],
// },
// },
// );
// const text = await response.text();
// console.log("AI response when calling API: ", text);
// expect(response.ok()).toBeTruthy();
// });

// clean processes
test.afterAll(async () => {
Expand Down
1 change: 0 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env node
/* eslint-disable import/no-extraneous-dependencies */
import { execSync } from "child_process";
import Commander from "commander";
Expand Down
Loading