Skip to content

Commit

Permalink
Blacklist paths that aren't useful in visual regression
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fofr committed Sep 13, 2017
1 parent 2dd4888 commit 16e5dc3
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/helpers/wraith_config_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ def build_paths
if @paths.is_a? Hash
@paths.keys.each do |key|
@paths.fetch(key).each_with_index do |path, index|
config_paths[path_index(key, index + 1)] = path
config_paths[path_index(key, index + 1)] = path unless path_blacklisted?(path)
end
end
else
@paths.each_with_index { |path, index| config_paths[path_index(name, index + 1)] = path }
@paths.each_with_index do |path, index|
config_paths[path_index(name, index + 1)] = path unless path_blacklisted?(path)
end
end

config_paths
Expand All @@ -43,6 +45,19 @@ def path_index(prefix, index)
"#{prefix}_#{index}"
end

# Remove paths that aren't useful
#
# TODO: Remove when Wraith patched
# Paths containing "path" in them break Wraith:
# https://github.com/BBC-News/wraith/issues/536
#
# TODO: Remove when Search API no longer returns
# Search API incorrectly returns government-frontend as
# renderer for travel advice index
def path_blacklisted?(path)
path.include?('path') || path == "/foreign-travel-advice"
end

def write_config(config)
file_name = OUTPUT_PATH % { suffix: @name }
File.open(file_name, 'w') { |f| f.write config.to_yaml }
Expand Down

0 comments on commit 16e5dc3

Please sign in to comment.