File size: 1,757 Bytes
1cbdba3
 
58bf1b1
1cbdba3
 
 
 
 
 
58bf1b1
1cbdba3
 
0715aa0
58bf1b1
 
 
 
 
1cbdba3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
// Tests some basic operations like box creation, deletion, and dragging.
import { test, expect } from '@playwright/test';
import { Splash, Workspace } from './lynxkite';


let workspace: Workspace;


test.beforeEach(async ({ browser }) => {
  workspace = await Workspace.empty(await browser.newPage(), 'basic_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('basic_spec_test');
});

test('Box creation & deletion per env', async () => {
  const envs = await workspace.getEnvs();
  for(const env of envs) {
    await workspace.setEnv(env);
    const catalog = await workspace.getCatalog();
    expect(catalog).not.toHaveLength(0);
    const op = catalog[0];
    await workspace.addBox(op);
    await expect(workspace.getBox(`${op} 1`)).toBeVisible();
    await workspace.deleteBoxes([`${op} 1`]);
    await expect(workspace.getBox(`${op} 1`)).not.toBeVisible();
  }
});


test('Delete multi-handle boxes', async () => {
  await workspace.addBox('Compute PageRank');
  await workspace.deleteBoxes(['Compute PageRank 1']);
  await expect(workspace.getBox('Compute PageRank 1')).not.toBeVisible();
});


test ('Drag box', async () => {
  await workspace.addBox('Import Parquet');
  const originalPos = await workspace.getBox('Import Parquet 1').boundingBox();
  await workspace.moveBox('Import Parquet 1', {offsetX: 100, offsetY: 100});
  const newPos = await workspace.getBox('Import Parquet 1').boundingBox();
  // Exact position is not guaranteed, but it should have moved
  expect(newPos.x).toBeGreaterThan(originalPos.x);
  expect(newPos.y).toBeGreaterThan(originalPos.y);
});