-
Notifications
You must be signed in to change notification settings - Fork 29
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
cant send anything from wdio mocha after hook #138
Comments
Yes I intentially not report hooks. |
honestly I cant undestand why one need to exclude hooks from report. I mean I undestand that them want read less, but mocha or junit, jasmine won't care about such 'less reading' and will always show them in console.I think all reporters should repeat that logic. And if cucumber doesn't show |
I can easily explain. I don't have enough time to implement a solid solution for it. There are a lot of corner cases that must be handled and tested. That's why I report only failed hooks. |
But you have a broken functionality. When hook is failed you can't show what happened. I'd rather always show it in report than have this functionality cut off. Without check on as your have shared in allure( for some reason them added 'disableMochaHooks' flag for mocha to not to show before hooks and I think thats why have that problem now with lots of bugs). Please let me know if there is a way to add screenshots to hooks |
nope |
so for those who came with the same question - your answer - won't fix ? And if one need that one should create his own report portal service ? |
I didn't say "won't fix". For sure it is lack of functionality. I don't have time to implement it. It is an open source. You can research\implement\test it and make a pull request. But make sure it should work not only for mocha and not only in straight cases. |
main issue here - if you don't handle hooks right you can easy broke whole suite reporting because you will break testitems tree - it is worse than don't have screen in hooks. |
ok, right now I my project is in POC stage with report portal, I will create a custom service with the fix, and after when/if we choose it as our solution, and project give me time on the fix, I will try to provide a fix, or when I have my free time |
That will be awesome. If you will need help feel free to ask here or in report portal slack |
need your help. When I add the logic to start hook to enable sand the logs, it doesn't find that hook with sendFileToTest, and it seams hook name in afterHook(in wd.conf.js - client side) and in onHookStart onHookEnd(in reporter.js) has a different title. I mean startedTest.wdioEntity.title(from storage) === test.title(from wd.conf.js). So the logic of finding item by title works only for test and suite but not for hook for some reason. And error message is send to hook cause it doesn't use logic of finding by title but rather bu internal id you are assign Bottom line. If I than use startedTest.wdioEntity.title "after all" hook for Check ads on LiveCoveragePage auth Check ads on LiveCoveragePage auth - is a suite name |
That's true. Seems you can create issue in wdio repo to fix it.
Yes. It is ok.
|
ok thanks, will create an issue for wide. Thanks for help, will be back with its url |
from #139 I don't know how we should report per-file after suite mocha hooks. In fact they are not bounded to some reportportal suite and when they are executed there is no active suite item and there is no place to report them... If I'm not mistaken allure just ignore them, see https://github.com/webdriverio/webdriverio/blob/main/packages/wdio-allure-reporter/src/index.ts#L278 Example:
|
that would be step number 2 to think how to deal with it, at the moment regular hook doesn't work. After I fix that I will return to this issue |
if any I opened a ticket webdriverio/webdriverio#6336 |
The problem
Nor sendLogToTest neither sendFileToTest works with mocha wdio from afterHook. Error is next:
Can not send file to test "after all" hook for...
In my case I use mochabefore
andafter
for log in and log out. When something is wrong with that functionality I want to have some extra debug info.I think issue is that test item for hooks is not created at that time because of this logic in node_modules/wdio-reportportal-reporter/lib/reporter.ts:
As you can see
onHookStart
doesn't create any test item. And if I am not mistaken this hook starts before client'sbeforeHook
. AndonHookEnd
executes after client'safterHook
so code in clients after hook will try to send info to test item that not exists yet. If updateonHookStart
withthis.onTestStart(hook, TYPE.BEFORE_METHOD);
that will add hooks to all reports but also will enable sending info to that item.Environment
Code To Reproduce Issue [ Good To Have ]
The text was updated successfully, but these errors were encountered: