captureful_formatter 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +49 -0
- data/Rakefile +2 -0
- data/captureful_formatter.gemspec +27 -0
- data/lib/captureful_formatter.rb +54 -0
- data/lib/captureful_formatter/formatter.rb +92 -0
- data/lib/captureful_formatter/notifications.rb +12 -0
- data/lib/captureful_formatter/printer.rb +46 -0
- data/lib/captureful_formatter/rspec_ext/rspec_core_reporter.rb +22 -0
- data/lib/captureful_formatter/turnip_ext/turnip_rspec_execute.rb +18 -0
- data/lib/captureful_formatter/version.rb +3 -0
- data/spec/captureful_formatter/formatter_spec.rb +60 -0
- data/spec/captureful_formatter/printer_spec.rb +44 -0
- data/spec/captureful_formatter_spec.rb +29 -0
- data/spec/example/test_template.erb.html +14 -0
- data/spec/spec_helper.rb +6 -0
- data/templates/test_report.html.erb +64 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 30f3679548cc23945e25fe8752233c60bd2af5fe
|
4
|
+
data.tar.gz: 9a7369666c42c652ca0311d87bbf10d5430af47c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e4cf41d025eacb2900a37fd594f70448195d77ad672234307f69b24cc7094d6f2f90f927b77490f8eca32db7f76b1cb3c8faa5389b889c733c60828bb498ec38
|
7
|
+
data.tar.gz: 5e2d0bf8c276f76f634c8c31f6e53bd262559203f968856141f44a82bbea4023c94fcd4854e775fc1437d361f2dfadba4e2f8f160868350c15c664f3db5742ef
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Atsushi Yasuda
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# CapturefulFormatter
|
2
|
+
|
3
|
+
Yet another custom formatter for [Turnip](https://github.com/jnicklas/turnip). Saving screenshots and pages each steps.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'captureful_formatter'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install captureful_formatter
|
20
|
+
|
21
|
+
Now edit the .rspec file in your project directory (create it if doesn't exist), and add the following line:
|
22
|
+
|
23
|
+
-r captureful_formatter
|
24
|
+
-f CapturefulFormatter::Formatter
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
Run this command.
|
29
|
+
|
30
|
+
$ rspec
|
31
|
+
|
32
|
+
## Configuration
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
CapturefulFormatter.configure do |config|
|
36
|
+
c.output_directory = "./.captureful_formatter" # The path to where the test report is saved.
|
37
|
+
c.template_path = "path/to/template" # your custom template file path.
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
now, captureful_formatter support erb template only.
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
1. Fork it ( https://github.com/ayasuda/captureful_formatter/fork )
|
46
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'captureful_formatter/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "captureful_formatter"
|
8
|
+
spec.version = CapturefulFormatter::VERSION
|
9
|
+
spec.authors = ["Atsushi Yasuda"]
|
10
|
+
spec.email = ["atsushi.yasuda.jp@gmail.com"]
|
11
|
+
spec.summary = %q(Yet another RSpec custom formatter for Turnip)
|
12
|
+
spec.description = %q(Yet another RSpec custom formatter for Turnip. Take screenshots step by step.)
|
13
|
+
spec.homepage = "https://github.com/crowdworks/captureful_formatter"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'capybara', "~> 2.2"
|
22
|
+
spec.add_dependency 'rspec', '>=3.0.0'
|
23
|
+
spec.add_dependency 'turnip', '~> 1.2.2'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'captureful_formatter/formatter'
|
2
|
+
require 'captureful_formatter/notifications'
|
3
|
+
require 'captureful_formatter/printer'
|
4
|
+
require 'captureful_formatter/version'
|
5
|
+
require 'logger'
|
6
|
+
|
7
|
+
module CapturefulFormatter
|
8
|
+
@@configuration = nil
|
9
|
+
class << self
|
10
|
+
|
11
|
+
def configure
|
12
|
+
yield configuration if block_given?
|
13
|
+
|
14
|
+
configuration
|
15
|
+
end
|
16
|
+
|
17
|
+
def configuration
|
18
|
+
@@configuration ||= Configuration.new
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Configuration
|
23
|
+
attr_accessor :output_directory
|
24
|
+
|
25
|
+
# what types to take screenshot
|
26
|
+
#
|
27
|
+
# @see http://rubydoc.info/gems/rspec-core/RSpec/Core/Metadata
|
28
|
+
attr_accessor :target_type
|
29
|
+
|
30
|
+
attr_accessor :template_path
|
31
|
+
|
32
|
+
def logger
|
33
|
+
@logger ||= default_logger
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def default_logger
|
39
|
+
log = Logger.new($stderr)
|
40
|
+
log.level = Logger::INFO
|
41
|
+
|
42
|
+
log
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
CapturefulFormatter.configure do |c|
|
48
|
+
c.output_directory = "./.captureful_formatter"
|
49
|
+
c.target_type = [:feature]
|
50
|
+
c.template_path = File.join(File.dirname(__FILE__), "/../templates/test_report.html.erb")
|
51
|
+
end
|
52
|
+
|
53
|
+
require 'captureful_formatter/rspec_ext/rspec_core_reporter'
|
54
|
+
require 'captureful_formatter/turnip_ext/turnip_rspec_execute'
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'capybara'
|
2
|
+
require 'digest/md5'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'rspec/core'
|
5
|
+
require "rspec/core/formatters/base_formatter"
|
6
|
+
|
7
|
+
module CapturefulFormatter
|
8
|
+
class Formatter < ::RSpec::Core::Formatters::BaseFormatter
|
9
|
+
::RSpec::Core::Formatters.register self, :start, :example_group_started, :example_group_finished,
|
10
|
+
:example_started, :step_started, :example_passed, :example_pending, :example_failed, :stop
|
11
|
+
|
12
|
+
Example = Struct.new("Example", :groups, :steps, :status, :fail_info)
|
13
|
+
FailInfo = Struct.new("FailInfo", :exception, :backtraces)
|
14
|
+
|
15
|
+
def start notification
|
16
|
+
@should_capture = false
|
17
|
+
@examples = {}
|
18
|
+
@group_level = 0
|
19
|
+
@group_examples = []
|
20
|
+
end
|
21
|
+
|
22
|
+
def example_group_started notification
|
23
|
+
@should_capture = CapturefulFormatter.configuration.target_type.include? notification.group.metadata[:type]
|
24
|
+
@group_level += 1
|
25
|
+
@group_examples.push notification.group.description
|
26
|
+
end
|
27
|
+
|
28
|
+
def example_group_finished(notification)
|
29
|
+
@should_capture = false
|
30
|
+
@group_level -= 1
|
31
|
+
@group_examples.pop
|
32
|
+
end
|
33
|
+
|
34
|
+
def example_started notification
|
35
|
+
return unless @should_capture
|
36
|
+
@current_example_hash = Digest::MD5.hexdigest(@group_examples.join())
|
37
|
+
@examples[@current_example_hash] = Example.new(@group_examples.dup, [] , nil, nil)
|
38
|
+
end
|
39
|
+
|
40
|
+
def step_started notification
|
41
|
+
save_step_sessions notification.description
|
42
|
+
end
|
43
|
+
|
44
|
+
def example_passed notification
|
45
|
+
return unless @should_capture
|
46
|
+
@examples[@current_example_hash].status = :passed
|
47
|
+
end
|
48
|
+
|
49
|
+
def example_pending notification
|
50
|
+
return unless @should_capture
|
51
|
+
@examples[@current_example_hash].status = :pending
|
52
|
+
end
|
53
|
+
|
54
|
+
def example_failed notification
|
55
|
+
return unless @should_capture
|
56
|
+
@examples[@current_example_hash].status = :failed
|
57
|
+
@examples[@current_example_hash].fail_info = FailInfo.new(notification.exception.to_s, notification.formatted_backtrace.dup)
|
58
|
+
end
|
59
|
+
|
60
|
+
def stop notification
|
61
|
+
publish_reports
|
62
|
+
rescue => e
|
63
|
+
CapturefulFormatter.configuration.logger.error e.to_s
|
64
|
+
ensure
|
65
|
+
cleanup_reports
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def report_save_dir
|
71
|
+
@dir ||= Pathname.new(Dir.mktmpdir ["d", self.object_id.to_s ])
|
72
|
+
end
|
73
|
+
|
74
|
+
def save_step_sessions step_description
|
75
|
+
return unless @should_capture
|
76
|
+
current_count = @examples[@current_example_hash].steps.size
|
77
|
+
@examples[@current_example_hash].steps << step_description
|
78
|
+
filename_base = report_save_dir.join("#{@current_example_hash}-#{current_count.to_s}")
|
79
|
+
Capybara.current_session.save_page filename_base.sub_ext(".html")
|
80
|
+
Capybara.current_session.save_screenshot filename_base.sub_ext(".png")
|
81
|
+
end
|
82
|
+
|
83
|
+
def publish_reports
|
84
|
+
FileUtils.copy_entry report_save_dir, CapturefulFormatter.configuration.output_directory
|
85
|
+
CapturefulFormatter::Printer.print @examples
|
86
|
+
end
|
87
|
+
|
88
|
+
def cleanup_reports
|
89
|
+
FileUtils.remove_entry_secure report_save_dir
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module CapturefulFormatter
|
2
|
+
module Notifications
|
3
|
+
StepNotification = Struct.new(:description, :keyword, :extra_args) do
|
4
|
+
private_class_method :new
|
5
|
+
|
6
|
+
# @api
|
7
|
+
def self.from_step_object(data)
|
8
|
+
new data.description, data.keyword, data.extra_args
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
module CapturefulFormatter
|
5
|
+
module Printer
|
6
|
+
class TemplateMissingError < StandardError; end
|
7
|
+
|
8
|
+
class Template < OpenStruct
|
9
|
+
def render(template)
|
10
|
+
ERB.new(template).result(binding)
|
11
|
+
end
|
12
|
+
|
13
|
+
def background_by_status(status)
|
14
|
+
case status
|
15
|
+
when :passed then "bg-success"
|
16
|
+
when :pending then "bg-warning"
|
17
|
+
when :failed then "bg-danger"
|
18
|
+
else "bg-info"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class << self
|
24
|
+
attr_accessor :title
|
25
|
+
|
26
|
+
def print examples
|
27
|
+
path = template_path
|
28
|
+
params = {
|
29
|
+
title: "test report",
|
30
|
+
examples: examples
|
31
|
+
}
|
32
|
+
template = Template.new(params)
|
33
|
+
filename = File.join(CapturefulFormatter.configuration.output_directory, "/index.html")
|
34
|
+
File.write(filename ,template.render(File.read(path)))
|
35
|
+
end
|
36
|
+
|
37
|
+
def template_path
|
38
|
+
path = CapturefulFormatter.configuration.template_path
|
39
|
+
path = File.absolute_path(path)
|
40
|
+
raise TemplateMissingError, path unless File.exists? path
|
41
|
+
|
42
|
+
path
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rspec/core/reporter'
|
2
|
+
|
3
|
+
module CapturefulFormatter
|
4
|
+
module RSpec
|
5
|
+
module Core
|
6
|
+
module Reporter
|
7
|
+
def step_started(step)
|
8
|
+
CapturefulFormatter::Notifications::StepNotification.from_step_object(step)
|
9
|
+
notify :step_started, CapturefulFormatter::Notifications::StepNotification.from_step_object(step)
|
10
|
+
rescue => e
|
11
|
+
puts e
|
12
|
+
end
|
13
|
+
|
14
|
+
def step_finished(step)
|
15
|
+
notify :step_finished, CapturefulFormatter::Notifications::StepNotification.from_step_object(step)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
::RSpec::Core::Reporter.prepend(CapturefulFormatter::RSpec::Core::Reporter)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'turnip/rspec'
|
2
|
+
|
3
|
+
module CapturefulFormatter
|
4
|
+
module Turnip
|
5
|
+
module RSpec
|
6
|
+
module Execute
|
7
|
+
def run_step(feature_file, step)
|
8
|
+
reporter = ::RSpec.configuration.reporter
|
9
|
+
reporter.step_started(step)
|
10
|
+
super(feature_file, step)
|
11
|
+
reporter.step_finished(step)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
::Turnip::RSpec::Execute.prepend(CapturefulFormatter::Turnip::RSpec::Execute)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
describe CapturefulFormatter::Formatter do
|
5
|
+
let(:capybara_session) { double("current_session") }
|
6
|
+
let(:formatter) { CapturefulFormatter::Formatter.new(output) }
|
7
|
+
let(:output) { StringIO.new }
|
8
|
+
|
9
|
+
let(:example) { RSpec::Core::ExampleGroup.describe.example }
|
10
|
+
let(:example_group) { RSpec::Core::ExampleGroup }
|
11
|
+
|
12
|
+
let(:step_defenition) { Turnip::Builder::Step.new }
|
13
|
+
|
14
|
+
let(:example_notification) { RSpec::Core::Notifications::ExampleNotification.for(example) }
|
15
|
+
let(:group_notification) { RSpec::Core::Notifications::GroupNotification.new(example_group) }
|
16
|
+
let(:start_notification) { RSpec::Core::Notifications::StartNotification.new }
|
17
|
+
let(:step_notification) { CapturefulFormatter::Notifications::StepNotification.from_step_object(step_defenition) }
|
18
|
+
|
19
|
+
before do
|
20
|
+
example
|
21
|
+
allow(Capybara).to receive(:current_session).and_return(capybara_session)
|
22
|
+
formatter.start start_notification
|
23
|
+
end
|
24
|
+
|
25
|
+
subject { formatter }
|
26
|
+
it { is_expected.to be_a(CapturefulFormatter::Formatter) }
|
27
|
+
|
28
|
+
context "example group is not :feature" do
|
29
|
+
before do
|
30
|
+
allow(RSpec::Core::ExampleGroup).to receive(:metadata).and_return({type: :model})
|
31
|
+
formatter.example_group_started group_notification
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "at step by steps" do
|
35
|
+
it "do nothing" do
|
36
|
+
expect(capybara_session).not_to receive(:save_screenshot)
|
37
|
+
expect(capybara_session).not_to receive(:save_page)
|
38
|
+
formatter.step_started step_notification
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "example group is :feature" do
|
44
|
+
before do
|
45
|
+
allow(RSpec::Core::ExampleGroup).to receive(:metadata).and_return({type: :feature})
|
46
|
+
formatter.example_group_started group_notification
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "at step by steps" do
|
50
|
+
before { formatter.example_started example_notification }
|
51
|
+
after { formatter.example_passed example_notification }
|
52
|
+
|
53
|
+
it "save page and screen shot" do
|
54
|
+
expect(capybara_session).to receive(:save_screenshot)
|
55
|
+
expect(capybara_session).to receive(:save_page)
|
56
|
+
formatter.step_started step_notification
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CapturefulFormatter::Printer do
|
4
|
+
shared_examples "a safety file path" do
|
5
|
+
it "is existed" do
|
6
|
+
expect(File.exists? subject).to be_truthy
|
7
|
+
end
|
8
|
+
|
9
|
+
it "is full path" do
|
10
|
+
expect(subject).to start_with("/")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#template_file" do
|
15
|
+
subject { CapturefulFormatter::Printer.template_path }
|
16
|
+
|
17
|
+
it "returns default template" do
|
18
|
+
expect(subject).to eq File.absolute_path(File.join(File.dirname(__FILE__) + "../../../templates/test_report.html.erb"))
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "on seted up template path at configure" do
|
22
|
+
before do
|
23
|
+
CapturefulFormatter.configure do |config|
|
24
|
+
config.template_path = template
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "setup a absolute path" do
|
29
|
+
let(:template) { File.join(File.dirname(__FILE__), "/../example/test_template.erb.html") }
|
30
|
+
it_behaves_like "a safety file path"
|
31
|
+
end
|
32
|
+
|
33
|
+
context "setup a relative path" do
|
34
|
+
let(:template) { "./spec/example/test_template.erb.html" }
|
35
|
+
it_behaves_like "a safety file path"
|
36
|
+
end
|
37
|
+
|
38
|
+
context "setup no exists file" do
|
39
|
+
let(:template) { "/path/to/missing" }
|
40
|
+
specify { expect{ subject }.to raise_error(CapturefulFormatter::Printer::TemplateMissingError) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'securerandom'
|
3
|
+
|
4
|
+
describe CapturefulFormatter do
|
5
|
+
describe "VERSION" do
|
6
|
+
subject { CapturefulFormatter::VERSION }
|
7
|
+
it { is_expected.to eq "0.0.1" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".configuration" do
|
11
|
+
subject { CapturefulFormatter.configuration }
|
12
|
+
it { is_expected.to have_attributes(:output_directory => "./.captureful_formatter")}
|
13
|
+
it { is_expected.to have_attributes(:target_type => [:feature])}
|
14
|
+
it { is_expected.to have_attributes(:template_path => a_string_starting_with("/"))}
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".configure" do
|
18
|
+
let(:configuration) { CapturefulFormatter.configuration }
|
19
|
+
let(:new_attribute) { SecureRandom.base64(10) }
|
20
|
+
subject do
|
21
|
+
lambda do
|
22
|
+
CapturefulFormatter.configure do |c|
|
23
|
+
c.output_directory = new_attribute
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
it { is_expected.to change { configuration.output_directory }.to(new_attribute) }
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="ja">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title><%= title %></title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<ul>
|
9
|
+
<% examples.each do |example_hash, example| %>
|
10
|
+
<li><%= example.groups.join(" - ") %></li>
|
11
|
+
<% end %>
|
12
|
+
</ul>
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="ja">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title><%= title %></title>
|
6
|
+
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<nav class="navbar navbar-inverse navbar-static-top">
|
10
|
+
<div class="container">
|
11
|
+
<a class="navbar-brand" href="#" title="<%= title %>">
|
12
|
+
<span class="navbar-brand-left-color"><%= title %></span>
|
13
|
+
</a>
|
14
|
+
</div>
|
15
|
+
</nav>
|
16
|
+
|
17
|
+
<div class="container">
|
18
|
+
<div class="row">
|
19
|
+
<h2 id="index">index</h2>
|
20
|
+
<ul>
|
21
|
+
<% examples.each do |example_hash, example| %>
|
22
|
+
<li class="<%= background_by_status example.status %>"><a href="#<%= example_hash %>"><%= example.groups.join(" - ") %></a></li>
|
23
|
+
<% end %>
|
24
|
+
</ul>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="container">
|
29
|
+
<div class="row">
|
30
|
+
<h2>examples</h2>
|
31
|
+
<% examples.each do |example_hash, example| %>
|
32
|
+
<h3 id=<%= example_hash %>><%= example.groups.join(" - ") %></h3>
|
33
|
+
<% example.steps.each_with_index do |step, index| %>
|
34
|
+
<div class="row <%= (example.steps.size - 1 == index)? background_by_status(example.status) : "" %>">
|
35
|
+
<div class="col-md-5">
|
36
|
+
<a href="./<%= example_hash %>-<%= index %>.png">
|
37
|
+
<img class="img-rounded" height="256" wedth="320" src="./<%= example_hash %>-<%= index %>.png">
|
38
|
+
</a>
|
39
|
+
</div>
|
40
|
+
<div class="col-md-6">
|
41
|
+
<p><%= step %><p>
|
42
|
+
<% if example.steps.size - 1 == index %>
|
43
|
+
<% unless example.fail_info.nil? %>
|
44
|
+
<p><%= example.fail_info.exception %></p>
|
45
|
+
<ul>
|
46
|
+
<% example.fail_info.backtraces.each do |backtrace| %>
|
47
|
+
<li><%= backtrace %></li>
|
48
|
+
<% end %>
|
49
|
+
</ul>
|
50
|
+
<% end %>
|
51
|
+
<% end %>
|
52
|
+
</div>
|
53
|
+
</div><!-- row -->
|
54
|
+
<% end %>
|
55
|
+
<hr />
|
56
|
+
<% end %>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
|
61
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
62
|
+
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
63
|
+
</body>
|
64
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: captureful_formatter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Atsushi Yasuda
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capybara
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: turnip
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.2.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.2.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
description: Yet another RSpec custom formatter for Turnip. Take screenshots step
|
84
|
+
by step.
|
85
|
+
email:
|
86
|
+
- atsushi.yasuda.jp@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- captureful_formatter.gemspec
|
98
|
+
- lib/captureful_formatter.rb
|
99
|
+
- lib/captureful_formatter/formatter.rb
|
100
|
+
- lib/captureful_formatter/notifications.rb
|
101
|
+
- lib/captureful_formatter/printer.rb
|
102
|
+
- lib/captureful_formatter/rspec_ext/rspec_core_reporter.rb
|
103
|
+
- lib/captureful_formatter/turnip_ext/turnip_rspec_execute.rb
|
104
|
+
- lib/captureful_formatter/version.rb
|
105
|
+
- spec/captureful_formatter/formatter_spec.rb
|
106
|
+
- spec/captureful_formatter/printer_spec.rb
|
107
|
+
- spec/captureful_formatter_spec.rb
|
108
|
+
- spec/example/test_template.erb.html
|
109
|
+
- spec/spec_helper.rb
|
110
|
+
- templates/test_report.html.erb
|
111
|
+
homepage: https://github.com/crowdworks/captureful_formatter
|
112
|
+
licenses:
|
113
|
+
- MIT
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.2.2
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: Yet another RSpec custom formatter for Turnip
|
135
|
+
test_files:
|
136
|
+
- spec/captureful_formatter/formatter_spec.rb
|
137
|
+
- spec/captureful_formatter/printer_spec.rb
|
138
|
+
- spec/captureful_formatter_spec.rb
|
139
|
+
- spec/example/test_template.erb.html
|
140
|
+
- spec/spec_helper.rb
|