1

tl; dr; 4 * 3 = 12 개 테스트와

페이지로드에 대한 시간 초과를 늘리는 방법은 무엇입니까?

const http = require('http'); 

const hostname = '0.0.0.0'; 
const port = 3000; 

http.createServer((req, res) => { 
    res.statusCode = 200; 
    res.setHeader('Content-Type', 'text/html'); 
    res.end(`<!DOCTYPE html> 
    <title>Test Page</title> 
    <script>console.log("Hello world!")</script> 
    <h1>Hello world!</h1> 
    `); 
}).listen(port, hostname,() => { 
    console.log(`Server running at http://${hostname}:${port}/`); 
}); 

및 BackstopJS 구성 :

{ 
    "id": "backstop_default", 
    "viewports": [ 
    { "label": "phone_portrait",  "width": 320, "height": 480 }, 
    { "label": "phone_landscape", "width": 480, "height": 320 }, 
    { "label": "tablet_portrait", "width": 768, "height": 1024 }, 
    { "label": "tablet_landscape", "width": 1024, "height": 768 } 
    ], 
    "scenarios": [ 
    { "label": "Test #1", "url": "http://localhost:3000/", "selectors": ["body"] }, 
    { "label": "Test #2", "url": "http://localhost:3000/", "selectors": ["body"] }, 
    { "label": "Test #3", "url": "http://localhost:3000/", "selectors": ["body"] } 
    ], 
    "paths": { 
    "bitmaps_reference": "backstop_data/bitmaps_reference", 
    "bitmaps_test": "backstop_data/bitmaps_test", 
    "engine_scripts": "backstop_data/engine_scripts", 
    "html_report": "backstop_data/html_report", 
    "ci_report": "backstop_data/ci_report" 
    }, 
    "report": ["browser"], 
    "engine": "chrome", 
    "engineFlags": [] 
} 

COMMAND | Command `test` ended with an error after [32.585s]
COMMAND | BackstopExcpetion: Test #1 on undefined: GotoTimeoutError: goto() timeout


는 서버 코드 다음 고려 :

나는이 제한 시간을 늘려야합니다

시작하면 backstop test은, 모든 작동합니다 :

D:\Temp\Supertemp\server-delay>backstop test 
BackstopJS v3.0.22 
Loading config: D:\Temp\Supertemp\server-delay\backstop.json 

COMMAND | Executing core for `test` 
createBitmaps | Selcted 3 of 3 scenarios. 
Starting Chromy: port:9222 --disable-gpu,--force-device-scale-factor=1,--window-size=320,480 
Starting Chromy: port:9223 --disable-gpu,--force-device-scale-factor=1,--window-size=480,320 
Starting Chromy: port:9224 --disable-gpu,--force-device-scale-factor=1,--window-size=768,1024 
Starting Chromy: port:9225 --disable-gpu,--force-device-scale-factor=1,--window-size=1024,768 
Starting Chromy: port:9226 --disable-gpu,--force-device-scale-factor=1,--window-size=320,480 
Starting Chromy: port:9227 --disable-gpu,--force-device-scale-factor=1,--window-size=480,320 
Starting Chromy: port:9228 --disable-gpu,--force-device-scale-factor=1,--window-size=768,1024 
Starting Chromy: port:9229 --disable-gpu,--force-device-scale-factor=1,--window-size=1024,768 
Starting Chromy: port:9230 --disable-gpu,--force-device-scale-factor=1,--window-size=320,480 
Starting Chromy: port:9231 --disable-gpu,--force-device-scale-factor=1,--window-size=480,320 
9224 LOG > Hello world! 
9227 LOG > Hello world! 
9226 LOG > Hello world! 
9222 LOG > Hello world! 
9223 LOG > Hello world! 
9225 LOG > Hello world! 
9228 LOG > Hello world! 
9231 LOG > Hello world! 
9229 LOG > Hello world! 
9230 LOG > Hello world! 
Starting Chromy: port:9232 --disable-gpu,--force-device-scale-factor=1,--window-size=768,1024 
Starting Chromy: port:9233 --disable-gpu,--force-device-scale-factor=1,--window-size=1024,768 
9232 LOG > Hello world! 
9233 LOG > Hello world! 
     COMMAND | Executing core for `report` 
     compare | OK: Test #1 backstop_default_Test_1_0_body_0_phone_portrait.png 
     compare | OK: Test #1 backstop_default_Test_1_0_body_1_phone_landscape.png 
     compare | OK: Test #1 backstop_default_Test_1_0_body_2_tablet_portrait.png 
     compare | OK: Test #1 backstop_default_Test_1_0_body_3_tablet_landscape.png 
     compare | OK: Test #2 backstop_default_Test_2_0_body_0_phone_portrait.png 
     compare | OK: Test #2 backstop_default_Test_2_0_body_1_phone_landscape.png 
     compare | OK: Test #2 backstop_default_Test_2_0_body_2_tablet_portrait.png 
     compare | OK: Test #2 backstop_default_Test_2_0_body_3_tablet_landscape.png 
     compare | OK: Test #3 backstop_default_Test_3_0_body_0_phone_portrait.png 
     compare | OK: Test #3 backstop_default_Test_3_0_body_1_phone_landscape.png 
     compare | OK: Test #3 backstop_default_Test_3_0_body_2_tablet_portrait.png 
     compare | OK: Test #3 backstop_default_Test_3_0_body_3_tablet_landscape.png 
     report | Test completed... 
     report | 12 Passed 
     report | 0 Failed 
     report | Writing browser report 
     report | Browser reported copied 
     report | Copied configuration to: D:\Temp\Supertemp\server-delay\backstop_data\html_report\config.js 
     COMMAND | Executing core for `openReport` 
    openReport | Opening report. 
     COMMAND | Command `openReport` sucessfully executed in [0.114s] 
     COMMAND | Command `report` sucessfully executed in [0.182s] 
     COMMAND | Command `test` sucessfully executed in [8.495s] 

