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

Commit 8ff1711

Browse files
torebosrobert-myscript
authored andcommitted
fix tests
1 parent 66f4394 commit 8ff1711

File tree

7 files changed

+133
-7
lines changed

7 files changed

+133
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ clean: ## Remove all produced binaries.
1212
@rm -rf docs
1313

1414
prepare: ## Install all dependencies.
15-
@PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install
15+
@PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install --force
1616

1717
build: clean ## Building the dist files from sources.
1818
@npm run build

test/lib/inks/welcome_en_US.json

Lines changed: 86 additions & 0 deletions
Large diffs are not rendered by default.

test/lib/inksDatas.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const rcEs233 = require('./inks/rc_es_233.json')
1818
const rcFr = require('./inks/rc_fr_simple.json')
1919
const rcIt = require('./inks/rc_it_216.json')
2020
const rcKo = require('./inks/rc_ko_262.json')
21+
const bigText = require('./inks/welcome_en_US.json')
2122

2223
module.exports = {
2324
one: {
@@ -96,7 +97,7 @@ module.exports = {
9697
strokes: threetimes2,
9798
apiVersion: 'V4',
9899
exports: {
99-
LATEX: ['3', '31', '311', '3112']
100+
LATEX: ['3', '31', '311', '311', '3112']
100101
}
101102
},
102103
fence: {
@@ -217,6 +218,15 @@ module.exports = {
217218
TEXT: ['covfefe']
218219
}
219220
},
221+
bigText: {
222+
name: 'bigText',
223+
type: 'TEXT',
224+
strokes: bigText,
225+
apiVersion: 'V4',
226+
exports: {
227+
TEXT: ['Welcome and thanks for using MyScript Studio products family! You are ready to discover an invaluable companion for the effective use of your digital writing. Make the most of your handwritten notes and farms converting handwriting into highly valuable digital information. For more information, visit www.visionobjects.com']
228+
}
229+
},
220230
shape: {
221231
name: 'shape',
222232
type: 'SHAPE',

test/playwright/01-ws-math.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ describe(`${process.env.BROWSER}:v4/websocket_math_iink.html`, function () {
234234
expect(isInit).to.equal(true)
235235

236236
await playStrokes(page, equation3.strokes, 100, 100)
237+
await page.waitForTimeout(100)
237238
await page.evaluate(exported)
238239

239240
let jiix = await editorEl.evaluate(node => node.editor.model.exports['application/vnd.myscript.jiix'])

test/playwright/03-ws-text.spec.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ describe(`${process.env.BROWSER}:v4/websocket_text_iink.html`, () => {
2121

2222
expect(labelsWithNbsp).to.equal(textContent)
2323

24-
await page.click(`#ellipsis${randomString}`)
25-
await page.click(`#convert${randomString}`)
24+
const ellipsis = await page.locator('.ellipsis')
25+
await ellipsis.click()
26+
const moreMenu = await page.locator('.more-menu')
27+
const convert = await moreMenu.locator('button:text("Convert")')
28+
await convert.click()
2629

2730
await page.evaluate(exported)
2831

@@ -54,11 +57,17 @@ describe(`${process.env.BROWSER}:v4/websocket_text_iink.html`, () => {
5457
it('should check gesture works', async () => {
5558
const editorEl = await page.waitForSelector('#editor')
5659
expect(await isEditorInitialized(editorEl)).to.equal(true)
60+
await editorEl.evaluate(node => {
61+
const conf = JSON.parse(JSON.stringify(node.editor.configuration))
62+
conf.recognitionParams.iink.gesture = { enable: true }
63+
node.editor.configuration = conf
64+
})
65+
expect(await isEditorInitialized(editorEl)).to.equal(true)
5766

5867
let exportPromise = page.evaluate(exported)
5968
await playStrokes(page, helloStrike.strokes, 0, 0)
6069
await exportPromise
61-
70+
await page.waitForTimeout(1000)
6271
let result = await editorEl.evaluate(node => node.editor.model.exports['text/plain'])
6372
expect(result).to.equal('')
6473

test/playwright/05-rest-text.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe(`${process.env.BROWSER}:v4/rest_text_iink.html`, () => {
1111

1212
await playStrokes(page, hellov4rest.strokes, 100, 100)
1313
await page.evaluate(exported)
14-
14+
await page.waitForTimeout(1000)
1515
const plainText = await editorEl.evaluate(node => node.editor.model.exports['text/plain'])
1616
expect(plainText).to.equal(hellov4rest.exports.TEXT[hellov4rest.exports.TEXT.length - 1])
1717
})
@@ -23,7 +23,7 @@ describe(`${process.env.BROWSER}:v4/rest_text_iink.html`, () => {
2323

2424
await playStrokes(page, hellov4rest.strokes, 100, 100)
2525
await page.evaluate(exported)
26-
26+
await page.waitForTimeout(1000)
2727
let raw = await editorEl.evaluate(node => node.editor.model.rawStrokes)
2828
expect(raw.length).to.equal(hellov4rest.strokes.length)
2929
const plain = await editorEl.evaluate(node => node.editor.model.exports['text/plain'])
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { expect } = require('chai')
2+
const { exported, isEditorInitialized, playStrokes } = require('./helper')
3+
4+
const { bigText } = require('../lib/inksDatas')
5+
6+
describe(`${process.env.BROWSER}:v4/websocket_text_iink_no_guides.html`, () => {
7+
it('should get the correct number of strokes', async () => {
8+
const editorEl = await page.waitForSelector('#editor')
9+
const isInit = await isEditorInitialized(editorEl)
10+
expect(isInit).to.equal(true)
11+
12+
await playStrokes(page, bigText.strokes, 100, 100)
13+
await page.evaluate(exported)
14+
15+
const nbStrokes = bigText.strokes.length
16+
const modelLocator = await page.locator('(//*[@data-layer="MODEL"])')
17+
const pathModelLocator = await modelLocator.locator('path')
18+
expect(await pathModelLocator.count()).to.equal(nbStrokes)
19+
}).timeout(90000)
20+
})

0 commit comments

Comments
 (0)