Tag: nightwatch.js

用于Nightwatch.js的MongoDB数据库清理程序

有没有办法在Nightwatch e2etesting之间擦除mongo数据库? 我来自Ruby,在那里你可以configurationRSpec使用一个名为数据库清理包,并在每次testing后擦拭你的数据库,我想知道是否有一个类似的设置存在于JavaScript的生态系统。 我做了一些研究,发现了一个名为node-database-cleaner的看起来很有前途的包,但是目前它正在抛出一个错误。 码: require('mongodb'); const DatabaseCleaner = require('database-cleaner'); const databaseCleaner = new DatabaseCleaner('mongodb'); …test assertions databaseCleaner.clean('mongodb://localhost:27017/my-db') 错误: TypeError: db.collections is not a function 我不一定会使用node-database-cleaner,无论使用什么库,我都会对任何解决scheme感兴趣。

如何让Nightwatch.js在Internet Explorer上运行testing

我正在尝试在Internet Explorer,Chrome和Firefox上运行一些基本的夜间testing。 虽然我可以得到铬和Firefox的工作,我不能让我的生活使Internet Explorer的工作。 我试过search这个网站,特别是find了这个答案,但是没有任何帮助。 当然,我也通过夜视文件看无济于事 这是我的nightwatch.conf.js文件: const BINPATH = './node_modules/nightwatch/bin/'; // we use a nightwatch.conf.js file so we can include comments and helper functions module.exports = { "src_folders": ["test"],// Where you are storing your Nightwatch e2e tests "output_folder": "./reports", // reports (test outcome) output by nightwatch "selenium": { // downloaded by selenium-download module "start_process": […]

nightwatch.js无法在无头模式下运行chrome

如果没有打开可见的浏览器窗口,我无法运行它。 我用“无头的”和“ 无头的 ”的论点来尝试 注意:我没有使用Selenium。 根据这个页面,从60版开始,MacOSX支持无头模式。我运行的是版本61 https://developers.google.com/web/updates/2017/04/headless-chrome 这是我的configuration: "chrome" : { "desiredCapabilities": { "javascriptEnabled": true, "acceptSslCerts": true, "browserName": "chrome", "chromeOptions" : { "args" : ["–headless"], "binary": "google-chrome" } } },

Night-watch.js安装错误?

试图安装夜视来玩它来testing它与其他框架,但是,我得到安装错误,我不知道这是什么意思。 我遵守夜间网站上的指示,但仍然收到错误: $ npm安装nightwatch 我如何解决这个问题? 在Windows上安装。 http://nightwatchjs.org/guide#installation

如何杀死在nightwatch中生成的进程globals.js before:function在after:函数中

我是nightwatch和node.js的新手,需要下面的帮助。 我在前函数中产生一个subprocess作为设置的守夜的一部分,并且想要在函数(拆卸)之前终止进程。 我怎么做。 我不确定使用x.kill。 module.exports = { before: function(done) { spawn = require('child_process').spawn; var x = spawn('./abc'); done(); }, after: function(done) { done(); //how to kill x spawned in before function. } }

是否内置select器选项以使用nightwatchjs进行复杂的决策?

使用名为NightWatch的JavaScript Selenium工具,在应用testing之前确定GUI部分的好习惯是什么? 例如,如果在A或B上发现,然后进行单独的testing。 另一个例子,确定是否login,所以你不会保持login等。似乎当我使用if语句与select器,它想要失败,如果我得到else选项。 我已经使用Python API很长一段时间了,你可以访问所有的Python库,你可以使用Selenium Selectors进行validation,而不会导致错误等。我甚至使用npm Selenium API的结果类似,但仍然是绿色的到它如何工作,但我不能让NightWatch的层做其他事情,但不pipe我尝试什么,E2E通过或失败。 我想我会把它放在那里,所以我可以看到,如果我只是做错了,或者这是一个普遍的问题。 或者,也许还有其他库旨在帮助我正在寻找。 任何投入将不胜感激。 这里是一个Python中的通用示例,我可以用它来validationA / B选项的工作… # so you know what EC is from selenium.webdriver.support import expected_conditions as EC … try: wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '#foo'))) driver.find_element_by_css_selector('#blah1 a').click() except: driver.find_element_by_css_selector('#blah2 a').click() 另一个可能更干净的方式来做它在Python中… if len(driver.find_elements_by_css_selector('#blah1 a')) > 0: driver.find_element_by_css_selector('#blah1 a').click() else: driver.find_element_by_css_selector('#blah2 a').click() 这里显然需要更多的逻辑,因为它没有夜间所有的内置插件,但是这应该让我知道我正在尝试做什么。

NemoJs vs NightWatchJS? 的优点和缺点

我对这两个框架都非常陌生。 看起来像nightwatch有更好的文件和广泛的API相比,尼莫? 相互使用的主要优点是什么?

使用NightWatchJStesting脚本进行条件testing

我试图在testing脚本中用条件编写一个守夜testing脚本。 我的代码到目前为止 module.exports = { tags: ['getting-started'], set_url: function (browser) { browser.url('http://www.google.com'); browser.pause(5000); browser.assert.title('Google'); if (browser.expect.element('#main').to.be.present) { browser.pause(5000); browser.setValue('input[type=text]', ['Night Watcher', browser.Keys.ENTER]); browser.pause(5000); if(browser.assert.containsText('#main', 'The Night Watch')){ console.log('search has the right result'); // for example }else{ console.log('No result found'); } } browser.end(); } }但是browser.expect.element('#main').to.be.present和browser.assert.containsText('#main', 'The Night Watch')返回一个对象,实际上并不是我感兴趣的结果用。 但是browser.expect.element('#main').to.be.present和browser.assert.containsText('#main', 'The Night Watch')返回一个对象,实际上并不是我感兴趣的结果。

运行没有terminal的守夜,通过我的应用程序?

我正在做夜classtesting,但所有这些都是通过terminal执行的,我想知道是否可以通过我的应用程序执行任务,而无需使用终止,即在应用程序内,然后单击button,执行与守夜完成的任务。 这个有可能?

使用Nightwatch无法点击模式中的元素

我正在用Nightwatch写一些testing,而且我在testing的最后,我有1个问题,我不明白。 我有一个button提交的东西,然后当他们点击提交,一个模式popup,询问他们是否确定。 我试图点击“是的,我确定”,但是守夜人没有find这个元素。 以下是我的代码。 点击提交button(这工作) .getLocationInView('#objective-content-intro > div > div > div > div:nth-child(4) > div > div:nth-child(8) > div > div > a') .assert.visible('#objective-content-intro > div > div > div > div:nth-child(4) > div > div:nth-child(8) > div > div > a') .click('#objective-content-intro > div > div > div > div:nth-child(4) > div > […]