This repository has been archived by the owner on May 6, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spider component guide, run vr against previews
We can’t easily get a list of URLs for a component guide. Instead use the wraith spider feature and crawl the review domain’s component guide. Exclude paths that don’t start with /component-guide and only compare paths that end with `/preview` to limit the number of pages and speed up the test run. * Include rake tasks for running locally * Use Heroku runner in app
- Loading branch information
Showing
12 changed files
with
108 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
results/visual | ||
config/tmp* | ||
config/spider_paths* | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'yaml' | ||
|
||
module GovukVisualRegression | ||
module VisualDiff | ||
module SpiderPaths | ||
def self.paths | ||
YAML.load_file(GovukVisualRegression.spider_paths)['paths'] | ||
end | ||
|
||
# Only test component previews, not the guide itself | ||
def self.component_preview_paths | ||
paths.values.select { |v| v.match(/preview$/) } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
lib/govuk_visual_regression/visual_diff/wraith_spider_component_guide_config.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module GovukVisualRegression | ||
module VisualDiff | ||
class WraithSpiderComponentGuideConfig < WraithConfig | ||
def config | ||
config = YAML.load_file(GovukVisualRegression.wraith_config_template) | ||
config["domains"].delete("live") | ||
config["domains"]["review"] = "#{review_domain}/component-guide" if review_domain | ||
|
||
# http://bbc-news.github.io/wraith/#Spiderfunctionality | ||
config["imports"] = "spider_paths.yml" | ||
|
||
# Skip pages that don't begin with /component-guide | ||
config["spider_skips"] = [/^\/(?!component\-guide)/] | ||
config.delete("paths") | ||
config | ||
end | ||
|
||
def temporary_config_file_name | ||
"tmp_wraith_spider_component_guide_config.yaml" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters