wraith 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +2 -2
- data/README.md +7 -44
- data/lib/wraith/cli.rb +5 -5
- data/lib/wraith/gallery.rb +7 -2
- data/lib/wraith/gallery_template/gallery_template.erb +1 -2
- data/lib/wraith/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b1ef3f4e6afe88d801486999230f8f3284d57ec
|
4
|
+
data.tar.gz: e4635f5a2433c7951cf2ce13374cfb37f9d6a47c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2e3b5f04d9387bfdc9877bc58e7a5769bd0f261a2e23a68a02f6a1a95555761bd85b83283a3015c49bcc2cf7ab324cd0ad2eef8d6da65359ab38c00d8fdcd57
|
7
|
+
data.tar.gz: 32ba015605d4b92c53da0f70efbb72e37ee45cc43665512d48a75670636135a541d6ed63fdd9fd1ad4a9f3b5616ca1a1766f06fee988ce96071aa516b092e50d
|
data/Dockerfile
CHANGED
@@ -3,9 +3,9 @@ FROM ruby:2.1.2
|
|
3
3
|
# some of ruby's build scripts are written in ruby
|
4
4
|
# we purge this later to make sure our final image uses what we just built
|
5
5
|
RUN apt-get update
|
6
|
-
RUN curl -o phantomjs.tar.gz -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.
|
6
|
+
RUN curl -o phantomjs.tar.gz -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
|
7
7
|
RUN tar -xvf phantomjs.tar.gz
|
8
|
-
RUN mv phantomjs-1.9.
|
8
|
+
RUN mv phantomjs-1.9.8-linux-x86_64/bin/phantomjs /usr/bin
|
9
9
|
RUN echo "export phantomjs=/usr/bin/phantomjs" > .bashrc
|
10
10
|
RUN apt-get install -y libfreetype6 libfontconfig1
|
11
11
|
RUN gem install wraith --no-rdoc --no-ri
|
data/README.md
CHANGED
@@ -19,6 +19,10 @@ blue
|
|
19
19
|
![Photo of BBC News with a
|
20
20
|
diff](http://bbc-news.github.io/wraith/img/wraith.png)
|
21
21
|
|
22
|
+
## Documentation
|
23
|
+
|
24
|
+
[The main documentation can be found here, this will cover all the features and options for Wraith as well as sample configs.](http://bbc-news.github.io/wraith/index.html)
|
25
|
+
|
22
26
|
|
23
27
|
## Requirements
|
24
28
|
|
@@ -39,12 +43,6 @@ You can then run the following to create a template snap.js and config file:
|
|
39
43
|
|
40
44
|
wraith setup
|
41
45
|
|
42
|
-
Alternatively you can clone the repo.
|
43
|
-
|
44
|
-
git clone https://github.com/BBC-News/wraith
|
45
|
-
cd wraith
|
46
|
-
bundle install
|
47
|
-
|
48
46
|
## Using Wraith
|
49
47
|
You can type `wraith` into terminal to bring up the list of commands, but the one to start Wraith is
|
50
48
|
|
@@ -84,45 +82,10 @@ After each screenshot is captured, the compare task will run, this will output a
|
|
84
82
|
|
85
83
|
## Gallery
|
86
84
|
|
87
|
-
A gallery is available to view each of the images and the respective diff images located in the shots folder once all the images have been compared.
|
88
|
-
|
89
|
-
## CasperJS
|
90
|
-
|
91
|
-
There is an example [component config file](https://github.com/BBC-News/wraith/blob/master/configs/component.yaml) which indicates how to target a specific selector on a page. Pass in a label for the shot, path and selector. This will be handed to CasperJS and will only screenshot that component on the page. This is faster way to verify smaller changes to specific components during development. You must install [CasperJS](http://casperjs.org/) to use.
|
92
|
-
|
93
|
-
For a quick setup for CasperJS, you can run :
|
94
|
-
|
95
|
-
```sh
|
96
|
-
wraith setup_casper
|
97
|
-
```
|
98
|
-
|
99
|
-
## History usage
|
100
|
-
|
101
|
-
In Wraith 2.0 we introduced a new way for using Wraith in development and testing, historical shots. Rather than capture 2 domains, you capture 1 domain, probably your local copy of the latest code, then later on after development is in progress, run Wraith again to compare. This makes working against an isolated dev environment much easier as you wont need an internet connection.
|
102
|
-
|
103
|
-
The usage is different in that you need 1 domain in your config and you will need to set a historical shots folder. You will need to specify a `history_dir` in addition to the `directory` key in your `config.yml` file. An example of this can be found in the [`history.yaml`](https://github.com/BBC-News/wraith/blob/31406956bfc465d087f1d40304630e18dc0f857e/configs/history.yaml#L9-L11) file of the `configs` directory of this repository. The way this works is that shots are captured as normal with the history command below. This will create 2 folders with the labels you have specified in the config file, for example, shots and shots_history. The original shots will be copied into your 'history' folder, then copied back into the shots folder once you have run your latest job. This workflow will essentially mean your history folder is your baseline, being copied back into the shots folder every time you run the 'latest command'
|
104
|
-
|
105
|
-
```sh
|
106
|
-
wraith history history.yaml
|
107
|
-
```
|
108
|
-
After some development, run the latest command
|
109
|
-
```sh
|
110
|
-
wraith latest history.yaml
|
111
|
-
```
|
112
|
-
You will now be able to run the latest command over and over without having to do clear up.
|
113
|
-
|
114
|
-
## Docker
|
115
|
-
At BBC, we use Docker and AWS in our workflow. The Dockerfile is in the repo, but you can pull from the registry here`docker pull bbcnews/wraith`. There is no quick way to get up and running with OSX and no way to use it on Windows. For a CI environment, it has a really good use case though. To run, specify your workspace and the command you want. If you want to use the Ruby AWS-SDK gem to upload your images to s3, it is built into the container. I recommend writing a simple ruby script that runs once you have completed a Wraith run.
|
116
|
-
|
117
|
-
```sh
|
118
|
-
docker run -d bbcnews/wraith -w /wraith -v path/to/dir:/wraith capture configs/config.yaml
|
119
|
-
```
|
120
|
-
|
121
|
-
## Changelog - updated 2014-10-20
|
122
|
-
We have combined CasperJS with Wraith to enable component screen shots and comparison. This allows for developers to check only a small part of a page for regressions allowing for quicker and smaller screenshots.
|
123
|
-
|
85
|
+
A gallery is available to view each of the images and the respective diff images located in the shots folder once all the images have been compared. You can set thresholds in the config file, if above this value, the gallery will indicate the shots above the threshold.
|
124
86
|
|
125
|
-
|
87
|
+
## Changelog - updated 2014-12-09
|
88
|
+
In the latest release I have implemented thresholds for Wraith, this makes finding failed shots easier. Set the threshold value in the config to a value you want, by default it is 0. When a failure is detected, the terminal will show a failure message and the gallery will have a red cross next to the set of shots.
|
126
89
|
|
127
90
|
## Contributing
|
128
91
|
|
data/lib/wraith/cli.rb
CHANGED
@@ -83,13 +83,13 @@ class Wraith::CLI < Thor
|
|
83
83
|
end
|
84
84
|
|
85
85
|
desc 'generate_gallery [config_name]', 'create page for viewing images'
|
86
|
-
def generate_gallery(config_name)
|
87
|
-
gallery = Wraith::GalleryGenerator.new(config_name)
|
86
|
+
def generate_gallery(config_name, multi)
|
87
|
+
gallery = Wraith::GalleryGenerator.new(config_name, multi)
|
88
88
|
gallery.generate_gallery
|
89
89
|
end
|
90
90
|
|
91
91
|
desc 'capture [config_name]', 'A full Wraith job'
|
92
|
-
def capture(config)
|
92
|
+
def capture(config, multi = false)
|
93
93
|
reset_shots(config)
|
94
94
|
check_for_paths(config)
|
95
95
|
setup_folders(config)
|
@@ -97,14 +97,14 @@ class Wraith::CLI < Thor
|
|
97
97
|
crop_images(config)
|
98
98
|
compare_images(config)
|
99
99
|
generate_thumbnails(config)
|
100
|
-
generate_gallery(config)
|
100
|
+
generate_gallery(config, multi)
|
101
101
|
end
|
102
102
|
|
103
103
|
desc 'multi_capture [filelist]', 'A Batch of Wraith Jobs'
|
104
104
|
def multi_capture(filelist)
|
105
105
|
config_array = IO.readlines(filelist)
|
106
106
|
config_array.each do |config|
|
107
|
-
capture(config.chomp)
|
107
|
+
capture(config.chomp, true)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
data/lib/wraith/gallery.rb
CHANGED
@@ -12,9 +12,10 @@ class Wraith::GalleryGenerator
|
|
12
12
|
TEMPLATE_BY_DOMAIN_LOCATION = File.expand_path('gallery_template/gallery_template.erb', File.dirname(__FILE__))
|
13
13
|
BOOTSTRAP_LOCATION = File.expand_path('gallery_template/bootstrap.min.css', File.dirname(__FILE__))
|
14
14
|
|
15
|
-
def initialize(config)
|
15
|
+
def initialize(config, multi)
|
16
16
|
@wraith = Wraith::Wraith.new(config)
|
17
17
|
@location = wraith.directory
|
18
|
+
@mutli = multi
|
18
19
|
@folder_manager = Wraith::FolderManager.new(config)
|
19
20
|
end
|
20
21
|
|
@@ -129,9 +130,13 @@ class Wraith::GalleryGenerator
|
|
129
130
|
end
|
130
131
|
|
131
132
|
def check_failed_shots
|
132
|
-
if @
|
133
|
+
if @mutli
|
134
|
+
return true
|
135
|
+
elsif @failed_shots == false
|
133
136
|
puts 'Failures detected'
|
134
137
|
exit 1
|
138
|
+
else
|
139
|
+
true
|
135
140
|
end
|
136
141
|
end
|
137
142
|
|
data/lib/wraith/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wraith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Blooman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|