-
Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathketcher-canvas.spec.ts
69 lines (56 loc) · 1.74 KB
/
ketcher-canvas.spec.ts
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* eslint-disable no-magic-numbers */
import { BondTypeName } from '@utils/canvas/selectBond';
import { test } from '@playwright/test';
import {
clickInTheMiddleOfTheScreen,
AtomButton,
selectBond,
dragMouseTo,
drawBenzeneRing,
getCoordinatesOfTheMiddleOfTheScreen,
moveMouseToTheMiddleOfTheScreen,
selectAtomInToolbar,
takeEditorScreenshot,
resetCurrentTool,
clickOnAtom,
BondTool,
selectNestedTool,
waitForPageInit,
} from '@utils';
test.describe('Drawing atom, Benzene ring, Single and Double Bond', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
});
test.afterEach(async ({ page }) => {
await resetCurrentTool(page);
await takeEditorScreenshot(page);
});
test('drawing atom, then dragging other atom', async ({ page }) => {
const xDelta = 100;
await selectAtomInToolbar(AtomButton.Carbon, page);
await clickInTheMiddleOfTheScreen(page);
await selectAtomInToolbar(AtomButton.Nitrogen, page);
await moveMouseToTheMiddleOfTheScreen(page);
const { x, y } = await getCoordinatesOfTheMiddleOfTheScreen(page);
await dragMouseTo(x + xDelta, y, page);
});
test('drawing benzene ring, then adding single bond', async ({ page }) => {
await drawBenzeneRing(page);
await selectBond(BondTypeName.Single, page);
await clickOnAtom(page, 'C', 2);
});
test('single bond tool', async ({ page }) => {
/*
* Test case: EPMLSOPKET-1371
*/
await selectBond(BondTypeName.Single, page);
await clickInTheMiddleOfTheScreen(page);
});
test('double bond tool ', async ({ page }) => {
/*
* Test case: EPMLSOPKET-1380
*/
await selectNestedTool(page, BondTool.DOUBLE);
await clickInTheMiddleOfTheScreen(page);
});
});