reportportal / agent-js-jest

Agent to integrate Jest with ReportPortal.
https://www.npmjs.com/package/@reportportal/agent-js-jest
Apache License 2.0
21 stars 37 forks source link

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

Closed criisv7 closed 4 months ago

criisv7 commented 2 years ago

Is there any way to do it.

chivekrodis commented 2 years ago

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?

AmsterGet commented 2 years ago

@chaitanya-uc

AmsterGet commented 12 months ago

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

aviadhadidainx commented 5 months ago

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

Pink-Bumblebee commented 5 months ago

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

aviadhadidainx commented 5 months ago

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 commented 5 months ago

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 commented 4 months ago

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 ?

AmsterGet commented 4 months ago

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!

aviadhadidainx commented 4 months ago

@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 commented 4 months ago

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

aviadhadidainx commented 4 months ago

@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

AmsterGet commented 4 months ago

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

AmsterGet commented 4 months ago

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.

aviadhadidainx commented 4 months ago

@AmsterGet Awesome thanks!

aviadhadidainx commented 3 months ago

@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 commented 3 months ago

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

AmsterGet commented 3 months ago

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.

aviadhadidainx commented 3 months ago

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