@@ -10,11 +10,9 @@ import ocrClickOnText from './commands/ocrClickOnText.js'
10
10
import ocrSetValue from './commands/ocrSetValue.js'
11
11
import type { OcrGetTextOptions , OcrGetElementPositionByTextOptions , OcrWaitForTextDisplayedOptions , OcrClickOnTextOptions , OcrSetValueOptions } from './types.js'
12
12
13
- type CommandMap = {
14
- [ key : string ] : ( context : any , options : any ) => Promise < any > ;
15
- } ;
16
-
17
- const commandList : CommandMap = {
13
+ const ocrCommands : {
14
+ [ key : string ] : ( context : any , options : any ) => Promise < any >
15
+ } = {
18
16
'ocrGetText' : async ( context , options ) => ocrGetText ( context , options as OcrGetTextOptions ) ,
19
17
'ocrGetElementPositionByText' : async ( context , options ) => ocrGetElementPositionByText ( context , options as OcrGetElementPositionByTextOptions ) ,
20
18
'ocrWaitForTextDisplayed' : async ( context , options ) => ocrWaitForTextDisplayed ( context , options as OcrWaitForTextDisplayedOptions ) ,
@@ -54,7 +52,7 @@ export default class WdioOcrService {
54
52
/**
55
53
* Add all OCR commands to the browser object and instances
56
54
*/
57
- for ( const commandName of Object . keys ( commandList ) ) {
55
+ for ( const commandName of Object . keys ( ocrCommands ) ) {
58
56
log . info ( `Adding browser command "${ commandName } " to browser object` )
59
57
browser . addCommand ( commandName , async function (
60
58
this : WebdriverIO . Browser | WebdriverIO . MultiRemoteBrowser ,
@@ -81,7 +79,7 @@ export default class WdioOcrService {
81
79
}
82
80
return returnData
83
81
}
84
- const handler = commandList [ commandName ]
82
+ const handler = ocrCommands [ commandName ]
85
83
if ( handler ) {
86
84
return await handler ( this , args [ 0 ] )
87
85
}
0 commit comments