我试过下面就设立backstop.jsCSS视觉Regession测试与BackdropJS - 无法运行咕噜:引用或咕噜:测试
https://joe-watkins.io/css-visual-regression-testing-with-grunt-backstopjs/
我跟所有的指示要求本教程链接。
但是我遇到了此问题在屏幕上。
[email protected] /c/backstop_test
$ grunt backstop:reference
Running "backstop:reference" (backstop) task
[12:16:30] Using gulpfile c:\backstop_test\bower_components\backstopjs\gulpfile.js
[12:16:30] Starting 'clean'...
bitmaps_reference was cleaned.
[12:16:30] Starting 'bless'...
[12:16:30] Finished 'clean' after 9.82 ms
[12:16:30] Finished 'bless' after 15 ms
[12:16:30] Starting 'reference'...
[12:16:30] Starting 'init'...
[12:16:30] Finished 'init' after 73 μs
[12:16:30] Starting 'test'...
Generating reference files.
[12:16:30] Finished 'test' after 4.03 ms
reference has run.
[12:16:30] Finished 'reference' after 5.24 ms
Testing script failed with code: 1
Looks like an error occured. You may want to try running `$ gulp echo`. This will echo the requested test URL output to the console. You can check this output to verify that the file requested is inde
ed being received in the expected format.
cp: cannot stat `./bitmaps_reference': No such file or directory
ERROR: Error: Command failed: C:\Windows\system32\cmd.exe /s /c "cp -rf ./bitmaps_reference c:\backstop_test\tests"
cp: cannot stat `./bitmaps_reference': No such file or directory
此前,有其中列明了gulp.run()
因此弃用它提示我需要使用另一个NPM模块执行顺序的任务,这使我这个额外的错误。
https://www.npmjs.com/package/run-sequence
,我设法解决它像这样
//under bower_components/gulp/tasks/reference.js
var gulp = require('gulp');
var runSequence = require('run-sequence').use(gulp);
//FIRST CLEAN REFERENCE DIR. THEN TEST
gulp.task('reference', ['clean','bless'], function() {
//gulp.run('test');
runSequence('test');
console.log('reference has run.');
});
它的工作原理。
但是,我仍然无法完成繁重/一饮而尽任务执行这样我真的坚持了这一点。
我不知道有任何人试图按照上述的教程链接和管理越来越backstopjs工作的成功吗?
您在此输入是极大的赞赏。
UPDATE
我忘了告诉你什么是我的呼噜声配置的设置是这样。
........................
grunt.initConfig({
backstop: {
setup: {
options : {
backstop_path: './bower_components/backstopjs',
test_path: './tests',
setup: false,
configure: true
}
},
test: {
options : {
backstop_path: './bower_components/backstopjs',
test_path: './tests',
create_references: false,
run_tests: true
}
},
reference: {
options : {
backstop_path: '/bower_components/backstopjs',
test_path: './tests',
create_references: true,
run_tests: false
}
}
}
});
......................etc
我backstop.json文件
{
"viewports": [
{
"name": "phone",
"width": 320,
"height": 480
},
{
"name": "tablet_v",
"width": 568,
"height": 1024
},
{
"name": "tablet_h",
"width": 1024,
"height": 768
}
],
"scenarios": [
{
"label": "http://getbootstrap.com",
"url": "http://getbootstrap.com",
"hideSelectors": [],
"removeSelectors": [
"#carbonads-container"
],
"selectors": [
"header",
"main",
"body .bs-docs-featurette:nth-of-type(1)",
"body .bs-docs-featurette:nth-of-type(2)",
"footer",
"body"
],
"readyEvent": null,
"delay": 500,
"misMatchThreshold" : 0.1
}
]
}
尝试在项目目录中运行'grunt'命令。这是一次性的事情。不保证它会工作,但给它一个镜头,它为我工作。作为一个方面说明,发生的事情是后台正在尝试生成新鲜的屏幕截图,因此它首先删除了参考屏幕截图目录,但未能生成新的屏幕截图。然后它会尝试将不存在的目录复制到测试文件夹以运行比较。 –
我之前运行过。这是npm runsequence修复之前的相同问题。但是,我没有提到我正在使用的操作系统环境。我在Windows机器上使用git Bash(不是linux或mac) – awongCM
刚发布它。 – awongCM