-
Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathcml-files.spec.ts
126 lines (109 loc) · 4.27 KB
/
cml-files.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
import { Page, expect, test } from '@playwright/test';
import {
takeEditorScreenshot,
receiveFileComparisonData,
DELAY_IN_SECONDS,
openFileAndAddToCanvas,
saveToFile,
delay,
waitForIndigoToLoad,
} from '@utils';
import { getCml } from '@utils/formats';
async function openFileAddToCanvasTakeScreenshot(page: Page, fileName: string) {
await openFileAndAddToCanvas(fileName, page);
await takeEditorScreenshot(page);
}
test.describe('CML files', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForIndigoToLoad(page);
});
test('Open and Save files - CML - CML for empty canvas', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1944
* Description: Save a clear canvas in CML format with preset parameters:
* The input field contains <?xml version="1.0" ?> <cml> <molecule title="" /> </cml>.
*/
await delay(DELAY_IN_SECONDS.EIGHT);
const { fileExpected: cmlFileExpected, file: cmlFile } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/cml-12492-compare.cml',
});
// comparing cml file with golden cml file
expect(cmlFile).toEqual(cmlFileExpected);
});
test('Open and Save file - CML - CML for structure', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1945
* Description: Saved cml file with structure is compering with paste cml structure golden file
*/
await openFileAddToCanvasTakeScreenshot(page, 'cml-1945.cml');
// check that structure opened from file is displayed correctly
const expectedFile = await getCml(page);
await saveToFile('cml-1945-expected.cml', expectedFile);
const { file: cmlFile, fileExpected: cmlFileExpected } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/cml-1945-expected.cml',
});
// comparing cml file with golden cml file
expect(cmlFile).toEqual(cmlFileExpected);
});
test('Open and Save file - CML - CML for some structures', async ({
page,
}) => {
/**
* Test case: EPMLSOPKET-1946
* Description: Saved cml file with structure is compering with paste cml 3 structures
*/
await openFileAddToCanvasTakeScreenshot(page, 'cml-1946.cml');
// check that structure opened from file is displayed correctly
const expectedFile = await getCml(page);
await saveToFile('cml-1946-expected.cml', expectedFile);
const { file: cmlFile, fileExpected: cmlFileExpected } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/cml-1946-expected.cml',
});
// comparing cml file with golden cml file
expect(cmlFile).toEqual(cmlFileExpected);
});
test('Open and Save file - CML - CML for reaction', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1947
Description: Saved cml file with structure is compering with paste reaction from rxn file
*/
await openFileAddToCanvasTakeScreenshot(page, 'cml-1947-reaction.rxn');
// check that structure opened from file is displayed correctly
const expectedFile = await getCml(page);
await saveToFile('cml-1947-reaction-expected.cml', expectedFile);
const { file: cmlFile, fileExpected: cmlFileExpected } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/cml-1947-reaction-expected.cml',
});
// comparing cml file with golden cml file
expect(cmlFile).toEqual(cmlFileExpected);
});
test.fixme(
'Open and Save file - CML - CML for R-group and other features',
async ({ page }) => {
/**
* Test case: EPMLSOPKET-1948
* Description: Saved cml file with structure is compering with paste R-group from a mol file
*/
await openFileAddToCanvasTakeScreenshot(page, 'cml-1948-R-group.mol');
// check that structure opened from file is displayed correctly
const expectedFile = await getCml(page);
await saveToFile('cml-1948-r-group-expected.cml', expectedFile);
const { file: cmlFile, fileExpected: cmlFileExpected } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/cml-1948-r-group-expected.cml',
});
// comparing cml file with golden cml file
expect(cmlFile).toEqual(cmlFileExpected);
},
);
});