Skip to content
This repository was archived by the owner on Jan 4, 2021. It is now read-only.

Commit 6a816c4

Browse files
committed
reworked import test
1 parent 2651e76 commit 6a816c4

File tree

6 files changed

+85
-89
lines changed

6 files changed

+85
-89
lines changed

examples/v4/websocket_math_iink_alwaysConnected.html renamed to examples/v4/websocket_math_iink_notAlwaysConnected.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
hmacKey: '54b2ca8a-6752-469d-87dd-553bb450e9ad'
121121
},
122122
v4: {
123-
alwaysConnected: true,
123+
alwaysConnected: false,
124124
math: {
125125
mimeTypes: ['application/x-latex']
126126
}

test/lib/configuration.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ const configurations = [{
243243
protocol: 'WEBSOCKET',
244244
apiVersion: 'V4',
245245
examples: ['/examples/v4/websocket_math_iink.html'],
246+
}, {
247+
type: 'MATH',
248+
protocol: 'WEBSOCKET',
249+
apiVersion: 'V4',
250+
alternate: 'Import',
251+
examples: ['/examples/v4/import_math_jiix.html'],
246252
}, {
247253
type: 'MATH',
248254
protocol: 'WEBSOCKET',

test/lib/inks/one.json

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -60,63 +60,63 @@
6060
443
6161
],
6262
[
63-
334,
64-
330,
65-
326,
66-
321,
67-
315,
68-
310,
69-
306,
70-
303,
71-
298,
72-
293,
73-
290,
74-
286,
75-
282,
76-
280,
77-
273,
78-
269,
79-
266,
80-
263,
81-
260,
82-
263,
83-
268,
84-
272,
85-
276,
86-
280,
87-
283,
88-
286,
89-
291,
90-
294,
91-
298,
92-
303,
93-
307,
94-
311,
95-
317,
96-
320,
97-
324,
98-
327,
99-
331,
100-
334,
101-
338,
102-
342,
103-
347,
104-
351,
105-
354,
106-
358,
107-
363,
108-
368,
109-
372,
110-
375,
111-
379,
112-
382,
113-
385,
114-
388,
115-
391,
116-
395,
117-
399,
118-
402,
119-
405
63+
134,
64+
130,
65+
126,
66+
121,
67+
115,
68+
110,
69+
106,
70+
103,
71+
98,
72+
93,
73+
90,
74+
86,
75+
82,
76+
80,
77+
73,
78+
69,
79+
66,
80+
63,
81+
60,
82+
63,
83+
68,
84+
72,
85+
76,
86+
80,
87+
83,
88+
86,
89+
91,
90+
94,
91+
98,
92+
103,
93+
107,
94+
111,
95+
117,
96+
120,
97+
124,
98+
127,
99+
131,
100+
134,
101+
138,
102+
142,
103+
147,
104+
151,
105+
154,
106+
158,
107+
163,
108+
168,
109+
172,
110+
175,
111+
179,
112+
182,
113+
185,
114+
188,
115+
191,
116+
195,
117+
199,
118+
202,
119+
205
120120
]
121121
]
122122
]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
exports.command = function getJiixExports(callback) {
1+
exports.command = function getJiixExports(component, callback) {
22
const self = this;
33

4-
function getElementProperty() {
4+
function getElementProperty(comp) {
55
// eslint-disable-next-line no-undef
6-
return document.querySelector("#editor").editor.model.exports['application/vnd.myscript.jiix'];
6+
return document.querySelector(comp).editor.model.exports['application/vnd.myscript.jiix'];
77
}
88

99
function getElementPropertyCallback(res) {
@@ -12,6 +12,6 @@ exports.command = function getJiixExports(callback) {
1212
}
1313
}
1414

15-
this.execute(getElementProperty, [], getElementPropertyCallback);
15+
this.execute(getElementProperty, [component], getElementPropertyCallback);
1616
return this;
1717
};

test/nightwatch/lib/inkPlayer.js

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function checkTextNonText(browser, resultSelector) {
1919
if (resultSelector && resultSelector.length > 0) {
2020
browser.waitForElementPresent(resultSelector, 6000 * globalconfig.timeoutAmplificator);
2121
}
22-
browser.getJiixExports(function (res) {
23-
console.log('export res: ' + JSON.stringify(res.value));
22+
browser.getJiixExports('#editor', function (res) {
23+
//console.log('export res: ' + JSON.stringify(res.value));
2424
const parsedjiix = JSON.parse(JSON.stringify(res.value));
2525

2626
browser.verify.equal(parsedjiix.type, "Raw Content");
@@ -55,7 +55,7 @@ function getStrokesFromJIIX(jiix) {
5555
function checkNbStrokes(browser, config, resultSelector, property, nbStrokesExpected) {
5656
const isWebSocketV4 = (config.apiVersion === 'V4' && config.protocol !== 'REST');
5757
if(isWebSocketV4) {
58-
browser.getJiixExports(function (res) {
58+
browser.getJiixExports('#editor', function (res) {
5959
//console.log('export= ' + JSON.stringify(res.value));
6060
browser.verify.equal(getStrokesFromJIIX(res.value).length, String(nbStrokesExpected));
6161
})
@@ -285,13 +285,13 @@ function checkDecoration(browser, config, inkName, strokes, labels, component =
285285

286286
browser.pause(1000);
287287

288-
browser.getJiixExports(function (res) {
289-
console.log('export= ' + JSON.stringify(res.value));
288+
browser.getJiixExports(component, function (res) {
289+
//console.log('export= ' + JSON.stringify(res.value));
290290
var spansList = common.findValuesByKey(res.value, 'spans');
291291
browser.verify.equal(spansList.length, 2);
292-
console.log("span0 string= " + JSON.stringify(spansList[0]));
292+
//console.log("span0 string= " + JSON.stringify(spansList[0]));
293293
var span0 = JSON.parse(JSON.stringify(spansList[0]));
294-
console.log("span0= "+ JSON.stringify(span0));
294+
//console.log("span0= "+ JSON.stringify(span0));
295295
browser.verify.equal(span0["first-char"], "0");
296296
browser.verify.equal(span0["last-char"], "4");
297297
browser.verify.equal(span0.class, "text");
@@ -477,7 +477,6 @@ function checkRecognitionAssetBuilder(browser, config, strokes, labels, componen
477477

478478
function checkImport(browser, config, strokes, labels, component = '#editor', resultSelector = '#editorSupervisor', emptyResultSelector = '#editorSupervisor') {
479479
console.log('url ' + browser.launchUrl + config.componentPath);
480-
console.log('nb strokes ' + strokes.length);
481480
let jiixExport = '';
482481
browser
483482
.init(browser.launchUrl + config.componentPath).maximizeWindow()
@@ -493,24 +492,15 @@ function checkImport(browser, config, strokes, labels, component = '#editor', re
493492

494493
checkLabel(browser, labels, strokes.length - 1, resultSelector, emptyResultSelector);
495494

496-
browser.getJiixExports(function (res) {
495+
browser.getJiixExports(component, function (res) {
497496
browser
498-
.click('#clear')
499-
.waitForIdle('#editorSupervisor', 3000 * globalconfig.timeoutAmplificator);
500-
501-
checkLabel(browser, labels, -1, resultSelector, emptyResultSelector);
502-
503-
browser
504-
.waitForElementPresent('#importContentField', 1000 * globalconfig.timeoutAmplificator)
505-
.waitForElementPresent('#importContent', 1000 * globalconfig.timeoutAmplificator)
506-
.setProperty('#importContentField', 'value', JSON.stringify(res.value))
507-
.click("#importContent")
497+
.click('#import')
508498
.waitForIdle('#editorSupervisor', 3000 * globalconfig.timeoutAmplificator)
509-
.waitUntilElementPropertyEqual('#editorSupervisor', 'state', 'EXPORTED', 2000 * globalconfig.timeoutAmplificator);
510-
511-
checkLabel(browser, labels, strokes.length - 1, resultSelector, emptyResultSelector);
499+
.getJiixExports('#editor2', function (res2) {
500+
jiixExport = JSON.parse(res2.value);
501+
browser.verify.equal(labels[strokes.length - 1], jiixExport["expressions"][0]["label"]);
502+
});
512503
});
513-
514504
browser.end();
515505
}
516506

test/nightwatch/partial/03-iink/01-math-iink-ws-cdkv4.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const inkPlayer = require('../../lib/inkPlayer');
22
const config = require('../../../lib/configuration').getConfiguration('MATH', 'WEBSOCKET', 'V4');
3-
// const configImport = require('../../../lib/configuration').getConfiguration('MATH', 'WEBSOCKET', 'V4', '', 'import');
3+
const configImport = require('../../../lib/configuration').getConfiguration('MATH', 'WEBSOCKET', 'V4', '', 'Import');
44

55
function runLabelTests(ink) {
66
module.exports[config.header + ' checkConvert ' + ink.name] = function checkConvert(browser) {
@@ -36,6 +36,6 @@ config.inks
3636
.forEach(ink => runUndoTests(ink));
3737

3838

39-
// configImport.inks
40-
// .filter(ink => ['equation2', 'equation3'].includes(ink.name))
41-
// .forEach(ink => runImportTests(ink));
39+
configImport.inks
40+
.filter(ink => ['one'].includes(ink.name))
41+
.forEach(ink => runImportTests(ink));

0 commit comments

Comments
 (0)