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

Error generating gallery

charu-jain opened this issue · comments

I am trying process with my local directory. Process works fine till generation of thumbnails but Gallery is not generating.

Filenames:
Home_1Dec-win8.1-ie-11.0.png
Home_2Dec-win8.1-ie-11.0.png
Home_1Dec-win8.1-ie-11.diff
Home_1Dec-win8.1-ie-11.data

wraith 4.0.0
ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]

C:\wraith>wraith generate_gallery config
GENERATING GALLERY
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:63:in `figure_out_url': undefined method `[]' for nil:NilClass (NoMethodError)
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:53:in `matcher'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:40:in `block (2 levels) in match'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:38:in `foreach'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:38:in `block in match'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:35:in `each'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:35:in `match'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:31:in `parse_directories'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:142:in `generate_gallery'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/cli.rb:114:in `block in generate_gallery'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/cli.rb:111:in `generate_gallery'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/bin/wraith:5:in `<top (required)>'
        from C:/Ruby23-x64/bin/wraith:22:in `load'
        from C:/Ruby23-x64/bin/wraith:22:in `<main>

my config file below:

#phantomjs_options: --ssl-protocol=tlsv1

# (required) The domains to take screenshots of.
#domains:
#  dev: "http://dev.upf.sites.capitalnumbers.com"
#  live: "https://theupsstorefranchise.com"

# (required) The paths to capture. All paths should exist for both of the domains specified above.
#paths:
#  home:     /

# Type the name of the directory that shots will be stored in
directory: 'abc/win8.1-ie-11.0'

#Type screen widths below, here are a couple of examples
#screen_widths:
#  - 320

#Amount of fuzz ImageMagick will use
fuzz: '20%'

#Choose how results are displayed, by default alphanumeric. Different screen width are always grouped.
#alphanumeric - all paths (with, and without, a difference) are shown, sorted by path
#diffs_first - all paths (with, and without, a difference) are shown, sorted by difference size (largest first)
#diffs_only - only paths with a difference are shown, sorted by difference size (largest first)
mode: alphanumeric
verbose: true
threshold: 15

That is because wraith.domains is undefined (https://github.com/BBC-News/wraith/blob/master/lib/wraith/gallery.rb#L63)

If your YAML file does look like this, then domains is indeed undefined, because the # comments it out.

# (required) The domains to take screenshots of.
#domains:
#  dev: "http://dev.upf.sites.capitalnumbers.com"
#  live: "https://theupsstorefranchise.com"

Try removing the # from your config, i.e.

# (required) The domains to take screenshots of.
domains:
  dev: "http://dev.upf.sites.capitalnumbers.com"
  live: "https://theupsstorefranchise.com"

(and do the same everywhere else you have a # commenting a property out.

Did it. Still getting following error

C:\wraith>wraith generate_gallery config
GENERATING GALLERY
(erb):38:in `block (2 levels) in get_binding': undefined method `>' for nil:NilClass (NoMethodError)
        from (erb):32:in `each'
        from (erb):32:in `block in get_binding'
        from (erb):31:in `each'
        from (erb):31:in `get_binding'
        from C:/Ruby23-x64/lib/ruby/2.3.0/erb.rb:864:in `eval'
        from C:/Ruby23-x64/lib/ruby/2.3.0/erb.rb:864:in `result'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:158:in `generate_html'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/gallery.rb:145:in `generate_gallery'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/cli.rb:114:in `block in generate_gallery'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/helpers/utilities.rb:4:in `within_acceptable_limits'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/lib/wraith/cli.rb:111:in `generate_gallery'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wraith-4.0.0/bin/wraith:5:in `<top (required)>'
        from C:/Ruby23-x64/bin/wraith:22:in `load'
        from C:/Ruby23-x64/bin/wraith:22:in `<main>' 

I'm not sure how those filenames are getting generated?

Home_1Dec-win8.1-ie-11.0.png
Home_2Dec-win8.1-ie-11.0.png
Home_1Dec-win8.1-ie-11.diff
Home_1Dec-win8.1-ie-11.data

Wraith only supports Phantom and Casper out of the box, so I'd expect to see Home_1Dec-phantom.png, for example. How did you get it using IE 11?

I think the problem stems from the . in win8.1.

If you're naming them manually, try using filenames without . and - in them.

Yeah.. I am working with local image folders & so giving names manually. I just tried out commands crop_images, compare_images, generate_thumbnails & then generate_gallery on these folders. Now it works for filenames without . & - in them + commenting out domain property [though i didn't get why do we need domains!!!!]. Gallery generated successfully. Thanks.