Spaces:
Running
Running
Pick file type. Remove waiting from tests.
Browse files
lynxkite-app/web/src/workspace/Workspace.tsx
CHANGED
|
@@ -243,7 +243,7 @@ function LynxKiteFlow() {
|
|
| 243 |
state: { workspace: Workspace },
|
| 244 |
nodes: Node[],
|
| 245 |
) {
|
| 246 |
-
const title = node.data
|
| 247 |
let i = 1;
|
| 248 |
node.id = `${title} ${i}`;
|
| 249 |
const wnodes = state.workspace.nodes!;
|
|
@@ -325,6 +325,15 @@ function LynxKiteFlow() {
|
|
| 325 |
y: e.clientY,
|
| 326 |
});
|
| 327 |
node.data!.params.file_path = file.name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
addNode(node, state, nodes);
|
| 329 |
} catch (error) {
|
| 330 |
setMessage("File upload failed.");
|
|
|
|
| 243 |
state: { workspace: Workspace },
|
| 244 |
nodes: Node[],
|
| 245 |
) {
|
| 246 |
+
const title = node.data?.title;
|
| 247 |
let i = 1;
|
| 248 |
node.id = `${title} ${i}`;
|
| 249 |
const wnodes = state.workspace.nodes!;
|
|
|
|
| 325 |
y: e.clientY,
|
| 326 |
});
|
| 327 |
node.data!.params.file_path = file.name;
|
| 328 |
+
if (file.name.includes(".csv")) {
|
| 329 |
+
node.data!.params.file_format = "csv";
|
| 330 |
+
} else if (file.name.includes(".parquet")) {
|
| 331 |
+
node.data!.params.file_format = "parquet";
|
| 332 |
+
} else if (file.name.includes(".json")) {
|
| 333 |
+
node.data!.params.file_format = "json";
|
| 334 |
+
} else if (file.name.includes(".xls")) {
|
| 335 |
+
node.data!.params.file_format = "excel";
|
| 336 |
+
}
|
| 337 |
addNode(node, state, nodes);
|
| 338 |
} catch (error) {
|
| 339 |
setMessage("File upload failed.");
|
lynxkite-app/web/tests/basic.spec.ts
CHANGED
|
@@ -21,9 +21,6 @@ test("Box creation & deletion per env", async () => {
|
|
| 21 |
const envs = await workspace.getEnvs();
|
| 22 |
for (const env of envs) {
|
| 23 |
await workspace.setEnv(env);
|
| 24 |
-
// TODO: Opening the catalog immediately after setting the env can fail.
|
| 25 |
-
// Let's fix this!
|
| 26 |
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
| 27 |
const catalog = await workspace.getCatalog();
|
| 28 |
expect(catalog).not.toHaveLength(0);
|
| 29 |
const op = catalog[0];
|
|
|
|
| 21 |
const envs = await workspace.getEnvs();
|
| 22 |
for (const env of envs) {
|
| 23 |
await workspace.setEnv(env);
|
|
|
|
|
|
|
|
|
|
| 24 |
const catalog = await workspace.getCatalog();
|
| 25 |
expect(catalog).not.toHaveLength(0);
|
| 26 |
const op = catalog[0];
|
lynxkite-app/web/tests/examples.spec.ts
CHANGED
|
@@ -17,8 +17,7 @@ test("Pytorch example", async ({ page }) => {
|
|
| 17 |
await ws.expectErrorFree();
|
| 18 |
});
|
| 19 |
|
| 20 |
-
test
|
| 21 |
-
// Fails because of missing OPENAI_API_KEY
|
| 22 |
const ws = await Workspace.open(page, "AIMO");
|
| 23 |
await ws.expectErrorFree();
|
| 24 |
});
|
|
@@ -35,12 +34,6 @@ test("Graph RAG", async ({ page }) => {
|
|
| 35 |
await ws.expectErrorFree(process.env.CI ? 2000 : 500);
|
| 36 |
});
|
| 37 |
|
| 38 |
-
test.fail("RAG chatbot app", async ({ page }) => {
|
| 39 |
-
// Fail due to all operation being unknown
|
| 40 |
-
const ws = await Workspace.open(page, "RAG chatbot app");
|
| 41 |
-
await ws.expectErrorFree();
|
| 42 |
-
});
|
| 43 |
-
|
| 44 |
test("Airlines demo", async ({ page }) => {
|
| 45 |
const ws = await Workspace.open(page, "Airlines demo");
|
| 46 |
await ws.expectErrorFree(process.env.CI ? 10000 : 500);
|
|
|
|
| 17 |
await ws.expectErrorFree();
|
| 18 |
});
|
| 19 |
|
| 20 |
+
test("AIMO example", async ({ page }) => {
|
|
|
|
| 21 |
const ws = await Workspace.open(page, "AIMO");
|
| 22 |
await ws.expectErrorFree();
|
| 23 |
});
|
|
|
|
| 34 |
await ws.expectErrorFree(process.env.CI ? 2000 : 500);
|
| 35 |
});
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
test("Airlines demo", async ({ page }) => {
|
| 38 |
const ws = await Workspace.open(page, "Airlines demo");
|
| 39 |
await ws.expectErrorFree(process.env.CI ? 10000 : 500);
|
lynxkite-app/web/tests/lynxkite.ts
CHANGED
|
@@ -59,7 +59,6 @@ export class Workspace {
|
|
| 59 |
// Avoid overlapping with existing nodes
|
| 60 |
const numNodes = allBoxes.length || 1;
|
| 61 |
await this.page.mouse.wheel(0, numNodes * 400);
|
| 62 |
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
| 63 |
}
|
| 64 |
|
| 65 |
await this.page.locator(".ws-name").click();
|
|
@@ -74,9 +73,9 @@ export class Workspace {
|
|
| 74 |
async getCatalog() {
|
| 75 |
await this.page.locator(".ws-name").click();
|
| 76 |
await this.page.keyboard.press("/");
|
| 77 |
-
const
|
| 78 |
-
|
| 79 |
-
|
| 80 |
// Dismiss the catalog menu
|
| 81 |
await this.page.keyboard.press("Escape");
|
| 82 |
await expect(this.page.locator(".node-search")).not.toBeVisible();
|
|
@@ -153,11 +152,6 @@ export class Workspace {
|
|
| 153 |
}
|
| 154 |
|
| 155 |
async expectErrorFree(executionWaitTime?) {
|
| 156 |
-
// TODO: Workaround, to account for workspace execution. Once
|
| 157 |
-
// we have a load indicator we can use that instead.
|
| 158 |
-
await new Promise((resolve) =>
|
| 159 |
-
setTimeout(resolve, executionWaitTime ? executionWaitTime : 500),
|
| 160 |
-
);
|
| 161 |
await expect(this.getBoxes().locator(".error").first()).not.toBeVisible();
|
| 162 |
}
|
| 163 |
|
|
@@ -188,7 +182,7 @@ export class Splash {
|
|
| 188 |
}
|
| 189 |
|
| 190 |
workspace(name: string) {
|
| 191 |
-
return this.page.getByRole("link", { name: name });
|
| 192 |
}
|
| 193 |
|
| 194 |
getEntry(name: string) {
|
|
|
|
| 59 |
// Avoid overlapping with existing nodes
|
| 60 |
const numNodes = allBoxes.length || 1;
|
| 61 |
await this.page.mouse.wheel(0, numNodes * 400);
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
await this.page.locator(".ws-name").click();
|
|
|
|
| 73 |
async getCatalog() {
|
| 74 |
await this.page.locator(".ws-name").click();
|
| 75 |
await this.page.keyboard.press("/");
|
| 76 |
+
const results = this.page.locator(".node-search .matches .search-result");
|
| 77 |
+
await expect(results.first()).toBeVisible();
|
| 78 |
+
const catalog = await results.allInnerTexts();
|
| 79 |
// Dismiss the catalog menu
|
| 80 |
await this.page.keyboard.press("Escape");
|
| 81 |
await expect(this.page.locator(".node-search")).not.toBeVisible();
|
|
|
|
| 152 |
}
|
| 153 |
|
| 154 |
async expectErrorFree(executionWaitTime?) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
await expect(this.getBoxes().locator(".error").first()).not.toBeVisible();
|
| 156 |
}
|
| 157 |
|
|
|
|
| 182 |
}
|
| 183 |
|
| 184 |
workspace(name: string) {
|
| 185 |
+
return this.page.getByRole("link", { name: name, exact: true });
|
| 186 |
}
|
| 187 |
|
| 188 |
getEntry(name: string) {
|