问题是我如何才能进行循环,如何才能得到这样的好结果94大桶还可以,这三个不起作用。
var urls = [
'http://www.testify/page1',
'http://www.testify/page2'
];
module.exports = {
'validate some url': function (test) {
test.open('http://www.testify/page1')
.wait(500)
.assert.title().is.not('Die Seite wurde leider nicht gefunden')
.assert.url('http://www.testify/page1', 'URL is as expected')
.assert.numberOfElements('.product').is.gt(0, 'There are more than 0 products')
.done();
},
};
很高兴看到您自己找到了这个问题的答案。如果有人再次偶然发现这个问题,这将是您初始代码片段所需的代码:
var urls = [
'http://www.testify/page1',
'http://www.testify/page2'
];
module.exports = {
'validate some url': function (test) {
urls.forEach(function (url) {
test.open(url)
.wait(500)
.assert.title().is.not('Die Seite wurde leider nicht gefunden')
.assert.url(url, 'URL is as expected')
.assert.numberOfElements('.product').is.gt(0, 'There are more than 0 products')
});
test.done();
}
};
module.exports = {
'A lot of screenshots': function (test) {
var resolutions = [{width: 1280, height: 1024}, {width: 1024, height: 768}, {width: 800, height: 600}];
var pages = ['http://facebook.com', 'http://twitter.com', 'http://dalekjs.com'];
resolutions.forEach(function (res) {
pages.forEach(function (page) {
test.open(page)
.resize(res)
.screenshot('pics/' + res.width + '_' + res.height + '_' + page.replace('http://', '') + '.png')
});
});
test.done();
}
}