0

包.json

{
  "name": "assignment10",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@date-io/date-fns": "^2.10.8",
    "@material-ui/core": "^4.11.4",
    "@material-ui/pickers": "^3.3.10",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "@types/jest": "^26.0.15",
    "@types/node": "^12.0.0",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "babel-preset-mobx": "^2.0.0",
    "chromedriver": "^90.0.0",
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.6",
    "enzyme-to-json": "^3.6.2",
    "jest": "^26.6.0",
    "mobx": "latest",
    "mobx-react": "^7.1.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-intl": "^5.17.4",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "styled-components": "^5.3.0",
    "typescript": "^4.1.2",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "eject": "react-scripts eject",
    "lint": "eslint --ext .js,.jsx,.ts,.tsx src --color",
    "test": "jest -u",
    "browsertest": "nightwatch",
    "coverage": "jest --coverage"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@types/enzyme": "^3.10.8",
    "@types/enzyme-adapter-react-16": "^1.0.6",
    "@types/react-router-dom": "^5.1.7",
    "@types/styled-components": "^5.1.9",
    "@typescript-eslint/eslint-plugin": "4.22.1",
    "@typescript-eslint/parser": "4.22.1",
    "babel-eslint": "10.1.0",
    "eslint": "^7.25.0",
    "eslint-config-airbnb": "18.2.1",
    "eslint-config-airbnb-typescript": "12.3.1",
    "eslint-config-prettier": "8.3.0",
    "eslint-config-react-app": "6.0.0",
    "eslint-import-resolver-typescript": "2.4.0",
    "eslint-loader": "4.0.2",
    "eslint-plugin-flowtype": "5.7.2",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsx-a11y": "6.4.1",
    "eslint-plugin-react": "^7.23.2",
    "eslint-plugin-react-hooks": "4.2.0",
    "nightwatch": "^1.6.4"
  }
}

nightwatch.conf.js

  module.exports = {
  "src_folders" : ["./src/nightWatch"],

  "webdriver" : {
      "start_process": true,
      "server_path": "node_modules/chromedriver/lib/chromedriver/chromedriver",
      "port": 9515
  },

  "test_settings" : {
      "default" : {
          "desiredCapabilities": {
              "browserName": "chrome"
          }
      }
  }
}

当我运行脚本 npm run browsertest 时,我直接从谷歌浏览器拒绝连接。我已经在浏览器中停用了沙盒并禁用了所有代理。我也改变了端口,但我就是想不通。

有没有人有办法解决吗?我有 Debian 10 作为操作系统

错误

4

1 回答 1

0

您好,我找到了解决方案。我有几个实例正在运行,因此 npm start 然后选择了一个与我在测试中定义的端口不同的端口。已杀死端口上的所有进程并重新启动

于 2021-06-15T14:23:02.913 回答