Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] allure-playwright for python #1158

Closed
arturmkr opened this issue Feb 12, 2022 · 5 comments
Closed

[Feature] allure-playwright for python #1158

arturmkr opened this issue Feb 12, 2022 · 5 comments
Labels

Comments

@arturmkr
Copy link

There is an Allure project for integration with Playwright on JS:
https://github.com/allure-framework/allure-js/tree/master/packages/allure-playwright

Is it going to be allure-playwright for python?

@mxschmitt
Copy link
Member

Usually this is part of the test-runner. For pytest there is already one available: https://docs.qameta.io/allure-report/frameworks/python/pytest

Probably related to microsoft/playwright-pytest#77

@HassanAbbas7357
Copy link

screenshots are not attaching to the allure report

@alextolkacov
Copy link

Same problem for me

@HassanAbbas7357
Copy link

Same problem for me

I have resolved the issue use this code

@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
    outcome = yield
    screen_file = ''
    report = outcome.get_result()
    extra = getattr(report, "extra", [])
    if report.when == "call" and report.failed:
        try:
            xfail = hasattr(report, "wasxfail")
            if report.failed or xfail and "page" in item.funcargs:
                page = item.funcargs["page"]
                screen_file = generate_random_screenshot_name(item.name)
                page.screenshot(path=screen_file)
                allure.attach(
                        page.screenshot(path=screen_file),  # Call screenshot method on the instance
                        name=str(item.name),
                        attachment_type=allure.attachment_type.PNG
                )
            else:
                print("FAILED SCREENSHOT")
        except Exception as e:
            print('Failed to take a screenshot: {}'.format(e))
       

@alextolkacov
Copy link

Thanks! But could you please show where you call this function? Because I'm still facing same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants