Tag: functiontesting

使用Mocha和Grunt在Sails.js中运行functiontesting时的竞态条件

我正在使用Sails v0.10.x,并且在运行我的functiontesting时遇到问题。 testing/ bootstrap.test.js // force the test environment to 'test' process.env.NODE_ENV = 'test'; var Sails = require('sails'); // use zombie.js as headless browser var Browser = require('zombie'); // Global before hook before(function(done) { var self = this; // Lift Sails and start the server Sails.lift({ log: { level: 'error' }, }, function(err, sails) { […]

弗里斯比functiontesting标准

我是新来的,我一直在寻找方法(或标准)来编写适当的functiontesting,但我仍然有许多没有答案的问题。 我使用FrisbyJS为我的NodeJS API应用程序和jasmine-node编写functiontesting来运行它们。 我已经阅读了弗里斯比的文档,但对我来说并不富有成效。 这是一个场景: 客人可以创build一个User 。 (显然,不允许用户名重复) 创build一个User ,他可以login。 成功login后,他获得一个Access-Token。 User可以创build一个Post 。 然后一个Post可以有Comment ,等等… User创build后不能删除。 (不是从我的NodeJS应用程序) 弗里斯比文档说的是,我应该在testing中写一个testing。 例如(full-test.spec.js): // Create User Test frisby.create('Create a `User`') .post('http://localhost/users', { … }, {json: true}) .expectStatus(200) .afterJSON(function (json) { // User Login Test frisby.create('Login `User`') .post('http://localhost/users/login', { … }, {json: true}) .expectStatus(200) .afterJSON(function (json) { // Another Test […]

hover在nightwatchjs中的链接

我一直在使用nightwatchjs,并总是点击元素。 有没有一种方法可以hover在链接或button上? 谢谢

如何检查一个元素是否与量angular器不可点击?

testing一个元素是否可以用量angular器点击是微不足道的,但我被困在我的脑海里试图弄清楚如何检查一个元素是不是可点击的。 我试图把try / catch中的click函数包装起来,这样当试图点击它的时候就会抛出一个错误,应该抓住它并让testing通过; 但是,这是行不通的。 这是我的代码检查方法: return this.shouldSeeDisabledFunds() .then(function() { var clickable = true; try { fundsElem.first().click(); } catch (e) { clickable = false; console.log(clickable); } finally { console.log(clickable); } console.log(clickable); // All the way through, clickable is still true, and the console log in the // catch is not called. I believe this is […]

CasperJS,并行浏览与testing框架

问题:我想知道是否有可能在一个脚本文件中使用testing框架进行并行浏览,所以使用tester模块和casperjstesting命令。 我见过一些人创build了两个casper实例: CasperJS同时请求和https://groups.google.com/forum/#!topic/casperjs/Scx4Cjqp7hE ,但正如文档中所述,我们不能创build新的casper实例在一个testing脚本。 所以我试着做一个类似的简单的例子 – 一个caspertesting脚本(只需复制并执行这个工作): var url1 = "http://casperjs.readthedocs.org/en/latest/testing.html" ,url2 = "http://casperjs.readthedocs.org/en/latest/testing.html" ; var casperActions = { process1: function () { casper.test.begin('\n********* First processus with our test suite : ***********\n', function suite(test) { "use strict"; casper.start() .thenOpen(url1,function(){ this.echo("1","INFO"); }); casper.wait(10000,function(){ casper.test.comment("If parallel, it won't be printed before comment of the second processus !"); […]

如何编写自己的CasperJS模块?

例如,我有一个经常需要执行的步骤,例如用户在一些testing之前login。 如何为CasperJS编写可重用的代码块? 他们扩展CasperJS的文档只写成一个文件。 谢谢!