【问题标题】:Driving Nightwatch Tests through REPL通过 REPL 进行 Nightwatch 测试
【发布时间】:2017-09-21 14:42:57
【问题描述】:

我目前使用 vue 自动设置进行 nightwatch.js 设置。该模板位于此处。

https://github.com/vuejs-templates/webpack/tree/master/template/test/e2e

是否可以通过命令行以类似于 webdriver.io 中可用的 REPL 方式运行 nightwatch 断言?这里引用了webdriver功能https://twitter.com/webdriverio/status/806911722682544128


更新,我们已经开始使用 Cypress.io,这让我们非常高兴

【问题讨论】:

  • 我实际上选择了 testcafe.js,因为 nightwatch.js 很遗憾没有达到我对 e2e 测试工具的期望...
  • @phoet 我们移至 webdriver.io 仍然没有在 JS 世界中找到任何与 rails 相同级别的东西。
  • 也试过 webdriver,发现 testcafe 集成起来特别好。或多或少开箱即用。

标签: selenium nightwatch.js


【解决方案1】:

您可以使用 NPM 上提供的 nightwatch-repl 包。

https://www.npmjs.com/package/nightwatch-repl

// nightwatch.conf.js

var repl = require('nightwatch-repl');

module.exports = (function (settings) {
    repl.init(settings);
    ...
    ...
    return settings;
})(require('./nightwatch.json'));

一旦你运行测试并调用 browser.repl()

您应该在控制台中看到以下内容

Running:  Login to dashboard

Type in a command (eg: browser.function()) or type "quit" to exit
repl>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-06
    • 2020-07-18
    • 2016-04-05
    • 2018-03-30
    • 1970-01-01
    相关资源
    最近更新 更多