Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wraith fails on any URL containing "path", eg "/some-path" #536

Open
4 tasks done
fofr opened this issue Aug 22, 2017 · 2 comments · May be fixed by #582
Open
4 tasks done

Wraith fails on any URL containing "path", eg "/some-path" #536

fofr opened this issue Aug 22, 2017 · 2 comments · May be fixed by #582

Comments

@fofr
Copy link

fofr commented Aug 22, 2017

(This is using Wraith 4.0.1 on Ruby 2.3.1)

Any path in the config that contains the string "path" doesn't load correctly.

Found when trying to do a comparison of the valid URL:
https://www.gov.uk/drug-safety-update/corticosteroids-rare-risk-of-central-serous-chorioretinopathy-with-local-as-well-as-systemic-administration

Wraith was requesting:
https://www.gov.ukpath

It seems to error on anything containing the word "path", eg "/some-path"

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:

wraith info returns an error:

bundle exec wraith info
/usr/lib/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/rubygems_integration.rb:351:in `block (2 levels) in replace_gem': casperjs is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
	from /usr/lib/rbenv/versions/2.3.1/bin/casperjs:22:in `<main>'
bundler: failed to load command: wraith (/usr/lib/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bin/wraith)
NoMethodError: undefined method `chomp' for nil:NilClass
  /usr/lib/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/wraith-4.0.1/lib/wraith/helpers/utilities.rb:56:in `run_command_safely'
  /usr/lib/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/wraith-4.0.1/lib/wraith/helpers/utilities.rb:36:in `list_debug_information'
  • I have run the command in verbose mode (by adding verbose: true to my config) and pasted the output below:
Config validated. No serious issues found.
Creating Folders
SAVING IMAGES
Loading https://government-frontend.herokuapp.compath at dimensions: 320x5000

Loading https://www.gov.ukpath at dimensions: 320x5000

Error with page https://government-frontend.herokuapp.compath

Error with page https://www.gov.ukpath

CROPPING IMAGES
COMPARING IMAGES
GENERATING THUMBNAILS
GENERATING GALLERY
bundler: failed to load command: wraith (/usr/lib/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bin/wraith)
NoMethodError: undefined method `[]' for nil:NilClass
  /usr/lib/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/wraith-4.0.1/lib/wraith/gallery.rb:124:in `block in sort_by_diffs'
  /usr/lib/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/wraith-4.0.1/lib/wraith/gallery.rb:122:in `each'
  • I have pasted the contents of my config file below:
---
browser: phantomjs
phantomjs_options: "--ignore-ssl-errors=true --ssl-protocol=tlsv1"
domains:
  production: https://www.gov.uk
  local: https://government-frontend.herokuapp.com
paths:
  drug_safety_update_2: "/drug-safety-update/corticosteroids-rare-risk-of-central-serous-chorioretinopathy-with-local-as-well-as-systemic-administration"
screen_widths:
- 320x5000
- 600x4000
- 1080x3000
resize_or_reload: resize
directory: shots
fuzz: 20%
threshold: 5
gallery:
  thumb_width: 200
  thumb_height: 200
mode: diffs_first
verbose: false
fofr added a commit to alphagov/government-frontend that referenced this issue Aug 23, 2017
Paths containing "path" in them break Wraith:
bbc/wraith#536

Search API incorrectly returns government-frontend as renderer for
travel advice index, this will always give a difference between live
and a review app.
fofr added a commit to alphagov/govuk-visual-regression that referenced this issue Sep 11, 2017
fofr added a commit to alphagov/government-frontend that referenced this issue Sep 13, 2017
Paths containing "path" in them break Wraith:
bbc/wraith#536

Search API incorrectly returns government-frontend as renderer for
travel advice index, this will always give a difference between live
and a review app.
@stevenday
Copy link

This is an old issue, so you've probably worked around it by now, but just for future reference because I came across it this morning and was a bit stumped. I think it's this line that causes a problem:

https://github.com/BBC-News/wraith/blob/7adfb1b365a913e46b9b6be408ef8f06185e0f20/lib/wraith/helpers/capture_options.rb#L50

You can work around it by swapping something like:

paths:
  some_page: /page?path=xyz

to:

paths:
  some_page:
    path: /page?path=xyz

@stevenday
Copy link

I guess the ruby code should check options is a hash, otherwise you're potentially using the string's [] method which (TIL) accepts a match_str param: https://ruby-doc.org/core-2.3.0/String.html#method-i-5B-5D

stevenday pushed a commit to CityScience/wraith that referenced this issue Sep 6, 2018
@stevenday stevenday linked a pull request Sep 6, 2018 that will close this issue
stevenday pushed a commit to CityScience/wraith that referenced this issue Sep 7, 2018
To match the changes to CaptureOptions.

For bbc#536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants