angular - 错误:运行 Protractor 端到端测试时找不到 update-config.json
问题描述
我有一个 Angular 6 项目并尝试运行端到端量角器测试。我在这一步中不断收到此错误:
webdriver-manager update --standalone false --gecko false
所以我全局安装了webdriver-manager,webdriver-manager文件夹在文件夹中:C:\Users...\Roaming\npm\node_modules
然后,我使用文件夹 C:/User/ 中的此命令更新 webdriver-manager:
webdriver-manager update
这成功地添加了 selenium jar、chromedriver 和 geckodriver。
我尝试使用纱线运行端到端测试。当脚本到达此命令时:
webdriver-manager update --standalone false --gecko false
这个 json 文件应该在哪里,我如何得到它?
更新 这些是当前脚本:
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config local.proxy.config.json",
"build": "ng build --output-path ../resources/static",
"test": "ng test",
"test-local": "ng test --karmaConfig=karma-local.conf.js",
"lint": "ng lint",
"wd:update": "npm run e2e-update && protractor ./e2e/protractor-local.conf.js",
"wd:start": "webdriver-manager start && protractor ./e2e/protractor-local.conf.js",
"e2e-local": "npm run e2e-update && protractor ./e2e/protractor-local.conf.js",
"e2e-local-debugger": "npm run e2e-update && node --inspect-brk node_modules/protractor/bin/protractor ./e2e/protractor-local.conf.js",
"e2e": "npm run e2e-update && npm run e2e-test",
"e2e-test": "protractor ./e2e/protractor.conf.js",
"e2e-update": "webdriver-manager update --standalone false --gecko false",
"e2e-jenkins-staging": "npm run e2e-update && npm run e2e-staging",
"e2e-jenkins-prod": "npm run e2e-update && npm run e2e-prod",
"e2e-staging": "protractor ./e2e/protractor-staging.conf.js",
"e2e-prod": "protractor ./e2e/protractor-prod.conf.js",
"sonar": "sonar-scanner"
},
解决方案
问题是因为 webdriver-manager 的本地和全局安装。
在 package.json 中创建一个 npm 脚本来更新 webdriver 管理器,例如
"wd:update": "webdriver-manager update"
这将在项目的 node_modules 中下载 webdriver-manager 的驱动程序和二进制文件。
从项目目录运行这个 npm 脚本 npm runwd:update
推荐阅读
- postgresql - PostgreSQL n_distinct 统计设置
- ios - 按日期Swift 5使用compactMap对数组进行排序
- python - 尝试将“pyzbar”模块导入 Jupyter Lab 时找不到模块“libiconv.dll”
- reactjs - .less 文件没有被 less-loader 拾取
- php - 我到底做错了什么,我无法从 JSON 访问推文文本?
- python - 如果字符串以特定字符(熊猫)结尾,如何向字符串添加前缀,即在字符串以“-”结尾时添加“-”
- c - 内存地址的数据类型
- python - TensorFlow 2.4.1:内存和运行时效率 SUM(MULTIPLY(X, Y))
- c# - 在不同的服务提供商上注册 IHostedService
- spring-boot - Quartz JobChainingJobListener 如何在多服务器(集群)环境中使用?