Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webdriverio: Update to latest webdriverio #829

Closed
straker opened this issue Sep 18, 2023 · 3 comments · Fixed by #962
Closed

webdriverio: Update to latest webdriverio #829

straker opened this issue Sep 18, 2023 · 3 comments · Fixed by #962

Comments

@straker
Copy link
Contributor

straker commented Sep 18, 2023

As part of the conversion to npm workspaces we had to pin the version of Webdriverio as the latest version causes type errors. Need to spend time updating the types.

@straker straker changed the title Update to latest webdriverio webdriverio: Update to latest webdriverio Sep 18, 2023
@dbjorge
Copy link
Contributor

dbjorge commented Nov 6, 2023

Notably, this will including updating the package to rely on the Browser/Element types from the global WebdriverIO.* type namespace, rather than the ones exported from the index of the webdriverio package - the latter was deprecated in webdriverio/webdriverio@2a66834 and is expected to be removed in webdriverio v9.

We'll need to test how to make that cooperate with back-compat for old webdriverio versions we support - I suspect it might involve type shenanigans like Awaited<ReturnType<webdriverio.remote>> | WebdriverIO.Browser.

@ghost
Copy link

ghost commented Nov 15, 2023

We are now impacted in our organisation because the AxeBuilder requires deprecated interface Browser type from npm package/path WebdriverIO/build/types which we use as browser/driver in our projects.

WDIO now supplies browser/driver types from package/path @wdio/globals/types as WebdriverIO.Browser instead.

Currently we don’t have any solution except wait for an update to AxeBuilder, so anything that could be expedited would be helpful.

In the meantime I am using the deprecated type at risk.

@padmavemulapati
Copy link

Verified with the latest Canary version - 4.8.3-6b60442.0 and with typescript- webdriverio is working as expected. Validated with V8, V7 and V6 . With all the versions typescript is working fine.

Steps validated:

  1. installed @axe-core/webdriverio package in webdriverio (5.3.3 , v6.12.1, v7.34.0, v8.21.0, and @wdio/cli- v8.24.2,
    @wdio/globals-8.24.2 )

Test code: compile and run using typescript


import { AxeBuilder } from '@axe-core/webdriverio'
import { remote } from 'webdriverio'

(async () => {
  const client = await remote({
    logLevel: 'error',
    capabilities: {
      browserName: 'chrome',
      'goog:chromeOptions': {
        args: ['headless', 'disable-gpu']
      }
    }
  })
  await client.url('https://dequeuniversity.com/demo/mars/')

  try {
    const results = await new AxeBuilder({ client }).analyze()
    console.log(results)
  } catch (e) {
    console.error(e)
  }

  client.deleteSession()
})()

wdio.conf.ts

import { Config } from '@wdio/types';

export const config: Config = {
    
  // Your WebDriverIO configuration here
};
V8 working recording
wdio8.mov
V7 working recording
wdio7.mov
V6 working recording
wdio6.mov

Note: For webdriverio v5, the code above should compile but may not open a browser and run. This is a set up issue with the webdriverio and not our code so we are OK if the builds but doesn't run in v5.

When trying to run using V5 getting error:

2024-01-12T13:02:04.277Z ERROR webdriver: Request failed due to AggregateError
    at internalConnectMultiple (node:net:1114:18)
    at afterConnectMultiple (node:net:1667:5)
2024-01-12T13:02:04.279Z ERROR webdriver: AggregateError
    at internalConnectMultiple (node:net:1114:18)
    at afterConnectMultiple (node:net:1667:5)
/Users/dq_user/Documents/CoreWDIO/node_modules/webdriverio/node_modules/webdriver/build/utils.js:45
    throw new Error('Failed to create session.\n' + message);
          ^
Error: Failed to create session.
Unable to connect to "undefined:undefined", make sure browser driver is running on that address.
If you use services like chromedriver see initialiseServices logs above or in wdio.log file.
    at startWebDriverSession (/Users/dq_user/Documents/CoreWDIO/node_modules/webdriverio/node_modules/webdriver/build/utils.js:45:11)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Function.newSession (/Users/dq_user/Documents/CoreWDIO/node_modules/webdriverio/node_modules/webdriver/build/index.js:46:23)
    at async remote (/Users/dq_user/Documents/CoreWDIO/node_modules/webdriverio/build/index.js:55:20)

which is expected.

Environment:

Label Value
Product axe-core/webdriverio
Version 4.8.3-6b60442.0
OS-Details _MAC- Intel Core i7 - 11.6.8 _
BrowserDetails Chrome Version 120.0.6099.129 & Firefox 121.0

@padmavemulapati padmavemulapati added the QA SIGNOFF: passed This ticket has passed QA label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants