allure-python icon indicating copy to clipboard operation
allure-python copied to clipboard

allure plugin for robotframework-seleniumlibrary

Open skhomuti opened this issue 4 years ago • 6 comments

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

skhomuti avatar Mar 05 '20 15:03 skhomuti

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!

fengnex avatar Nov 17 '20 07:11 fengnex

@skhomuti Is there any plan for that? There has been more than eight months since you opened the feature on 5 March!

fengnex avatar Nov 18 '20 09:11 fengnex

@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 avatar Nov 18 '20 09:11 skhomuti

@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 avatar Nov 19 '20 04:11 fengnex

@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

skhomuti avatar Nov 19 '20 06:11 skhomuti

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?

vploaia avatar Nov 19 '20 07:11 vploaia