allure-python
allure-python copied to clipboard
allure plugin for robotframework-seleniumlibrary
I'm submitting a ...
- [ ] bug report
- [x] feature request
- [ ] support request => Please do not submit support request here, see note at the top of this template.
This could be an good example or part of a robot adapter
import allure
from SeleniumLibrary import ScreenshotKeywords
from SeleniumLibrary.base import keyword, LibraryComponent
class AllureSeleniumPlugin(LibraryComponent):
@keyword
def capture_page_screenshot(self, filename='selenium-screenshot-{index}.png'):
path = ScreenshotKeywords(ctx=self.ctx).capture_page_screenshot(filename)
allure.attach.file(path, attachment_type=allure.attachment_type.PNG)
Library SeleniumLibrary plugins=AllureSeleniumPlugin
The bug still exists in v2.8.19, the latest version of allure-robotframework!
I wonder how to fix it, and can anyone help out?
Hope the abover planned new feature would be implemented soon!
@skhomuti Is there any plan for that? There has been more than eight months since you opened the feature on 5 March!
@fengnex plan for what? This is a feature request. There is no bug here.
there are several ways to attach screenshots to a report. In this task, one of them is indicated - just copy this code to yourself, and add an argument to the selenium library.
@skhomuti Thanks for your kind response first.
I'm just not sure whether the above code will work and what the required all modifications should be. You know, it seems that there are no proper ways to test it right now, but anyway I will try to confirm your opinion.
@fengnex I have prepared an example using this plugin. Let me know if it doesn't work for you https://github.com/skhomuti/allure-robotframework-screenshot-example
Hi @skhomuti
I receive AttributeError: 'function' object has no attribute 'file'
at
allure.attach.file(path, attachment_type=allure.attachment_type.PNG)
.
Actually, print(dir(allure.attach)) returns the following:
'['call', 'class', 'delattr', 'dir', 'doc', 'eq', 'format', 'func', 'ge', 'get', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'self', 'setattr', 'sizeof', 'str', 'subclasshook']'
Could you please take a look?