agent-js-jest icon indicating copy to clipboard operation
agent-js-jest copied to clipboard

Sending images and log messages to ReportPortal. (How can we add screenshots as an attachments in the report portal).

Open criisv7 opened this issue 3 years ago • 3 comments

Is there any way to do it.

criisv7 avatar Jan 25 '22 18:01 criisv7

Hello @criisv7, Unfortunately, agent have no ability report any attachments or logs to the test. Jest starts the reporter after all tests are over. This means, that if we try to assign the logs in the test directly, it will work before we start our reporter. Therefore, the reporter methods will not know about the logs that we assigned in the test.

However it looks like we have the ability to send all logs to launch. Do you think it will be useful?

chivekrodis avatar Feb 22 '22 08:02 chivekrodis

@chaitanya-uc

AmsterGet avatar Feb 22 '22 12:02 AmsterGet

Hello @criisv7 ! What do you think about suggestion from https://github.com/reportportal/agent-js-jest/issues/89#issuecomment-1047542149?

AmsterGet avatar Nov 10 '23 13:11 AmsterGet

I also trying to achieve this logic which is crucial. To add more data to each test. Sometimes attachment and sometimes just logs This is still the same status? Not possible? @AmsterGet

aviadhadidainx avatar Jun 10 '24 10:06 aviadhadidainx

@aviadhadidainx , maybe this will be helpful for you: https://reportportal.io/docs/developers-guides/AttachmentsGuide/

Pink-Bumblebee avatar Jun 10 '24 10:06 Pink-Bumblebee

Thanks. But based on this doc it is written:

agent-js-jest: There is no built-in capability to send attachments during test execution as the Jest Reporter works post-factum and does not allow to provide specific data to the report.

So how should i do it using jest? Doesn't make sense this is not an option mainly because this is fundamental requirement from a platform that provide automation reports

aviadhadidainx avatar Jun 10 '24 11:06 aviadhadidainx

On the readme file on this repo it is written is it capable of doing that.. So not sure what is correct? https://github.com/reportportal/agent-js-jest?tab=readme-ov-file#reporting-api-methods

aviadhadidainx avatar Jun 10 '24 11:06 aviadhadidainx

I understand what my issue was. It was on the develop branch and not on the master.. So this is pending release.

This is the PR link: https://github.com/reportportal/agent-js-jest/pull/140

Any idea when this released is planned? @Pink-Bumblebee @chivekrodis ?

aviadhadidainx avatar Jun 20 '24 08:06 aviadhadidainx

Hi @aviadhadidainx ! We found out that the implemented approach will not work for tests labeled as concurrent. So I'm going to look into this next week to see if this is a big change to support this option in an upcoming release. If it takes a while, I'll publish the current implementation and make a note in the readme that the concurrent option will be implemented separately. Let me know what you think!

AmsterGet avatar Jun 20 '24 08:06 AmsterGet

@AmsterGet Thanks for the quick response! In general we are not using under this project on concurrent option because in any case it is complicated (We are using end to end with playwright) So once this is release it will work for us perfectly

aviadhadidainx avatar Jun 20 '24 09:06 aviadhadidainx

Hi @AmsterGet Do you have an ETA approximately when this will be released?

aviadhadidainx avatar Jun 27 '24 09:06 aviadhadidainx

@AmsterGet ? This is kind of urgent for us mainly because we are using 2 different report because of that. We would like to unify to the report portal but if won't be available on the short term we might need to consider different approach for that problem

aviadhadidainx avatar Jul 07 '24 08:07 aviadhadidainx

Hi @aviadhadidainx ! Sorry for delayed response, I'm going to publish it this week. I'll notify you here.

AmsterGet avatar Jul 08 '24 16:07 AmsterGet

Hello @aviadhadidainx , @criisv7 ! Support for attachments has been released in version 5.1.0. Please check it out. I'll close this issue. Please track the progress of 'logs' support within https://github.com/reportportal/agent-js-jest/issues/55.

AmsterGet avatar Jul 11 '24 15:07 AmsterGet

@AmsterGet Awesome thanks!

aviadhadidainx avatar Jul 11 '24 19:07 aviadhadidainx

@AmsterGet Hi there.. Tested and it seems to be that the doc are not updated properly.

It is written on the doc to use as static: ReportingApi.attachment

When i look on the implantation it is not a static method and require the reporter on the constructor: constructor(reporter).

What will be the correct way of using it?

Thanks

aviadhadidainx avatar Jul 14 '24 07:07 aviadhadidainx

Found it.. It should be global.ReportingApi.attachment instead of ReportingApi.attachment. Would you like me to open another issue and create a PR?

aviadhadidainx avatar Jul 14 '24 07:07 aviadhadidainx

Hi @aviadhadidainx ! Thanks for trying it. I've updated the example for the Jest integration, please take a look. It can be accessed within global scope just like ReportingApi.attachment. I'm not sure, but if this approach didn't work for you it may depend on your jest environment configuration.

AmsterGet avatar Jul 15 '24 09:07 AmsterGet

In any case working very well.. Thanks a lot. We are already using it

aviadhadidainx avatar Jul 15 '24 10:07 aviadhadidainx