wswebcreation / webdriver-image-comparison

MIT License
43 stars 36 forks source link

Not working with WinAppDriver because browser.execute is not implemented #104

Closed lacell75 closed 2 years ago

lacell75 commented 2 years ago

Environment:

Config of the automation framework + plugin

services: [ [
      'image-comparison',
      {
        // Some options, see the docs for more
        baselineFolder: path.join(process.cwd(), './datas/RefImages/'),
        formatImageName: '{tag}',
        screenshotPath: path.join(process.cwd(), '.tmp/'),
        savePerInstance: true,
        autoSaveBaseline: true,
        blockOutStatusBar: true,
        blockOutToolBar: true,
        // ... more options
      },
    ],
],
 capabilities: [
      // CAPA for local test
      platformName: 'WINDOWS',
      browserName: `DieManufacturing.${dieApplication}`,
      'ms:experimental-webdriver': true,
      'ms:waitForAppLaunch': '10',
      'appium:app': `C:/Program Files/Intescia/DieManufacturing.${dieApplication}/Fr.Intescia.DieManufacturing.Client.exe`,
      'appium:appArguments': '-noCloseConfirmationPopUp',
      'appium:appiumOptions': {
        w3c: false,
        'ms:experimental-webdriver': true,
      },
],

Describe the bug Unable to use webdriver-image-comparaison with WinAppDriver because browser.execute command is not implemented in this driver. Could you develop a mode that does not use this method(brower.execute)?

Expected behavior An option to disable the calls to browser.execute

Log

2022-05-04T09:03:51.386Z INFO webdriver: COMMAND $("~_rowHeaderCheckBoxLine_2")
[0-0] 2022-05-04T09:03:51.386Z INFO webdriver: COMMAND findElement("accessibility id", "_rowHeaderCheckBoxLine_2")
[0-0] 2022-05-04T09:03:51.386Z INFO webdriver: [POST] http://127.0.0.1:4723/session/bc1a8f39-ac62-460d-b860-f58ab5ec9a60/element
[0-0] 2022-05-04T09:03:51.386Z INFO webdriver: DATA { using: 'accessibility id', value: '_rowHeaderCheckBoxLine_2' }
[0-0] 2022-05-04T09:03:52.075Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '7.25576.48105459',
[0-0]   ELEMENT: '7.25576.48105459'
[0-0] }
[0-0] 2022-05-04T09:03:52.078Z INFO webdriver: RESULT Element {
[0-0]   sessionId: 'bc1a8f39-ac62-460d-b860-f58ab5ec9a60',
[0-0]   elementId: '7.25576.48105459',
[0-0]   ELEMENT: '7.25576.48105459',
[0-0]   selector: '~_rowHeaderCheckBoxLine_2',
[0-0]   parent: Browser {
[0-0]     sessionId: 'bc1a8f39-ac62-460d-b860-f58ab5ec9a60',
[0-0]     capabilities: {
[0-0]       platformName: 'WINDOWS',
[0-0]       browserName: 'DieManufacturing.Demo',
[0-0]       'ms:experimental-webdriver': true,
[0-0]       'ms:waitForAppLaunch': 10,
[0-0]       app: 'C:/Program Files/Intescia/DieManufacturing.Demo/Fr.Intescia.DieManufacturing.Client.exe',
[0-0]       appArguments: '-noCloseConfirmationPopUp',
[0-0]       appiumOptions: [Object]
[0-0]     },
[0-0]     addCommand: [Function (anonymous)],
[0-0]     overwriteCommand: [Function (anonymous)],
[0-0]     addLocatorStrategy: [Function (anonymous)],
[0-0]     config: {
[0-0]       specs: [Array],
[0-0]       suites: [Object],
[0-0]       exclude: [],
[0-0]       outputDir: undefined,
[0-0]       logLevel: 'debug',
[0-0]       logLevels: {},
[0-0]       excludeDriverLogs: [],
[0-0]       bail: 0,
[0-0]       waitforInterval: 800,
[0-0]       waitforTimeout: 30000,
[0-0]       framework: 'cucumber',
[0-0]       reporters: [Array],
[0-0]       services: [Array],
[0-0]       maxInstances: 16,
[0-0]       maxInstancesPerCapability: 12,
[0-0]       filesToWatch: [],
[0-0]       connectionRetryTimeout: 240000,
[0-0]       connectionRetryCount: 0,
[0-0]       execArgv: [],
[0-0]       runnerEnv: {},
[0-0]       runner: 'local',
[0-0]       specFileRetries: 0,
[0-0]       specFileRetriesDelay: 0,
[0-0]       specFileRetriesDeferred: false,
[0-0]       reporterSyncInterval: 100,
[0-0]       reporterSyncTimeout: 5000,
[0-0]       cucumberFeaturesWithLineNumbers: [],
[0-0]       autoCompileOpts: [Object],
[0-0]       mochaOpts: [Object],
[0-0]       jasmineOpts: [Object],
[0-0]       cucumberOpts: [Object],
[0-0]       onPrepare: [],
[0-0]       onWorkerStart: [],
[0-0]       before: [Array],
[0-0]       beforeSession: [],
[0-0]       beforeSuite: [],
[0-0]       beforeHook: [],
[0-0]       beforeTest: [Array],
[0-0]       beforeCommand: [],
[0-0]       afterCommand: [],
[0-0]       afterTest: [],
[0-0]       afterHook: [],
[0-0]       afterSuite: [],
[0-0]       afterSession: [],
[0-0]       after: [],
[0-0]       onComplete: [],
[0-0]       onReload: [],
[0-0]       beforeFeature: [Array],
[0-0]       beforeScenario: [Array],
[0-0]       beforeStep: [],
[0-0]       afterStep: [Array],
[0-0]       afterScenario: [Array],
[0-0]       afterFeature: [Array],
[0-0]       inspect: false,
[0-0]       port: 4723,
[0-0]       coloredLogs: true,
[0-0]       screenshotPath: './errorShots/',
[0-0]       baseUrl: '',
[0-0]       params: [Object],
[0-0]       _: [Array],
[0-0]       spec: [Array],
[0-0]       '$0': 'node_modules\\@wdio\\cli\\bin\\wdio.js',
[0-0]       ignoredWorkerServices: []
[0-0]     },
[0-0]     params: {
[0-0]       scenarioContext: {},
[0-0]       scenarioContext2: {},
[0-0]       featureContext: {},
[0-0]       importContractName: '',
[0-0]       importContractsList: [],
[0-0]       url: '',
[0-0]       profiles: [],
[0-0]       screenshotName: '',
[0-0]       fusion: [],
[0-0]       contactsName: [],
[0-0]       contractInformation: {},
[0-0]       orderedDieList: [],
[0-0]       tableColumnsList: [],
[0-0]       DIEVersion: '0000253.01.1'
[0-0]     }
[0-0]   },
[0-0]   emit: [Function: bound ],
[0-0]   isReactElement: false,
[0-0]   addCommand: [Function (anonymous)],
[0-0]   overwriteCommand: [Function (anonymous)]
[0-0] }
[0-0] 2022-05-04T09:03:52.078Z INFO webdriver: COMMAND checkElement(<object>, "ligne2_selected")
[0-0] 2022-05-04T09:03:52.081Z INFO webdriver: COMMAND executeScript(<fn>, <object>)
[0-0] 2022-05-04T09:03:52.081Z INFO webdriver: [POST] http://127.0.0.1:4723/session/bc1a8f39-ac62-460d-b860-f58ab5ec9a60/execute
[0-0] 2022-05-04T09:03:52.081Z INFO webdriver: DATA {
[0-0]   script: 'return (function hideScrollBars(hide) {\n' +
[0-0]     '    try {\n' +
[0-0]     '        if (hide) {\n' +
[0-0]     "            document.body.style.overflow = 'hidden';\n" +
[0-0]     '        }\n' +
[0-0]     '        else {\n' +
[0-0]     "            document.body.style.overflow = '';\n" +
[0-0]     '        }\n' +
[0-0]     '    }\n' +
[0-0]     '    catch (e) {\n' +
[0-0]     '    }\n' +
[0-0]     '}).apply(null, arguments)',
[0-0]   args: [ true ]
[0-0] }
[0-0] 2022-05-04T09:03:52.096Z ERROR webdriver: Request failed with status 405 due to unknown method: Method is not implemented
[0-0] Error in "0: And I expect that element "~_rowHeaderCheckBoxLine_2" is compared successful with the file "ligne2_selected""
NotImplementedError: Method is not implemented
    at WindowsDriver.execute (C:\2-gitlab\end-to-end-tests-wdio\node_modules\appium-windows-driver\lib\commands\execute.js:26:9)
    at commandExecutor (C:\2-gitlab\end-to-end-tests-wdio\node_modules\appium-base-driver\lib\basedriver\driver.js:335:9)
    at C:\2-gitlab\end-to-end-tests-wdio\node_modules\async-lock\lib\index.js:146:12
    at AsyncLock._promiseTry (C:\2-gitlab\end-to-end-tests-wdio\node_modules\async-lock\lib\index.js:280:31)
    at exec (C:\2-gitlab\end-to-end-tests-wdio\node_modules\async-lock\lib\index.js:145:9)
    at AsyncLock.acquire (C:\2-gitlab\end-to-end-tests-wdio\node_modules\async-lock\lib\index.js:162:3)
    at WindowsDriver.executeCommand (C:\2-gitlab\end-to-end-tests-wdio\node_modules\appium-base-driver\lib\basedriver\driver.js:348:39)
    at AppiumDriver.executeCommand (C:\2-gitlab\end-to-end-tests-wdio\node_modules\appium\lib\appium.js:563:36)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at asyncHandler (C:\2-gitlab\end-to-end-tests-wdio\node_modules\appium-base-driver\lib\protocol\protocol.js:297:21)
[0-0] 2022-05-04T09:03:52.096Z DEBUG webdriver: request failed due to response error: unknown method
[0-0] 2022-05-04T09:03:52.097Z DEBUG @wdio/utils:shim: Finished to run "afterStep" hook in 0ms
[0-0] Save a screenshot
[0-0] 2022-05-04T09:03:52.103Z INFO webdriver: COMMAND takeScreenshot()
[0-0] 2022-05-04T09:03:52.103Z INFO webdriver: [GET] http://127.0.0.1:4723/session/bc1a8f39-ac62-460d-b860-f58ab5ec9a60/screenshot
[0-0] 2022-05-04T09:03:52.339Z INFO webdriver: RESULT iVBORw0KGgoAAAANSUhEUgAADxIAAAhQCAIAAAA7KwjGAAAAAXNSR0IArs4c6...
[0-0] 2022-05-04T09:03:52.343Z DEBUG @wdio/utils:shim: Finished to run "afterScenario" hook in 0ms
[0-0] 2022-05-04T09:03:52.345Z INFO webdriver: COMMAND sendKeys(<object>)
[0-0] 2022-05-04T09:03:52.345Z INFO webdriver: [POST] http://127.0.0.1:4723/session/bc1a8f39-ac62-460d-b860-f58ab5ec9a60/keys
[0-0] 2022-05-04T09:03:52.345Z INFO webdriver: DATA { value: [ '', '1', '' ] }
[0-0] 2022-05-04T09:03:52.655Z DEBUG @wdio/utils:shim: Finished to run "afterFeature" hook in 311ms
[0-0] 2022-05-04T09:03:52.669Z INFO webdriver: COMMAND deleteSession()
[0-0] 2022-05-04T09:03:52.669Z INFO webdriver: [DELETE] http://127.0.0.1:4723/session/bc1a8f39-ac62-460d-b860-f58ab5ec9a602022-05-04T09:03:53.043Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1

Additional context Add any other context about the problem here.

wswebcreation commented 2 years ago

Hi @lacell75

thanks for this issue, but this module relies on a webcontext to do all the magic and doesn't support the WinAppDriver. Going to close it for that reasons