-
Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathopen-file.spec.ts
162 lines (148 loc) · 4.87 KB
/
open-file.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import { test } from '@playwright/test';
import {
clickInTheMiddleOfTheScreen,
openFile,
pressButton,
takeEditorScreenshot,
openFromFileViaClipboard,
clickOnTheCanvas,
waitForLoad,
openFileAndAddToCanvas,
TopPanelButton,
selectTopPanelButton,
waitForIndigoToLoad,
} from '@utils';
const X_OFFSET = 200;
test.describe('open files with different formats', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForIndigoToLoad(page);
});
test.afterEach(async ({ page }) => {
await takeEditorScreenshot(page);
});
test('opening rxn files', async ({ page }) => {
/*
Test case: EPMLSOPKET-1839
*/
await openFileAndAddToCanvas('Rxn-V2000/1839-ketcher.rxn', page);
});
test('opening smi files', async ({ page }) => {
/*
Test case: EPMLSOPKET-1840
*/
await openFileAndAddToCanvas('SMILES/1840-cyclopentyl.smi', page);
});
test('opening inchi files', async ({ page }) => {
/*
Test case: EPMLSOPKET-1841
*/
await openFileAndAddToCanvas('InChI/1841-ketcher.inchi', page);
});
/* two structures should be added on the canvas in the following test
(same as in EPMLSOPKET-1835), however in this test when second structure is added
the first one disappears. Couldn't reproduct manually.
*/
test('Open file - Input .mol, InChi', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1835
* Description: Two structures are added to canvas - one opened from clipboard, another from file
*/
// add first stucture from clipboard to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFromFileViaClipboard(
'tests/test-data/Txt/1840225-mol-1.txt',
page,
);
await clickInTheMiddleOfTheScreen(page);
// add second structure from file to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFile('glutamine.mol', page);
await waitForLoad(page, () => {
pressButton(page, 'Add to Canvas');
});
await clickOnTheCanvas(page, X_OFFSET, 0);
});
test('Open file - Input .rxn string', async ({ page }) => {
/**
* Test case: EPMLSOPKET-2860
* Description: Two structures are added to canvas - one opened from clipboard, another from file
*/
// add first stucture from clipboard to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFromFileViaClipboard(
'tests/test-data/Txt/1879938-rxn-1[1].txt',
page,
);
// add second structure from file to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFile('Rxn-V2000/rxn-reaction.rxn', page);
await waitForLoad(page, () => {
pressButton(page, 'Add to Canvas');
});
await clickOnTheCanvas(page, 0, -X_OFFSET);
});
test('Open file - Input InChi-string 1/3', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1837
* Description: Open structures from InChi string
*/
// add first stucture from clipboard to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFromFileViaClipboard(
'tests/test-data/Txt/1837-inchi-1.txt',
page,
);
await clickInTheMiddleOfTheScreen(page);
});
test('Open file - Input InChi-string 2/3', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1837
* Description: Open structures from InChi string
*/
// add first stucture from clipboard to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFromFileViaClipboard(
'tests/test-data/Txt/1837-inchi-2.txt',
page,
);
await clickInTheMiddleOfTheScreen(page);
});
test('Open file - Input InChi-string 3/3', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1837
* Description: Open structures from InChi string
*/
// add first structure from clipboard to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFromFileViaClipboard(
'tests/test-data/Txt/1837-inchi-3.txt',
page,
);
await clickInTheMiddleOfTheScreen(page);
});
test('Open file - Open *.mol file 1/2', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1838
* Description: Open structures from mol file
*/
// add first structure from clipboard to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFile('Molfiles-V3000/a-query-notList.mol', page);
await waitForLoad(page, () => {
pressButton(page, 'Open as New Project');
});
});
test('Open file - Open *.mol file 2/2', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1838
* Description: Open structures from mol file
*/
// add first stucture from clipboard to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFile('Molfiles-V3000/dhis-prohibit-atoms.mol', page);
await waitForLoad(page, () => {
pressButton(page, 'Open as New Project');
});
});
});