cypress与reportportal的整合
Cypress与Reportportal整合步骤
简单记录下cypress与reportportal的整理的方法
一、安装
直接在要跑的项目目录下运行下面命令
npm install @reportportal/agent-js-cypress
二、注册插件到index.js中
在cypress/plugins/index.js文件中加入下面这段代码
const registerReportPortalPlugin = require('@reportportal/agent-js-cypress/lib/plugin'); module.exports = (on, config) => registerReportPortalPlugin(on, config);
这里要注意的是,github上的示例是错误的
三、加入到自定义的command中
在cypress/support/commands.js中加入下面这段
require('@reportportal/agent-js-cypress/lib/commands/reportPortalCommands');
四、整合运行
有两种方式,一种是将配置写入cypress.json中,如下
{ "reporter": "@reportportal/agent-js-cypress", "reporterOptions": { "endpoint": "http://your-instance.com:8080/api/v1", "token": "00000000-0000-0000-0000-000000000000", "launch": "LAUNCH_NAME", "project": "PROJECT_NAME", "description": "LAUNCH_DESCRIPTION" } }
然后,直接运行
npx cypress run
另一种是将参数写入至命令行中,如下
npx cypress run -r @reportportal/agent-js-cypress --reporter-options endpoint=http://your-instance.com:8080/api/v1,token=00000000-0000-0000-0000-000000000000,launch=LAUNCH_NAME,project=PROJECT_NAME,description=LAUNCH_DESCRIPTION,autoMerge=true
命令行的说明可以参考官网:https://docs.cypress.io/guides/guides/command-line
Email:362299908@qq.com