如何解决由webdriver.io

问题描述

我正在尝试使用webdriver.io在TypeScript SPA上进行测试。我设置了wdio,但是由于wdio引入的新类型引起的各种类型冲突而无法编译打字稿。

例如,wdio引入了$,它与jQuery中的$冲突:

node_modules/@types/jquery/misc.d.ts:6536:15 - error TS2451: Cannot redeclare block-scoped variable '$'.

6536 declare const $: JQueryStatic;
                   ~

  node_modules/@wdio/sync/webdriverio.d.ts:38:18
    38 declare function $(selector: string | Function): WebdriverIO.Element;
                        ~
    '$' was also declared here.

节点还引入了各种冲突:

node_modules/@types/node/index.d.ts:66:11 - error TS2300: Duplicate identifier 'IteratorResult'.

66 interface IteratorResult<T> { }
             ~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
    41 type IteratorResult<T,TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
            ~~~~~~~~~~~~~~
    'IteratorResult' was also declared here.

更妙的是,节点类型更改了setTimeout

的返回类型
wwwroot/app/shared/lib/decorators/debounce.ts:36:17 - error TS2345: Argument of type 'Timer' is not assignable to parameter of type 'number'.

36                 setTimeout(method.bind(this,...args),milliseconds)

我肯定要使用TypeScript来构建测试和应用程序,因为我想在测试中利用应用程序类型。我认为这意味着我需要一前一后地构建它们。

是否存在任何解决方法

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...