bbc / wraith

Wraith — A responsive screenshot comparison tool

Home Page:http://bbc-news.github.io/wraith/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nested folder structure breaks 'latest' command execution

alan-null opened this issue · comments

I am not sure if this scenario is supported, if not let's treat this as a feature-request.

How to reproduce:

  • Setup your path in a way that you get nested folders structure as an output .
paths:
  renderings/composites:
    path: /renderings/composites
  • run history
    docker run -P -v F:\docker:/wraithy -w='/wraithy' bbcnews/wraith history configs/history.yaml

  • run latest
    docker run -P -v F:\docker:/wraithy -w='/wraithy' bbcnews/wraith latest configs/history.yaml

Actual result:
Error, please see detail below
Folder structure created with history is fine. All screenshots are in correct place
Once I execute latest it will fetch images as well but something bad happens during cropping/comparing

Expected result:
No errors. I am able to use nested folder structure

Specification:
I am using wraith with docker (https://hub.docker.com/r/bbcnews/wraith/~/dockerfile/)
System: Windows 10 x64


Reporting a problem? Please describe the issue above, and complete the following checklist so that we can help you more quickly.

Issue checklist:

  • I have validated my config file against YAML Validator to make sure it is valid YAML.

  • I have run the wraith info command and pasted the output below:

DEBUG: #################################################
DEBUG:   Command run:        info
DEBUG:   Wraith version:     4.0.1
DEBUG:   Ruby version:       ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
DEBUG:   ImageMagick:        Version: ImageMagick 6.8.9-9 Q16 x86_64 2016-11-26 http://www.imagemagick.org
DEBUG:   PhantomJS version:  2.1.1
DEBUG:   CasperJS version:   1.1.1
DEBUG: #################################################
  • I have run the command in verbose mode (by adding verbose: true to my config) and pasted the output below:
DEBUG: #################################################
DEBUG:   Command run:        history configs/history.yaml
DEBUG:   Wraith version:     4.0.1
DEBUG:   Ruby version:       ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
DEBUG:   ImageMagick:        Version: ImageMagick 6.8.9-9 Q16 x86_64 2016-11-26 http://www.imagemagick.org
DEBUG:   PhantomJS version:  2.1.1
DEBUG:   CasperJS version:   1.1.1
DEBUG: #################################################
Config validated. No serious issues found.
Creating Folders
SAVING IMAGES
DEBUG: phantomjs  '/usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/javascript/phantom.js' 'http://10.0.75.1/renderings' '1280' 'shots/
renderings/MULTI_phantomjs_english.png' 'body' 'false' 'false'
DEBUG: phantomjs  '/usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/javascript/phantom.js' 'http://10.0.75.1/renderings/composites' '12
80' 'shots/renderings/composites/MULTI_phantomjs_english.png' 'body' 'false' 'false'
Loading http://10.0.75.1/renderings at dimensions: 1280x1500

Loading http://10.0.75.1/renderings/composites at dimensions: 1280x1500

Snapping http://10.0.75.1/renderings/composites at: 1280x1500

Snapping http://10.0.75.1/renderings at: 1280x1500

DEBUG: #################################################
DEBUG:   Command run:        latest configs/history.yaml
DEBUG:   Wraith version:     4.0.1
DEBUG:   Ruby version:       ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
DEBUG:   ImageMagick:        Version: ImageMagick 6.8.9-9 Q16 x86_64 2016-11-26 http://www.imagemagick.org
DEBUG:   PhantomJS version:  2.1.1
DEBUG:   CasperJS version:   1.1.1
DEBUG: #################################################
Config validated. No serious issues found.
SAVING IMAGES
DEBUG: phantomjs  '/usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/javascript/phantom.js' 'http://10.0.75.1/renderings' '1280' 'shots/
renderings/MULTI_phantomjs_english_latest.png' 'body' 'false' 'false'
DEBUG: phantomjs  '/usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/javascript/phantom.js' 'http://10.0.75.1/renderings/composites' '12
80' 'shots/renderings/composites/MULTI_phantomjs_english_latest.png' 'body' 'false' 'false'
Loading http://10.0.75.1/renderings/composites at dimensions: 1280x1500

Loading http://10.0.75.1/renderings at dimensions: 1280x1500

Snapping http://10.0.75.1/renderings/composites at: 1280x1500

Snapping http://10.0.75.1/renderings at: 1280x1500

COPYING BASE IMAGES
Copying shots_base/renderings to shots
Copying shots_base/renderings/composites to shots
CROPPING IMAGES
DEBUG: Both images are exactly 1280x1500 - no cropping required. (shots/composites/MULTI_phantomjs_english.png, shots/renderings/MULTI_phantomjs_e
nglish.png)
/usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/crop.rb:48:in `initialize': no implicit conversion of nil into String (TypeError)
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/crop.rb:48:in `open'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/crop.rb:48:in `image_dimensions'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/crop.rb:26:in `crop_if_necessary'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/crop.rb:19:in `block in crop_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:464:in `call'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:464:in `call_with_index'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:433:in `process_incoming_jobs'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:415:in `block in worker'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:406:in `fork'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:406:in `worker'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:397:in `block in create_workers'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:396:in `each'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:396:in `each_with_index'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:396:in `create_workers'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:338:in `work_in_processes'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:252:in `map'
        from /usr/local/lib/ruby/gems/2.1.0/gems/parallel-1.10.0/lib/parallel.rb:214:in `each'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/crop.rb:18:in `crop_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/cli.rb:87:in `block in crop_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/cli.rb:84:in `crop_images'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/cli.rb:160:in `block in latest'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/lib/wraith/cli.rb:155:in `latest'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /usr/local/lib/ruby/gems/2.1.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from /usr/local/lib/ruby/gems/2.1.0/gems/wraith-4.0.1/bin/wraith:5:in `<top (required)>'
        from /usr/local/bin/wraith:23:in `load'
        from /usr/local/bin/wraith:23:in `<main>'
  • I have pasted the contents of my config file below:
browser: "phantomjs"
domains:
  english: "http://10.0.75.1"
paths:
  renderings:
    path: /renderings
  renderings/composites:
    path: /renderings/composites
screen_widths:
  - 1280

resize_or_reload: 'resize'
history_dir: 'shots_base'
directory: 'shots'
fuzz: '20%'
threshold: 5
gallery:
  template: 'slideshow_template'
  thumb_width:  200
  thumb_height: 200

mode: diffs_first
verbose: true
highlight_color: red
phantomjs_options: ''

I have the same problem on OSX. Not using nested directories solved it for me. Thanks for pointing out the answer.

This should now be fixed in v4.2.3.