【问题标题】:Protractor JS pre-processorsProtractor JS 预处理器
【发布时间】:2014-11-04 09:18:44
【问题描述】:

我知道在 Karma 中可以选择使用预处理器,但是在 Protractor 中我看不到同样的东西。我目前正在使用 onPrepare 选项,但我想知道是否有可能/目前是否有办法让 npm 模块始终先运行(基本上与 onPrepare 相同)但通过配置而不需要做任何事情要求等。

【问题讨论】:

    标签: node.js angularjs testing protractor


    【解决方案1】:

    尝试在你的 package.json 中使用类似脚本的东西:

    "scripts": {
        "postinstall": "bower install",
        "pretest": "npm install",
        "test": "karma start test/karma.conf.js",
        "test-single-run": "karma start test/karma.conf.js  --single-run",
        "preupdate-webdriver": "npm install",
        "update-webdriver": "webdriver-manager update",
        "preprotractor": "npm run update-webdriver && node setUp.js",
        "protractor": "protractor test/protractor-conf.js",
        "postprotractor": "node tearDown.js",
    }
    

    通过在您的 cmd 中说“npm run protractor”,pre-(setUp.js) 和 postprotractor (tearDown.js) 中的脚本将在您的 e2e 测试之前和之后运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-31
      • 1970-01-01
      • 2013-03-18
      • 1970-01-01
      • 1970-01-01
      • 2012-03-11
      • 2015-09-11
      • 2010-09-07
      相关资源
      最近更新 更多