2015-06-15 42 views
0

我試過下面就設立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 
    } 
    ] 
} 
+0

嘗試在項目目錄中運行'grunt'命令。這是一次性的事情。不保證它會工作,但給它一個鏡頭,它爲我工作。作爲一個方面說明,發生的事情是後臺正在嘗試生成新鮮的屏幕截圖,因此它首先刪除了參考屏幕截圖目錄,但未能生成新的屏幕截圖。然後它會嘗試將不存在的目錄複製到測試文件夾以運行比較。 –

+0

我之前運行過。這是npm runsequence修復之前的相同問題。但是,我沒有提到我正在使用的操作系統環境。我在Windows機器上使用git Bash(不是linux或mac) – awongCM

+0

剛發佈它。 – awongCM

回答

0

我設法昨晚的工作,當我到我的Linux機器(VMWare的版本),重做backstopjs建立和成功地執行一些測試運行。

我的確有我的原始懷疑是我的Window OS環境沒有正確設置,所以我可能不得不重新安裝npm/node/backstop等,並從那裏解決它。

現在都好。