【问题标题】:how to enable file api when writing e2e tests with protractor使用量角器编写 e2e 测试时如何启用文件 api
【发布时间】:2018-03-29 18:53:10
【问题描述】:

我正在用量角器编写测试用例。下面是我使用的配置

export let config: Config = {
  framework: "jasmine",
  specs: ["e2e-spec.js"],
  seleniumAddress: "http://localhost:4444/wd/hub",
  noGlobals: true,
  capabilities: {
    browserName: "chrome",
  },
  allScriptsTimeout: 200000
};

但是当我尝试访问文件 api 时,例如 fs.write,它抱怨 fs 未定义。

如何在我的测试用例中启用 fs 模块?

【问题讨论】:

    标签: node.js testing jasmine protractor


    【解决方案1】:

    您需要先使用var fs = require("fs"); 导入 fs 模块,然后才能在测试中访问它。

    【讨论】:

      猜你喜欢
      • 2017-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-21
      • 2014-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多