Closed sgordiev closed 1 year ago
@sgordiev can you provide a minimal reproducible example for this?
@sgordiev can you provide a minimal reproducible example for this?
I thought I gave the steps. Use report portal reporter it already exists, update its code in onHookEnd(hook){ if(!hook.title.includes('root')){ log.info('onHookEnd ',hook.title); }} to see hook title, create any simple test with after hook in mocha, in afterhock check context for hook name. One will see that in wdioconf.js afterhook its name differs from name in report onHookEnd. If you need code, than I need time, cause right now I am a bit busy with other tasks. Its one month passed since I created a ticket and management shifted me to another task
I see, thanks! Any contributions or help on this would be appreciated.
I did some investigations here and it seems that beforeHook
and afterHook
are called through the testFrameworkFnWrapper
and basically wrap every hook called within a spec. The reporter hookStart
and hookEnd
events are based on Mocha specific events emitted by the Mocha runner.
My recommendation here: somehow pass in the worker reporter into testFrameworkFnWrapper
and emit these events from the wrapped hook. Or maybe a simpler solution is to register these hooks by the worker reporter and propagate the same data as event.
I will go ahead and close this due to inactivity. Hook information and reporter data come from different sources and can't be seen as equal. I am missing the use case here and a concrete reproducible example. Happy to re-open if there is any interest.
[//]: # NOTE: This repository only maintains packages that are listed in the Readme. Please make sure that your issue is directly caused by one of these packages and if not file an issue in the correct 3rd party package repository.
Environment (please complete the following information):
Config of WebdriverIO
Describe the bug If create custom reporter and use 'onHookStart' 'onHookEnd'
hook.title
will be different then in 'afterHook'test.title
To Reproduce
src/utils/reporter/reporter.js
config/wdio-conf/common.js
Create custom reporter with code above and config with code above. Create a tests with 'after' hook. Run test and see that title in reporter and in afterHook of config won't match
[Include code or an example repository that can easily be set up]
Expected behavior titles should match
Log [0-0] 2021-01-21T18:47:14.326Z WARN wdio-reportportal-reporter: hook.title "after all" hook for Check ads on LiveCoveragePage auth [0-0] 2021-01-21T18:47:14.326Z WARN wdio-reportportal-reporter: test.title "after all" hook for "should have Symbol(AD_LIVECOVERAGE)" Additional context Add any other context about the problem here.