【问题标题】:How to execute a shell command from a protractor end-to-end test?如何从量角器端到端测试中执行 shell 命令?
【发布时间】:2017-09-11 12:47:57
【问题描述】:

我正在编写量角器端到端测试,我必须在每次测试之前重置数据库。为此,我需要调用一个 shell 脚本。那可能吗?如果是,怎么做?

【问题讨论】:

标签: javascript shell testing command-line protractor


【解决方案1】:

这不完全是量角器相关问题,而是茉莉花。我假设你是 jasmine bdd + protractor 。您需要在 beforeEach 块中调用执行 cmd 或 shell 脚本文件的方法。

可以使用unix-cmd nodejs 包。或者可以更进一步,通过将命令保存到在实用程序方法中执行的 b 并在每个块之前调用特定的实用程序方法。您可以查看 jasmine 文档。

希望这会有所帮助。

【讨论】:

  • 谢谢,我最终使用了 shelljs,但我认为 unix-cmd 也可以。
猜你喜欢
  • 2017-11-30
  • 2010-10-30
  • 1970-01-01
  • 2017-01-15
  • 1970-01-01
  • 2023-04-08
  • 2017-04-16
  • 1970-01-01
  • 2018-05-28
相关资源
最近更新 更多