简体   繁体   English

引诱报告与柏树集成时获得 NaN%

[英]Allure report getting NaN% when integrated with cypress

I am using allure reporting in my cypress, but after the execution I could see only the allure report folder getting generated but the allure results folder is not generated.我在柏树中使用诱惑报告,但执行后我只能看到生成了诱惑报告文件夹,但没有生成诱惑结果文件夹。

Configuration made in my code as below:在我的代码中进行的配置如下:

plugins/index.js插件/index.js

/// <reference types="@shelex/cypress-allure-plugin" />


const allureWriter = require("@shelex/cypress-allure-plugin/writer");

module.exports = (on, config) => {
allureWriter(on, config);
return config;
};

support/index.js支持/index.js

import '@shelex/cypress-allure-plugin';

in package.json在 package.json

"allure:report": "allure generate allure-results --clean -o allure-report",
"allure:clear_results":"(if exist allure-results (rmdir /S /Q allure-results))",
"allure:clear_report":"  (if exist allure-report (rmdir  /S /Q allure-report))",
"precy-run": "yarn run allure:clear_results && yarn run allure:clear_report",
"cy-run": "cypress run --env allure=true",
"postcy-run": "yarn run allure:report",

output in terminal output 在终端

$ allure generate allure-results --clean -o allure-report
allure-results does not exist
 Report successfully generated to allure-report

I tried viewing the report in live server in VS code我尝试在 VS 代码中查看实时服务器中的报告

在此处输入图像描述

It works for me, just I placed the result path in the root, looks like allure report look for the result in the root file if you change it, it doesn't work它对我有用,只是我将结果路径放在根目录中,看起来如果你更改它,它会在根文件中查找结果,它不起作用

"env": { 
    "allureResultsPath": "allure-results",
  },

Make sure to add " --env allure=true --reporter mocha-allure-reporter " while working with Allure Report integration with Cypress.确保在使用 Allure Report 与 Cypress 集成时添加“ --env allure=true --reporter mocha-allure-reporter ”。

My script in package.json :我在package.json中的脚本:

{
  "cypress:run:loginModule": "npx cypress run --browser chrome --headless --spec 'cypress/integration/Auth/*.js' **--env allure=true --reporter mocha-allure-reporter",
  "report:login:allure": "allure generate allure-results --clean -o allure-report && allure open allure-report",
  "test-loginModule:allure": "npm run cypress:run:loginModule && npm run report:login:allure"
}

It works for me!!!这个对我有用!!!

From the output从 output

allure-results does not exist诱惑结果不存在

refers to the folder named "allure-results".指名为“allure-results”的文件夹。

The clean-up script removes the folder with rmdir but does not recreate it.清理脚本使用rmdir删除文件夹,但不重新创建它。

"allure:clear_results":"(if exist allure-results (rmdir /S /Q allure-results))",

Change the script to将脚本更改为

"allure:clear_results":"(if exist allure-results (rmdir /S /Q allure-results && mkdir allure-results))",

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM