capybara-inline-screenshot 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -5
- data/lib/capybara-inline-screenshot/cucumber.rb +25 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 546f109b8ce665f0b1bc0f16c3d0b7006d2c7d9d
|
4
|
+
data.tar.gz: 58be3e7b15e6c72b55b85be661b005c699e55181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d88b8db90ba841507147aad74325103ff9b8740f8401a7cdb50b6ad87143f5a8e37f127c7728b50e54dfd3c5582d976b11a68960ee55ba8ce9c3d02a6c52a2c
|
7
|
+
data.tar.gz: 431da3ba652a3d2b6ed95498003916e25b695881bfdf7f838a62ff655e7a67a4f9fb13c06ccfd130e5cbb2ca3ddd2d7f29de5d6a24661650e8cd6e5bbd30e33c
|
data/README.md
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
Extends [capybara-screenshot](https://github.com/mattheworiordan/capybara-screenshot) with inline image output.
|
4
4
|
|
5
|
-
If `CI` environment variable is not present it will output screenshots in base64 encoded [iTerm2 image format](http://iterm2.com/images.html), and if `CI` is present it will output in the [Terminal artifact:// format](http://buildkite.github.io/terminal/inline-images/).
|
6
|
-
|
7
5
|
In [iTerm2 (nightly)](http://iterm2.com/):
|
8
6
|
|
9
7
|

|
@@ -14,16 +12,19 @@ In [Buildkite](https://buildkite.com/):
|
|
14
12
|
|
15
13
|
## Usage
|
16
14
|
|
17
|
-
|
15
|
+
In your Gemfile simply replace `capybara-screenshot` with `capybara-inline-screenshot`:
|
18
16
|
|
19
17
|
```ruby
|
20
18
|
gem 'capybara-inline-screenshot'
|
21
19
|
```
|
22
20
|
|
23
|
-
|
21
|
+
|
22
|
+
### RSpec
|
23
|
+
|
24
|
+
And where you initialize Capybara simply replace your call to:
|
24
25
|
|
25
26
|
```ruby
|
26
|
-
require 'capybara
|
27
|
+
require 'capybara-screenshot/rspec'
|
27
28
|
```
|
28
29
|
|
29
30
|
with:
|
@@ -32,6 +33,26 @@ with:
|
|
32
33
|
require 'capybara-inline-screenshot/rspec'
|
33
34
|
```
|
34
35
|
|
36
|
+
### Cucumber
|
37
|
+
|
38
|
+
For cucumber we use a different file
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
require 'capybara-inline-screenshot/cucumber'
|
42
|
+
```
|
43
|
+
|
44
|
+
The final step is to configure your build steps to upload the screenshot artifacts. The default path is your app’s `tmp` directory, so the artifact upload pattern would be `tmp/*.png`
|
45
|
+
|
46
|
+
## Fallback
|
47
|
+
|
48
|
+
Thanks the wonder of ANSI escape codes if your terminal client doesn't understand the escape codes it'll simply ignore them—it'll just be be like using the standard capybara-screenshot gem.
|
49
|
+
|
50
|
+
## CI-mode
|
51
|
+
|
52
|
+
If the `CI` environment variable is present screenshots will be output in the [Terminal artifact:// format](http://buildkite.github.io/terminal/inline-images/) with the expectation that the images are uploaded as build artifacts and inlined by your CI system. You can also force this mode by setting the environment variable `CAPYBARA_INLINE_SCREENSHOT=artifact`.
|
53
|
+
|
54
|
+
If the `CI` environment variable is not present screenshots will be output in the base64 encoded [iTerm2 image format](http://iterm2.com/images.html) for viewing in a local terminal. You'll need the nightly release of iTerm to see the images.
|
55
|
+
|
35
56
|
## License
|
36
57
|
|
37
58
|
See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'capybara-inline-screenshot'
|
2
|
+
require 'capybara-screenshot'
|
3
|
+
|
4
|
+
Before do |scenario|
|
5
|
+
Capybara::Screenshot.final_session_name = nil
|
6
|
+
end
|
7
|
+
|
8
|
+
After do |scenario|
|
9
|
+
if Capybara::Screenshot.autosave_on_failure && scenario.failed?
|
10
|
+
Capybara.using_session(Capybara::Screenshot.final_session_name) do
|
11
|
+
filename_prefix = Capybara::Screenshot.filename_prefix_for(:cucumber, scenario)
|
12
|
+
|
13
|
+
saver = Capybara::Screenshot::Saver.new(Capybara, Capybara.page, true, filename_prefix)
|
14
|
+
saver.save
|
15
|
+
saver.output_screenshot_path
|
16
|
+
|
17
|
+
if File.exist?(saver.screenshot_path)
|
18
|
+
encoded_img = CapybaraInlineScreenshot.inline_base64(File.read(saver.screenshot_path))
|
19
|
+
embed(encoded_img, 'image/png;base64', "Screenshot of the error")
|
20
|
+
|
21
|
+
STDOUT.puts CapybaraInlineScreenshot.escape_code_for_image(saver.screenshot_path)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-inline-screenshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Lucas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara-screenshot
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- LICENSE.md
|
34
34
|
- README.md
|
35
35
|
- lib/capybara-inline-screenshot.rb
|
36
|
+
- lib/capybara-inline-screenshot/cucumber.rb
|
36
37
|
- lib/capybara-inline-screenshot/rspec.rb
|
37
38
|
homepage: http://github.com/buildkite/capybara-inline-screenshot
|
38
39
|
licenses:
|
@@ -54,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
55
|
version: '0'
|
55
56
|
requirements: []
|
56
57
|
rubyforge_project:
|
57
|
-
rubygems_version: 2.4.
|
58
|
+
rubygems_version: 2.4.6
|
58
59
|
signing_key:
|
59
60
|
specification_version: 4
|
60
61
|
summary: Extends capybara-screenshot with inline image output
|