【问题标题】:Unable to view images generated via allure jasmine reports无法查看通过 allure jasmine 报告生成的图像
【发布时间】:2020-04-27 01:56:28
【问题描述】:

先决条件:allurejasmine

我可以使用以下代码截取失败的测试用例的屏幕截图,并且 png 图像文件也可以使用 xml 创建。

但是,当我双击图像文件时,我无法查看 png 文件。

问题:wpv 中的消息抛出为 - 看起来我们不支持这种文件格式。

在绘画中,它显示此位图不受支持。

请提出建议。

browser.takeScreenshot().then(function (png) {
 allure.createAttachment('Screenshot', function () {
     return new Buffer(png, 'base64')
      }, 'image/png')();
     });

【问题讨论】:

    标签: javascript image image-processing jasmine allure


    【解决方案1】:

    这样试试

    const pngFile = await browser.takeScreenshot();
    allure.attachment(screenshotname, Buffer.from(pngFile, 'base64'), ContentType.PNG);
    

    ContentType.PNG = '图片/png'

    【讨论】:

    • 谢谢。但我收到一个错误 ContentType not defined。
    • 不知道你用的是哪个版本,这是枚举。所以你可以将它添加为字符串'image/png'
    • 我尝试作为枚举传递,但没有成功。同样的错误 ContentType 未定义。我在 ES6 上使用 jasmine-allure-reporter 作为 npm 包。
    • 似乎你不理解枚举,但正如我所说,将它输入为字符串
    猜你喜欢
    • 1970-01-01
    • 2017-10-17
    • 2023-03-31
    • 1970-01-01
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-08
    相关资源
    最近更新 更多