我正在使用带有类型记录和茉莉花的webdriverIO 6,最近(在将@wdio/升级到6.10.11之后,我不确定这是否巧合),我注意到在测试运行过程中出现了一些新的错误--在每次“它”之前和之后:
Starting ChromeDriver 88.0.4324.96 on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[0-0] RUNNING in chrome - /dist/specs/main.spec.js
[0-0] 2021-01-28T14:28:25.059Z ERROR @wdio/sync: TypeError: hook.apply is not a function
at execHook (/Users/marian/projects/***e2e/node_modules/@wdio/sync/build/executeHooksWithArgs.js:21:31)
[0-0] Error in "BeforeTest Hook"
hook.apply is not a function
[0-0] Opened url: ***
[0-0] 2021-01-28T14:28:28.826Z ERROR @wdio/sync: TypeError: hook.apply is not a function
at execHook (/Users/marian/projects/-e2e/node_modules/@wdio/sync/build/executeHooksWithArgs.js:21:31)
[0-0] Error in "AfterTest Hook"
hook.apply is not a function在wdio/sync升级到6.11.00之后,它一直是这样的。
这是我的堆栈:
"devDependencies": {
"@types/jasmine": "^3.6.2",
"@types/node": "^14.14.20",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"@wdio/cli": "^6.11.3",
"@wdio/devtools-service": "^6.11.0",
"@wdio/jasmine-framework": "6.6.3",
"@wdio/local-runner": "^6.11.3",
"@wdio/spec-reporter": "^6.11.0",
"@wdio/sync": "6.11.0",
"eslint": "^7.17.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"wdio-chromedriver-service": "^6.0.4"
},
"dependencies": {
"@rpii/wdio-html-reporter": "~6.1.1",
"@slack/web-api": "^5.15.0",
"@wdio/reporter": "^6.11.0",
"chromedriver": "^88.0.0",
"typescript": "4.1.3",
"wdio-timeline-reporter": "^5.1.4"
}在wdio.conf.js中,我只使用一个钩子,这不是导致问题的原因,因为它只在末尾触发一次(onComplete()),并且注释它没有任何区别。
我还使用了CustomReporter,它扩展了WDIOreporter,并在那里使用了onTestPass()和onTestFail()方法,但是甚至禁用整个记者也没有任何区别。
我查看了executeHooksWithArgs.js:21:31,但这对我没有任何意义,只是这个部分负责钩子。
我尝试返回到@wdio/sync 6.6.0 (升级之前我正在使用它),但在同一个文件中出现了类似的错误,失败了:
ERROR @wdio/local-runner: Failed launching test session: TypeError: hooks.map is not a function
at Object.executeHooksWithArgs (/Users/marian/projects/***/node_modules/@wdio/sync/build/executeHooksWithArgs.js:16:19)
(...) Error: Could not find job困扰我的是,我有另一个项目与类似的设置,没有错误在那里,我是在同一时间升级他们。我都不知道该去哪找了。
发布于 2022-06-01 02:28:43
有一个类似的问题,我的堆栈是:
"@wdio/sync": "6.11.0", "@wdio/cucumber-framework": "6.8.0"
当我将@wdio/cucumber-framework升级到6.11.1时,错误就消失了。
发布于 2021-01-28 15:01:42
因此,在我发送这篇文章之前,我深入研究了这个项目的gitlab历史,以及我在最后一段中提到的类似项目,我注意到了一个不同之处:
- "@wdio/jasmine-framework": "6.6.3",
+ "@wdio/jasmine-framework": "^6.11.0",升级之后,问题就解决了。我希望我能写更多关于原因的东西,但老实说,我不知道到底是什么原因造成的。
我所知道的是,如果你有类似的问题,尝试升级你的框架,它对茉莉花有效,我不确定是否有类似的问题与摩卡或黄瓜,但如果是-这是值得一试。
https://stackoverflow.com/questions/65939744
复制相似问题