mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 12:23:35 -05:00
improve debugging of failed acceptance tests
use the example name in the output filename
This commit is contained in:
parent
d123f8eb64
commit
d09cbfaa8d
1 changed files with 4 additions and 2 deletions
|
@ -16,11 +16,13 @@ convertToPng = (pdfPath, pngPath, callback = (error) ->) ->
|
||||||
callback()
|
callback()
|
||||||
|
|
||||||
compare = (originalPath, generatedPath, callback = (error, same) ->) ->
|
compare = (originalPath, generatedPath, callback = (error, same) ->) ->
|
||||||
proc = ChildProcess.exec "compare -metric mae #{fixturePath(originalPath)} #{fixturePath(generatedPath)} #{fixturePath("tmp/diff.png")}"
|
diff_file = "#{fixturePath(generatedPath)}-diff.png"
|
||||||
|
proc = ChildProcess.exec "compare -metric mae #{fixturePath(originalPath)} #{fixturePath(generatedPath)} #{diff_file}"
|
||||||
stderr = ""
|
stderr = ""
|
||||||
proc.stderr.on "data", (chunk) -> stderr += chunk
|
proc.stderr.on "data", (chunk) -> stderr += chunk
|
||||||
proc.on "exit", () ->
|
proc.on "exit", () ->
|
||||||
if stderr.trim() == "0 (0)"
|
if stderr.trim() == "0 (0)"
|
||||||
|
fs.unlink diff_file # remove output diff if test matches expected image
|
||||||
callback null, true
|
callback null, true
|
||||||
else
|
else
|
||||||
console.log "compare result", stderr
|
console.log "compare result", stderr
|
||||||
|
@ -68,7 +70,7 @@ describe "Example Documents", ->
|
||||||
do (example_dir) ->
|
do (example_dir) ->
|
||||||
describe example_dir, ->
|
describe example_dir, ->
|
||||||
before ->
|
before ->
|
||||||
@project_id = Client.randomId()
|
@project_id = Client.randomId() + "_" + example_dir
|
||||||
|
|
||||||
it "should generate the correct pdf", (done) ->
|
it "should generate the correct pdf", (done) ->
|
||||||
Client.compileDirectory @project_id, fixturePath("examples"), example_dir, 4242, (error, res, body) =>
|
Client.compileDirectory @project_id, fixturePath("examples"), example_dir, 4242, (error, res, body) =>
|
||||||
|
|
Loading…
Reference in a new issue