File size: 1,663 Bytes
18d76df
d460634
 
18d76df
 
 
 
d460634
dc0212e
 
d460634
dc0212e
 
d460634
 
 
 
18d76df
 
d460634
18d76df
 
8c735a6
 
 
19a6371
d460634
18d76df
 
d460634
18d76df
 
8c735a6
19a6371
 
d1bbedf
8c735a6
d3c7f4d
d460634
 
18d76df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Tests error reporting.
import { expect, test } from "@playwright/test";
import { Splash, Workspace } from "./lynxkite";

let workspace: Workspace;

test.beforeEach(async ({ browser }) => {
  workspace = await Workspace.empty(await browser.newPage(), "error_spec_test");
});

test.afterEach(async () => {
  await workspace.close();
  const splash = await new Splash(workspace.page);
  splash.page.on("dialog", async (dialog) => {
    await dialog.accept();
  });
  await splash.deleteEntry("error_spec_test");
});

test("missing parameter", async () => {
  // Test the correct error message is displayed when a required parameter is missing,
  // and that the error message is removed when the parameter is filled.
  await workspace.addBox("NX › Scale-Free Graph");
  const graphBox = workspace.getBox("NX › Scale-Free Graph 1");
  await expect(graphBox.locator(".error")).toHaveText("n is unset.");
  await graphBox.getByLabel("n", { exact: true }).fill("10");
  await expect(graphBox.locator(".error")).not.toBeVisible();
});

test("unknown operation", async () => {
  // Test that the correct error is displayed when the operation does not belong to
  // the current environment.
  await workspace.addBox("NX › Scale-Free Graph");
  const graphBox = workspace.getBox("NX › Scale-Free Graph 1");
  await graphBox.getByLabel("n", { exact: true }).fill("10");
  await workspace.setEnv("Pillow");
  const csvBox = workspace.getBox("NX › Scale-Free Graph 1");
  await expect(csvBox.locator(".error")).toHaveText("Unknown operation.");
  await workspace.setEnv("LynxKite Graph Analytics");
  await expect(csvBox.locator(".error")).not.toBeVisible();
});