@wdio/ocr-service 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +160 -150
- package/dist/commands/ocrClickOnText.js +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,178 +1,188 @@
|
|
|
1
1
|
# @wdio/ocr-service
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f5f8041: fix click duration for 0ms
|
|
8
|
+
|
|
9
|
+
### Committers: 1
|
|
10
|
+
|
|
11
|
+
- Fabien CELLIER ([@lacell75](https://github.com/lacell75))
|
|
12
|
+
|
|
3
13
|
## 2.0.0
|
|
4
14
|
|
|
5
15
|
### Major Changes
|
|
6
16
|
|
|
7
|
-
-
|
|
17
|
+
- 9fdb2d2: feat: work with V9
|
|
8
18
|
|
|
9
19
|
## 1.0.5
|
|
10
20
|
|
|
11
21
|
### Patch Changes
|
|
12
22
|
|
|
13
|
-
-
|
|
23
|
+
- 85a1d82: # 🐛 Bug Fixes
|
|
14
24
|
|
|
15
|
-
|
|
25
|
+
Fix issues:
|
|
16
26
|
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
- [438](https://github.com/webdriverio/visual-testing/issues/438): resizeDimensions not working
|
|
28
|
+
- [448](https://github.com/webdriverio/visual-testing/issues/448): hideElements and removeElements` don't work for native apps
|
|
19
29
|
|
|
20
|
-
|
|
30
|
+
# 💅 Polish
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
- update dependencies
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
# Committers: 1
|
|
25
35
|
|
|
26
|
-
|
|
36
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
27
37
|
|
|
28
38
|
## 1.0.4
|
|
29
39
|
|
|
30
40
|
### Patch Changes
|
|
31
41
|
|
|
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
|
-
"commandName": "checkScreen",
|
|
57
|
-
"boundingBoxes": {
|
|
58
|
-
"diffBoundingBoxes": [
|
|
59
|
-
{
|
|
60
|
-
"left": 1088,
|
|
61
|
-
"top": 717,
|
|
62
|
-
"right": 1186,
|
|
63
|
-
"bottom": 730
|
|
64
|
-
}
|
|
65
|
-
//....
|
|
66
|
-
],
|
|
67
|
-
"ignoredBoxes": [
|
|
68
|
-
{
|
|
69
|
-
"left": 159,
|
|
70
|
-
"top": 652,
|
|
71
|
-
"right": 356,
|
|
72
|
-
"bottom": 703
|
|
73
|
-
}
|
|
74
|
-
//...
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
|
-
"fileData": {
|
|
78
|
-
"actualFilePath": "/Users/wswebcreation/Git/wdio/visual-testing/.tmp/actual/desktop_chrome-headless-shellexamplePageFail-local-chrome-latest-1366x768.png",
|
|
79
|
-
"baselineFilePath": "/Users/wswebcreation/Git/wdio/visual-testing/localBaseline/desktop_chrome-headless-shellexamplePageFail-local-chrome-latest-1366x768.png",
|
|
80
|
-
"diffFilePath": "/Users/wswebcreation/Git/wdio/visual-testing/.tmp/diff/desktop_chrome-headless-shell/examplePageFail-local-chrome-latest-1366x768png",
|
|
81
|
-
"fileName": "examplePageFail-local-chrome-latest-1366x768.png",
|
|
82
|
-
"size": {
|
|
83
|
-
"actual": {
|
|
84
|
-
"height": 768,
|
|
85
|
-
"width": 1366
|
|
42
|
+
- 0b01b64: ### @wdio/visual-service
|
|
43
|
+
|
|
44
|
+
#### 🚀 New Features
|
|
45
|
+
|
|
46
|
+
**Added Reporting output**
|
|
47
|
+
You now have the option to export the compare results into a JSON report file. By enabling the module option `createJsonReportFiles: true`, each image that is compared will create a report stored in the `actual` folder, next to each `actual` image result.
|
|
48
|
+
|
|
49
|
+
The output will look like this:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"parent": "check methods",
|
|
54
|
+
"test": "should fail comparing with a baseline",
|
|
55
|
+
"tag": "examplePageFail",
|
|
56
|
+
"instanceData": {
|
|
57
|
+
"browser": {
|
|
58
|
+
"name": "chrome-headless-shell",
|
|
59
|
+
"version": "126.0.6478.183"
|
|
60
|
+
},
|
|
61
|
+
"platform": {
|
|
62
|
+
"name": "mac",
|
|
63
|
+
"version": "not-known"
|
|
64
|
+
}
|
|
86
65
|
},
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
66
|
+
"commandName": "checkScreen",
|
|
67
|
+
"boundingBoxes": {
|
|
68
|
+
"diffBoundingBoxes": [
|
|
69
|
+
{
|
|
70
|
+
"left": 1088,
|
|
71
|
+
"top": 717,
|
|
72
|
+
"right": 1186,
|
|
73
|
+
"bottom": 730
|
|
74
|
+
}
|
|
75
|
+
//....
|
|
76
|
+
],
|
|
77
|
+
"ignoredBoxes": [
|
|
78
|
+
{
|
|
79
|
+
"left": 159,
|
|
80
|
+
"top": 652,
|
|
81
|
+
"right": 356,
|
|
82
|
+
"bottom": 703
|
|
83
|
+
}
|
|
84
|
+
//...
|
|
85
|
+
]
|
|
90
86
|
},
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
"fileData": {
|
|
88
|
+
"actualFilePath": "/Users/wswebcreation/Git/wdio/visual-testing/.tmp/actual/desktop_chrome-headless-shellexamplePageFail-local-chrome-latest-1366x768.png",
|
|
89
|
+
"baselineFilePath": "/Users/wswebcreation/Git/wdio/visual-testing/localBaseline/desktop_chrome-headless-shellexamplePageFail-local-chrome-latest-1366x768.png",
|
|
90
|
+
"diffFilePath": "/Users/wswebcreation/Git/wdio/visual-testing/.tmp/diff/desktop_chrome-headless-shell/examplePageFail-local-chrome-latest-1366x768png",
|
|
91
|
+
"fileName": "examplePageFail-local-chrome-latest-1366x768.png",
|
|
92
|
+
"size": {
|
|
93
|
+
"actual": {
|
|
94
|
+
"height": 768,
|
|
95
|
+
"width": 1366
|
|
96
|
+
},
|
|
97
|
+
"baseline": {
|
|
98
|
+
"height": 768,
|
|
99
|
+
"width": 1366
|
|
100
|
+
},
|
|
101
|
+
"diff": {
|
|
102
|
+
"height": 768,
|
|
103
|
+
"width": 1366
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"misMatchPercentage": "12.90",
|
|
108
|
+
"rawMisMatchPercentage": 12.900729014153246
|
|
109
|
+
}
|
|
110
|
+
```
|
|
101
111
|
|
|
102
|
-
|
|
112
|
+
When all tests are executed, a new JSON file with the collection of the comparisons will be generated and can be found in the root of your actual folder. The data is grouped by:
|
|
103
113
|
|
|
104
|
-
|
|
105
|
-
|
|
114
|
+
- `describe` for Jasmine/Mocha or `Feature` for CucumberJS
|
|
115
|
+
- `it` for Jasmine/Mocha or `Scenario` for CucumberJS
|
|
106
116
|
|
|
107
|
-
|
|
117
|
+
and then sorted by:
|
|
108
118
|
|
|
109
|
-
|
|
110
|
-
|
|
119
|
+
- `commandName`, which are the compare method names used to compare the images
|
|
120
|
+
- `instanceData`, browser first, then device, then platform
|
|
111
121
|
|
|
112
|
-
|
|
122
|
+
it will look like this
|
|
113
123
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
"description": "check methods",
|
|
118
|
-
"data": [
|
|
124
|
+
```json
|
|
125
|
+
[
|
|
119
126
|
{
|
|
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
|
-
|
|
127
|
+
"description": "check methods",
|
|
128
|
+
"data": [
|
|
129
|
+
{
|
|
130
|
+
"test": "should fail comparing with a baseline",
|
|
131
|
+
"data": [
|
|
132
|
+
{
|
|
133
|
+
"tag": "examplePageFail",
|
|
134
|
+
"instanceData": {},
|
|
135
|
+
"commandName": "checkScreen",
|
|
136
|
+
"framework": "mocha",
|
|
137
|
+
"boundingBoxes": {
|
|
138
|
+
"diffBoundingBoxes": [],
|
|
139
|
+
"ignoredBoxes": []
|
|
140
|
+
},
|
|
141
|
+
"fileData": {},
|
|
142
|
+
"misMatchPercentage": "14.34",
|
|
143
|
+
"rawMisMatchPercentage": 14.335403703025868
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"tag": "exampleElementFail",
|
|
147
|
+
"instanceData": {},
|
|
148
|
+
"commandName": "checkElement",
|
|
149
|
+
"framework": "mocha",
|
|
150
|
+
"boundingBoxes": {
|
|
151
|
+
"diffBoundingBoxes": [],
|
|
152
|
+
"ignoredBoxes": []
|
|
153
|
+
},
|
|
154
|
+
"fileData": {},
|
|
155
|
+
"misMatchPercentage": "1.34",
|
|
156
|
+
"rawMisMatchPercentage": 1.335403703025868
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
]
|
|
149
161
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
]
|
|
153
|
-
```
|
|
162
|
+
]
|
|
163
|
+
```
|
|
154
164
|
|
|
155
|
-
|
|
165
|
+
The report data will give you the opportunity to build your own visual report without doing all the magic and data collection yourself.
|
|
156
166
|
|
|
157
|
-
|
|
167
|
+
### webdriver-image-comparison
|
|
158
168
|
|
|
159
|
-
|
|
169
|
+
#### 🚀 New Features
|
|
160
170
|
|
|
161
|
-
|
|
171
|
+
- Add support to generate single JSON report files
|
|
162
172
|
|
|
163
|
-
|
|
173
|
+
### @wdio/ocr-service
|
|
164
174
|
|
|
165
|
-
|
|
175
|
+
#### 💅 Polish
|
|
166
176
|
|
|
167
|
-
|
|
177
|
+
- Refactored the CLI to use `@inquirer/prompts` instead of `inquirer`
|
|
168
178
|
|
|
169
|
-
|
|
179
|
+
### Committers: 1
|
|
170
180
|
|
|
171
|
-
|
|
181
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
172
182
|
|
|
173
|
-
|
|
183
|
+
```
|
|
174
184
|
|
|
175
|
-
|
|
185
|
+
```
|
|
176
186
|
|
|
177
187
|
## 1.0.3
|
|
178
188
|
|
|
@@ -184,44 +194,44 @@ Update deps
|
|
|
184
194
|
|
|
185
195
|
# Committers: 1
|
|
186
196
|
|
|
187
|
-
-
|
|
197
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
188
198
|
|
|
189
199
|
## 1.0.2
|
|
190
200
|
|
|
191
201
|
### Patch Changes
|
|
192
202
|
|
|
193
|
-
-
|
|
203
|
+
- 6e1e478: Fix contrast and languages
|
|
194
204
|
|
|
195
205
|
## 1.0.1
|
|
196
206
|
|
|
197
207
|
### Patch Changes
|
|
198
208
|
|
|
199
|
-
-
|
|
209
|
+
- 083ad82: Fixed OCR cli
|
|
200
210
|
|
|
201
211
|
## 1.0.0
|
|
202
212
|
|
|
203
213
|
### Major Changes
|
|
204
214
|
|
|
205
|
-
-
|
|
215
|
+
- a924dfc: # 🚀 New Feature
|
|
206
216
|
|
|
207
|
-
|
|
217
|
+
Sometimes it can be hard to find an element in a mobile native app or desktop site, with an interactable Canvas, with the default [WebdriverIO selectors](https://webdriver.io/docs/selectors). In that case, it would be nice if you would be able to use something like OCR ([Optical Character Recognition](https://en.wikipedia.org/wiki/Optical_character_recognition)) to interact with elements on your device/screen.
|
|
208
218
|
|
|
209
|
-
|
|
219
|
+
The new `@wdio/ocr-service` service provides you with the option to interact with elements based on **visible text**. It will provide multiple commands to:
|
|
210
220
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
221
|
+
- wait
|
|
222
|
+
- search
|
|
223
|
+
- and interact
|
|
214
224
|
|
|
215
|
-
|
|
225
|
+
with an element, all based on text.
|
|
216
226
|
|
|
217
|
-
|
|
227
|
+
The following commands will be added
|
|
218
228
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
229
|
+
- `ocrGetText`
|
|
230
|
+
- `ocrGetElementPositionByText`
|
|
231
|
+
- `ocrWaitForTextDisplayed`
|
|
232
|
+
- `ocrClickOnText`
|
|
233
|
+
- `ocrSetValue`
|
|
224
234
|
|
|
225
|
-
|
|
235
|
+
A CLI command will also be provided to pre-check text received from the image, this can be run by using the command `npx ocr-service`. For a demo check this video
|
|
226
236
|
|
|
227
|
-
|
|
237
|
+
https://github.com/webdriverio/visual-testing/assets/11979740/af001bd8-3068-43f5-8b44-b320174883a8
|
|
@@ -15,7 +15,7 @@ export default async function ocrClickOnText(options) {
|
|
|
15
15
|
// Draw a target on the image so a user can see where the click will happen
|
|
16
16
|
await drawTarget({ filePath: element.filePath, targetX: x, targetY: y });
|
|
17
17
|
const actionType = browser.isMobile ? 'touch' : 'mouse';
|
|
18
|
-
const clickDuration = options.clickDuration
|
|
18
|
+
const clickDuration = options.clickDuration ?? 500;
|
|
19
19
|
await browser
|
|
20
20
|
.action('pointer', {
|
|
21
21
|
parameters: { pointerType: actionType }
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@wdio/ocr-service",
|
|
3
3
|
"author": "Wim Selles - wswebcreation",
|
|
4
4
|
"description": "A WebdriverIO service that is using Tesseract OCR for Desktop/Mobile Web and Mobile Native App tests.",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.1.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://webdriver.io/docs/visual-testing",
|
|
8
8
|
"repository": {
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"type": "module",
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@wdio/globals": "^9.
|
|
26
|
-
"@wdio/logger": "^9.0
|
|
27
|
-
"@wdio/types": "^9.
|
|
25
|
+
"@wdio/globals": "^9.1.2",
|
|
26
|
+
"@wdio/logger": "^9.1.0",
|
|
27
|
+
"@wdio/types": "^9.1.2",
|
|
28
28
|
"fuse.js": "^7.0.0",
|
|
29
|
-
"@inquirer/prompts": "5.
|
|
29
|
+
"@inquirer/prompts": "5.5.0",
|
|
30
30
|
"jimp": "^0.22.12",
|
|
31
31
|
"node-tesseract-ocr": "^2.2.1",
|
|
32
|
-
"tesseract.js": "^5.1.
|
|
32
|
+
"tesseract.js": "^5.1.1",
|
|
33
33
|
"xml2js": "^0.6.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|