하지만 지금의이 페이지 보내기 전에 서버 지연 40 초 만들어 보자 :

const http = require('http'); 

const hostname = '0.0.0.0'; 
const port = 3000; 

http.createServer((req, res) => { 
    setTimeout(() => { 
    res.statusCode = 200; 
    res.setHeader('Content-Type', 'text/html'); 
    res.end(`<!DOCTYPE html> 
     <title>Test Page</title> 
     <script>console.log("Hello world!")</script> 
     <h1>Hello world!</h1> 
    `); 
    }, 40000); 
}).listen(port, hostname,() => { 
    console.log(`Server running at http://${hostname}:${port}/`); 
}); 

backstop test 실행,

D:\Temp\Supertemp\server-delay>backstop test 
BackstopJS v3.0.22 
Loading config: D:\Temp\Supertemp\server-delay\backstop.json 

COMMAND | Executing core for `test` 
createBitmaps | Selcted 3 of 3 scenarios. 
Starting Chromy: port:9222 --disable-gpu,--force-device-scale-factor=1,--window-size=320,480 
Starting Chromy: port:9223 --disable-gpu,--force-device-scale-factor=1,--window-size=480,320 
Starting Chromy: port:9224 --disable-gpu,--force-device-scale-factor=1,--window-size=768,1024 
Starting Chromy: port:9225 --disable-gpu,--force-device-scale-factor=1,--window-size=1024,768 
Starting Chromy: port:9226 --disable-gpu,--force-device-scale-factor=1,--window-size=320,480 
Starting Chromy: port:9227 --disable-gpu,--force-device-scale-factor=1,--window-size=480,320 
Starting Chromy: port:9228 --disable-gpu,--force-device-scale-factor=1,--window-size=768,1024 
Starting Chromy: port:9229 --disable-gpu,--force-device-scale-factor=1,--window-size=1024,768 
Starting Chromy: port:9230 --disable-gpu,--force-device-scale-factor=1,--window-size=320,480 
Starting Chromy: port:9231 --disable-gpu,--force-device-scale-factor=1,--window-size=480,320 
     COMMAND | Command `test` ended with an error after [32.585s] 
     COMMAND | BackstopExcpetion: Test #1 on undefined: GotoTimeoutError: goto() timeout 
9230 LOG > Hello world! 
9228 LOG > Hello world! 
9222 LOG > Hello world! 
9224 LOG > Hello world! 
9227 LOG > Hello world! 
9231 LOG > Hello world! 
9223 LOG > Hello world! 
9225 LOG > Hello world! 
9229 LOG > Hello world! 
9226 LOG > Hello world! 

보시다시피이 오류

COMMAND | Command `test` ended with an error after [32.585s]
COMMAND | BackstopExcpetion: Test #1 on undefined: GotoTimeoutError: goto() timeout

하지만 그 후에는 console.log 페이지에서 실행 된 것을 볼 수 있습니다. 백스톱은 무언가를 기다리는 무한한 시작 ... 어쨌든, 그것은 질문이 아닙니다.

dev 서버가 콘텐츠를 제공하는 데 더 많은 시간이 필요한 경우처럼 30 초의 시간 초과를 확대하는 옵션에 관심이 있습니다. 어떻게 구성 할 수 있습니까? an onBeforeScript에서

+0

혹시이 문제를 해결하기위한 방안을 찾으셨습니까을? 나는 같은 문제가있다. – seth

+0

@seth, 불행히도 없습니다. 다른 방법으로 문제를 해결했습니다. 테스트 명령과 개발자 버전이 다른 comupetrs에서 시작된 경우 시간 초과가 발생했습니다. 그래서 나는 똑같은 컴퓨터에서 찌그러진 버전을 시험해보고 30 초 만에 충분 해졌다. 제 생각에, 당신은 consequtive 테스트의 수를 제한하려고 시도 할 수 있습니다 (더 많은 네트워크 brandwidth를 제공하기 위해) 또는 컴파일 된 버전으로 컴파일하십시오. 그런데, 당신이 백스톱을 사용한다면, 그것에 관한 나의 다른 질문을 좀 볼 수 있겠습니까? – Qwertiy

+1

@seth, 대답을 참조하십시오! – Qwertiy

답변

2

, 당신은 어떤 요청이 발행되기 전에 Chromy 액세스 타임 아웃 (및 other options)을 설정할 수 있습니다 :

module.exports = function (chromy) { 
    chromy.options.gotoTimeout = 60000; 
}; 
+0

좋아요! ' "onBeforeScript": "./chromy/onBefore.js",'이 코드를 기본 설정의 경우'backstop_data/engine_scripts/chromy/onBefore.js'에 넣습니다. – Qwertiy