darabos commited on
Commit
ab4322d
·
1 Parent(s): cf9ed45

Update tests.

Browse files
lynxkite-app/tests/test_main.py CHANGED
@@ -22,7 +22,7 @@ def test_detect_plugins_with_plugins():
22
 
23
 
24
  def test_get_catalog():
25
- response = client.get("/api/catalog")
26
  assert response.status_code == 200
27
 
28
 
@@ -59,15 +59,22 @@ def test_save_and_load():
59
  def test_list_dir():
60
  test_dir = pathlib.Path() / str(uuid.uuid4())
61
  test_dir.mkdir(parents=True, exist_ok=True)
62
- test_file = test_dir / "test_file.txt"
63
- test_file.touch()
 
 
 
 
64
  response = client.get(f"/api/dir/list?path={str(test_dir)}")
65
  assert response.status_code == 200
66
- assert len(response.json()) == 1
67
- assert response.json()[0]["name"] == f"{test_dir}/test_file.txt"
68
- assert response.json()[0]["type"] == "workspace"
69
- test_file.unlink()
70
- test_dir.rmdir()
 
 
 
71
 
72
 
73
  def test_make_dir():
 
22
 
23
 
24
  def test_get_catalog():
25
+ response = client.get("/api/catalog?workspace=test")
26
  assert response.status_code == 200
27
 
28
 
 
59
  def test_list_dir():
60
  test_dir = pathlib.Path() / str(uuid.uuid4())
61
  test_dir.mkdir(parents=True, exist_ok=True)
62
+ dir = test_dir / "test_dir"
63
+ dir.mkdir(exist_ok=True)
64
+ file = test_dir / "test_file.txt"
65
+ file.touch()
66
+ ws = test_dir / "test_workspace.lynxkite.json"
67
+ ws.touch()
68
  response = client.get(f"/api/dir/list?path={str(test_dir)}")
69
  assert response.status_code == 200
70
+ assert response.json() == [
71
+ {"name": f"{test_dir}/test_dir", "type": "directory"},
72
+ {"name": f"{test_dir}/test_file.txt", "type": "file"},
73
+ {"name": f"{test_dir}/test_workspace.lynxkite.json", "type": "workspace"},
74
+ ]
75
+ file.unlink()
76
+ ws.unlink()
77
+ dir.rmdir()
78
 
79
 
80
  def test_make_dir():
lynxkite-app/web/playwright.config.ts CHANGED
@@ -7,6 +7,7 @@ export default defineConfig({
7
  /* Fail the build on CI if you accidentally left test.only in the source code. */
8
  forbidOnly: !!process.env.CI,
9
  retries: process.env.CI ? 1 : 0,
 
10
  workers: 1,
11
  reporter: process.env.CI ? [["github"], ["html"]] : "html",
12
  use: {
 
7
  /* Fail the build on CI if you accidentally left test.only in the source code. */
8
  forbidOnly: !!process.env.CI,
9
  retries: process.env.CI ? 1 : 0,
10
+ maxFailures: 5,
11
  workers: 1,
12
  reporter: process.env.CI ? [["github"], ["html"]] : "html",
13
  use: {
lynxkite-app/web/tests/directory.spec.ts CHANGED
@@ -14,13 +14,6 @@ test.describe("Directory operations", () => {
14
  splash = await Splash.open(page);
15
  });
16
 
17
- test("Create workspace with default name", async () => {
18
- const workspace = await Workspace.empty(splash.page);
19
- // Not checking for exact match, since there may be pre-existing "Untitled" workspaces
20
- expect(workspace.name).toContain("Untitled");
21
- await workspace.close();
22
- });
23
-
24
  test("Create & delete workspace", async () => {
25
  const workspaceName = `TestWorkspace-${Date.now()}`;
26
  const workspace = await Workspace.empty(splash.page, workspaceName);
@@ -40,11 +33,6 @@ test.describe("Directory operations", () => {
40
  await splash.deleteEntry(folderName);
41
  await expect(splash.getEntry(folderName)).not.toBeVisible();
42
  });
43
-
44
- test("Create folder with default name", async () => {
45
- await splash.createFolder();
46
- await expect(splash.currentFolder()).toContainText("Untitled");
47
- });
48
  });
49
 
50
  test.describe
 
14
  splash = await Splash.open(page);
15
  });
16
 
 
 
 
 
 
 
 
17
  test("Create & delete workspace", async () => {
18
  const workspaceName = `TestWorkspace-${Date.now()}`;
19
  const workspace = await Workspace.empty(splash.page, workspaceName);
 
33
  await splash.deleteEntry(folderName);
34
  await expect(splash.getEntry(folderName)).not.toBeVisible();
35
  });
 
 
 
 
 
36
  });
