reportportal / agent-Python-RobotFramework

Robot Framework integration for Report Portal
Apache License 2.0
59 stars 32 forks source link

How to send screenshot to report portal- help needed #45

Closed Dhams-1 closed 4 years ago

Dhams-1 commented 4 years ago

Hi All @iivanou

I am very new to reportportal. I have installed agent for robotframework. I would like to send the failure cases screenshots to report portal i went through the code from here https://github.com/reportportal/client-Python#send-attachment-screenshots

but I am not able to follow it on where to add this code snippet. Kindly help me with the same.

DzmitryHumianiuk commented 4 years ago

@Dhams-1 it can be outdated. team working on client-python update, so it should be fixed quite soon.

@iivanou does file sending change?

iivanou commented 4 years ago

@Dhams-1 There was an issue with sending log data. Now, it is fixed in version 5.0.1. Could you try it?

Dhams-1 commented 4 years ago

Hi @iivanou @DzmitryHumianiuk Thank you for the update I updated the to the latest version robotframework-reportportal==5.0.1 I am not able to find the screenshots in case of test failures. getting the log with image details but it is missing in reportportal image

is there anything i am missing here. kindly help me with the same

iivanou commented 4 years ago

@Dhams-1 Hi, everything works well on my side. Are you sure that you use the full path to the screenshot in your code?

Dhams-1 commented 4 years ago

@iivanou I am not specifying any explicit path. when i run the robot framework test i do something like this

C:\go\to\testfolder> pybot --listener robotframework_reportportal.listener --variable RP_UUID:..........-d Results .......................-vbrowser:chrome -vbaseurl:

So all the screenshots are saved in the Results folder. With Robotframework html report is displayed with the screenshots but in reportportal it is missing.

should i have to mention the path explicit or how to fix the same

iivanou commented 4 years ago

@Dhams-1 You should report attachments the way it is described in the docs. Selenium itself does not send anything to RP.

Dhams-1 commented 4 years ago

@iivanou Sorry i am very new to report portal I went through the code in https://github.com/reportportal/client-Python#send-attachement-screenshots

but I was not sure where to add this code snippet.. should i add it in the listener or create my own class file.

iivanou commented 4 years ago

You should add this code snippet to the Python module, modify it the way you need, import that module in your Robot file, call created keyword passing a path to the screenshot. It is nothing about Report Portal but rather extending Robot Framework.

bharatslalchandani commented 4 years ago

@iivanou: In the code snippet for the screenshot, we need to pass image name but here in execution, we do not know the image name generated by selenium as it is done in an incremented manner (like selenium-screenshot-1,2,3,.. so on) on any step failure. So how can we have that call of the keyword for all the images that get generated by selenium code of any test step failure or waiting for some element ?

iivanou commented 4 years ago

@bharatslalchandani I think you can get the image name generated by the selenium and pass it to the keyword that will send it out to RP. That's what I found doing a quick search through the documentation: https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Capture%20Page%20Screenshot