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

 

參考:https://github.com/reportportal/agent-js-cypress

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章