首页 > 解决方案 > 出现错误:BackstopJS 的 net::ERR_CONNECTION_REFUSED

问题描述

我在尝试运行 BackstopJS 时收到错误:net::ERR_CONNECTION_REFUSED 消息。创建了 localhost.crt 和 localhost.key 文件,我想知道是否需要在 backstop.json 文件中引用它们?还是我完全错了?我在 Mac 上,试图通过终端运行 Backstop。

这是我的 backstop.json 文件:

  "id": "backstop_default",
  "viewports": [
    {
      "label": "phone",
      "width": 320,
      "height": 480
    },
    {
      "label": "tablet",
      "width": 1024,
      "height": 768
    },
    {
      "label": "tablet-vertical",
      "width": 768,
      "height": 1024
   },
   {
     "label": "computer",
     "width": 1920,
     "height": 768
    }
  ],
  "onBeforeScript": "puppet/onBefore.js",
  "onReadyScript": "puppet/onReady.js",
  "scenarios": [
    {
      "label": "Regression Testing",
      "cookiePath": "backstop_data/engine_scripts/cookies.json",
      "url": "https://localhost:3000/",
      "referenceUrl": "https://localhost:3000/",
      "readyEvent": "backstopjs_ready",
      "readySelector": "",
      "delay": 1000,
      "hideSelectors": [],
      "removeSelectors": [],
      "hoverSelector": "",
      "clickSelector": "",
      "postInteractionWait": 0,
      "selectors": [],
      "selectorExpansion": true,
      "expect": 0,
      "misMatchThreshold" : 0.1,
      "requireSameDimensions": true
    }
  ],
  "paths": {
    "bitmaps_reference": "backstop_data/bitmaps_reference",
    "bitmaps_test": "backstop_data/bitmaps_test",
    "engine_scripts": "backstop_data/engine_scripts",
    "html_report": "backstop_data/html_report",
    "ci_report": "backstop_data/ci_report"
  },
  "report": ["browser"],
  "engine": "puppeteer",
  "engineOptions": {
    "ignoreHTTPSErrors": true,
    "args": ["--no-sandbox", "--disable-setuid-sandbox"]
  },
  "asyncCaptureLimit": 5,
  "asyncCompareLimit": 50,
  "debug": false,
  "debugWindow": false
}

标签: backstop.js

解决方案


推荐阅读