Wedriver.io不包括在我的Allure Report

发布于 2025-02-10 10:10:52 字数 411 浏览 2 评论 0原文

wdio.conf.ci.js附加了以下内容。

afterTest: function(test, context, { error, result, duration, passed, retries }) {

if (passed){
   browser.takeScreenshot();
}

}, 报告的屏幕截图,在右下角,我期望屏幕截图附件。请告知

wdio.conf.ci.js has the following appended.

afterTest: function(test, context, { error, result, duration, passed, retries }) {

if (passed){
   browser.takeScreenshot();
}

},
Screenshot of the Report, in bottom right corner I am expecting Screenshot Attachment. Please advise.
enter image description here

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

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

发布评论

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

评论(1

荒路情人 2025-02-17 10:10:52

在我的wdio.conf.ts

afterStep: async function (step, scenario, result, context) {
    if (!result.passed) {
        await browser.takeScreenshot();
    }
}

注意:我只想屏幕截图仅在失败上,您的目标可能是相反的

因此我建议将您的屏幕截图逻辑放在 sptep 挂钩之后,而不是在测试之后挂钩。

对于Allure-Reporter Config(如果您使用此服务,但我希望您确实使用):

"allure",
                {
                    outputDir: "allure-results",
                    useCucumberStepReporter: true,
                    disableWebdriverStepsReporting: true,
                    disableWebdriverScreenshotsReporting: false,
                },

in my wdio.conf.ts I have

afterStep: async function (step, scenario, result, context) {
    if (!result.passed) {
        await browser.takeScreenshot();
    }
}

note: I wanted screenshot on fail only, your aim might be the opposite

So I recommend putting your screen shot logic in the afterStep hook and not in a afterTest hook.

And for allure-reporter config (if you use this service, but I expect you do) use:

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