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

The files in the /root/.selene/screenshots path are getting larger and larger #503

Open
zhupengfarmer opened this issue Jan 10, 2024 · 1 comment

Comments

@zhupengfarmer
Copy link

image

@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):
    # 什么时候去识别用例的执行结果呢?
    # 后置处理 yield:表示测试用例执行完了
    outcome = yield
    rep = outcome.get_result()  # 获取测试用例执行完成之后的结果
    if rep.failed:  # 判断用例执行情况:被调用并且失败
        # 实现失败截图并添加到allure附件。截图方法需要使用driver对象,想办法把driver传过来
        # 如果操作步骤过程中有异常,那么用例失败,在这里完成截图操作
        try:
            img = browser.driver.get_screenshot_as_png()
            # 将截图展示在allure测试报告上
            allure.attach(img, '失败截图', allure.attachment_type.PNG)
        except Exception as e:
            logs("截图失败", e)
@yashaka
Copy link
Owner

yashaka commented May 17, 2024

What would you expect as a feature from Selene to improve the situation on your side?

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

No branches or pull requests

2 participants