centos 用docker 运行 cypress

1.docker 拉cypress的镜像

docker pull cypress/included:5.0.0

  2.上传cypress文件夹到centos,进入项目【cypress_odoo_ui】。用例写在./cypress_odoo_ui/cypress/integration/mytest下

[root@localhost ~]# cd /usr/alam/cypress_odoo_ui
[root@localhost cypress_odoo_ui]# docker run -it -v $PWD:/mytest -w /mytest cypress/included:5.0.0

3.1 设置生成报告格式

{
  "viewportWidth": 1280,
  "viewportHeight": 600,
  "integrationFolder": "cypress/integration/mytest",
  "testFiles": "**/*.js",
  "chromeWebSecurity": false,
  "reporter": "junit",
  "reporterOptions": {
    "mochaFile": "results/test_report_[hash].xml", 
    "toConsole": true
  },
  "reporter": "mochawesome",
  "reporterOptions": {
    "reportDir": "cypress/results",
    "overwrite": false,
    "html": false,
    "json": true
  },
  "reporter": "junit",
  "reporterOptions": {
    "mochaFile": "results/test_report_[hash].xml", 
    "toConsole": true
  }
}

  

  

3.生成报告

[root@localhost cypress_odoo_ui]# allure serve results
Generating report to temp directory...
Report successfully generated to /tmp/5095319951338814878/allure-report
Starting web server...
2020-08-25 17:30:23.774:INFO::main: Logging initialized @1152ms to org.eclipse.jetty.util.log.StdErrLog
Can not open browser because this capability is not supported on your platform. You can use the link below to open the report manually.
Server started at <http://127.0.0.1:43021/>. Press <Ctrl+C> to exit

  4.访问地址

http://10.11.19.55:43021/index.html#suites

 5.集成到Jenkins,Jenkins有个allure的插件

原文地址:https://www.cnblogs.com/alamZ/p/13537438.html