37
 
38
  test.describe
lynxkite-app/web/tests/lynxkite.ts CHANGED
@@ -18,7 +18,7 @@ export class Workspace {
18
  }
19
 
20
  // Starts with a brand new workspace.
21
- static async empty(page: Page, workspaceName?: string): Promise<Workspace> {
22
  const splash = await Splash.open(page);
23
  return await splash.createWorkspace(workspaceName);
24
  }
@@ -182,18 +182,12 @@ export class Splash {
182
  return this.page.locator(".entry").filter({ hasText: name }).first();
183
  }
184
 
185
- async createWorkspace(name?: string) {
186
  await this.page.getByRole("button", { name: "New workspace" }).click();
187
- await this.page.locator('input[name="workspaceName"]').click();
188
- let workspaceName: string;
189
- if (name) {
190
- workspaceName = name;
191
- await this.page.locator('input[name="workspaceName"]').fill(name);
192
- } else {
193
- workspaceName = await this.page.locator('input[name="workspaceName"]').inputValue();
194
- }
195
- await this.page.locator('input[name="workspaceName"]').press("Enter");
196
- const ws = new Workspace(this.page, workspaceName);
197
  await ws.setEnv("LynxKite Graph Analytics");
198
  return ws;
199
  }
@@ -203,13 +197,11 @@ export class Splash {
203
  return new Workspace(this.page, name);
204
  }
205
 
206
- async createFolder(folderName?: string) {
207
  await this.page.getByRole("button", { name: "New folder" }).click();
208
- await this.page.locator('input[name="folderName"]').click();
209
- if (folderName) {
210
- await this.page.locator('input[name="folderName"]').fill(folderName);
211
- }
212
- await this.page.locator('input[name="folderName"]').press("Enter");
213
  }
214
 
215
  async deleteEntry(entryName: string) {
 
18
  }
19
 
20
  // Starts with a brand new workspace.
21
+ static async empty(page: Page, workspaceName: string): Promise<Workspace> {
22
  const splash = await Splash.open(page);
23
  return await splash.createWorkspace(workspaceName);
24
  }
 
182
  return this.page.locator(".entry").filter({ hasText: name }).first();
183
  }
184
 
185
+ async createWorkspace(name: string) {
186
  await this.page.getByRole("button", { name: "New workspace" }).click();
187
+ const nameBox = this.page.locator('input[name="entryName"]');
188
+ await nameBox.fill(name);
189
+ await nameBox.press("Enter");
190
+ const ws = new Workspace(this.page, name);
 
 
 
 
 
 
191
  await ws.setEnv("LynxKite Graph Analytics");
192
  return ws;
193
  }
 
197
  return new Workspace(this.page, name);
198
  }
199
 
200
+ async createFolder(folderName: string) {
201
  await this.page.getByRole("button", { name: "New folder" }).click();
202
+ const nameBox = this.page.locator('input[name="entryName"]');
203
+ await nameBox.fill(folderName);
204
+ await nameBox.press("Enter");
 
 
205
  }
206
 
207
  async deleteEntry(entryName: string) {
lynxkite-app/web/vite.config.ts CHANGED
@@ -5,7 +5,7 @@ import { defineConfig } from "vite";
5
  // https://vite.dev/config/
6
  export default defineConfig({
7
  build: {
8
- chunkSizeWarningLimit: 2048,
9
  },
10
  esbuild: {
11
  supported: {
 
5
  // https://vite.dev/config/
6
  export default defineConfig({
7
  build: {
8
+ chunkSizeWarningLimit: 3000,
9
  },
10
  esbuild: {
11
  supported: {