gpt4 book ai didi

javascript - dalek 回调或自定义函数

转载 作者:行者123 更新时间:2023-11-28 07:29:46 25 4
gpt4 key购买 nike

我正在使用戴利克。我想在创建屏幕截图后使用自定义功能。示例:

var fs = require('fs');
module.exports = {
'Amazon does its thing': function (test) {
test['open']('http://ya.ru/');
test.type('#text', "xddfg")
.screenshot(':date/homepage.png', function(data){console.log(data);})
.done();
}
};

我如何关心自定义功能?现在,当我在完成()之后编写代码时,此代码在示例中执行:

     var fs = require('fs');
module.exports = {
'Amazon does its thing': function (test) {
test['open']('http://ya.ru/');
test.type('#text', "xddfg")
.screenshot(':date/homepage.png')
.done();
console.log(11111111111);
}
};

Running tests
Running Browser: PhantomJS
11111111111
OS: windows 7 32bit
Browser Version: 1.9.8

RUNNING TEST - "Amazon does its thing"
> OPEN http://ya.ru/
> TYPE #text
> SCREENSHOT 2015-03-25/homepage.png
* 0 Assertions run
* TEST - "Amazon does its thing" SUCCEEDED

0/0 assertions passed. Elapsed Time: 3.4 sec

如何创建回调函数?

谢谢!

最佳答案

我找到了怎么做。以下代码在每个完成后运行()

module.exports = {
options: {
setup: function () {
console.log('setup');
},
teardown: function () {
console.log('teardown');
},
beforeEach: function () {
console.log('beforeEach');
},
afterEach: function () {
console.log('afterEach');
},
}

关于javascript - dalek 回调或自定义函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29252595/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com