HTML报告使用github伪像从github action下载时破坏了报告

发布于 2025-01-23 19:08:16 字数 515 浏览 3 评论 0原文

我将测试运行到GitHub Action中,测试执行完成后,我使用github/Action-Artifact下载生成的报告,然后打开报告时,该报告设计被打破了。

当我从本地生成该报告时,我的报告处于以下格式。

当我从GitHub Action下载报告时,它看起来像以下格式。

任何人都知道有什么问题?

I am running my test into GitHub action and after test execution is completed I download generated report using github/action-artifact and when I open that report design is broken.

My report is in the below format when I generate it from my local.
enter image description here

and when I download reports from GitHub action it looks like the below format.

enter image description here

What is the problem can anyone know?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我的奇迹 2025-01-30 19:08:16

由于您只是下载report.html文件,因此您的报告扭曲了。我们还需要下载style.css文件,该文件是在资产文件夹中生成的。尝试类似以下代码的内容。我正在测试/报告文件夹中生成报告。在这里,我要保存包含资产文件夹和report.html的报告文件夹。

- name: Test with PyTest
        run: pytest --html=tests/Reports/Report.html  

      - name: Test Report Generation
        uses: actions/upload-artifact@v4
        if: success() || failure()
        with:
          name: Pytest Report           # Name of the folder
          path: tests/Reports           # Path to test results

The reason you are getting the report distorted because you are just downloading the report.html file. We need to download the style.css file also which is generated in the assets folder. Try something like the below code. I'm generating the report in tests/Reports folder. Here, I'm saving the Reports folder that contains both Assets folder as well as Report.html.

- name: Test with PyTest
        run: pytest --html=tests/Reports/Report.html  

      - name: Test Report Generation
        uses: actions/upload-artifact@v4
        if: success() || failure()
        with:
          name: Pytest Report           # Name of the folder
          path: tests/Reports           # Path to test results
离笑几人歌 2025-01-30 19:08:16

请查找由PYTEST-HTML生成的HTML报告中的标头,它保留:

<head>
    <meta charset="utf-8">
    <title>YOUR TITLE</title>
    <link href="assets/style.css" rel="stylesheet" type="text/css">
</head>

如果您有屏幕截图(使用Extras),则它们位于基于屏幕中。

我相信其余的都包含在 *.html文件中。

Please look up the header in the html report generated by pytest-html, it holds:

<head>
    <meta charset="utf-8">
    <title>YOUR TITLE</title>
    <link href="assets/style.css" rel="stylesheet" type="text/css">
</head>

If you have screenshots (using Extras), they are located in basedir.

The rest I believe is enclosed in the *.html file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文