sponte_pretty_face 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +7 -0
  7. data/ChangeLog +65 -0
  8. data/Gemfile +13 -0
  9. data/Guardfile +19 -0
  10. data/README.md +58 -0
  11. data/Rakefile +19 -0
  12. data/autotrader.png +0 -0
  13. data/cucumber.yml +3 -0
  14. data/features/feature_pages.feature +113 -0
  15. data/features/pretty_face_report.feature +80 -0
  16. data/features/step_definitions/report_steps.rb +36 -0
  17. data/features/support/_feature_header.erb +2 -0
  18. data/features/support/_suite_header.erb +2 -0
  19. data/features/support/env.rb +16 -0
  20. data/features/support/error_display.rb +16 -0
  21. data/features/support/hooks.rb +11 -0
  22. data/features/support/logo.png +0 -0
  23. data/features/support/pretty_face/.gitkeep +0 -0
  24. data/fixtures/advanced.feature +57 -0
  25. data/fixtures/background.feature +10 -0
  26. data/fixtures/basic.feature +20 -0
  27. data/fixtures/failing_background.feature +7 -0
  28. data/fixtures/more/more.feature +8 -0
  29. data/fixtures/onemore/deep/more.feature +8 -0
  30. data/fixtures/onemore/more.feature +8 -0
  31. data/fixtures/step_definitions/advanced_steps.rb +34 -0
  32. data/fixtures/step_definitions/basic_steps.rb +28 -0
  33. data/fixtures/support/env.rb +3 -0
  34. data/lib/pretty_face.rb +6 -0
  35. data/lib/pretty_face/formatter/html.rb +295 -0
  36. data/lib/pretty_face/formatter/report.rb +293 -0
  37. data/lib/pretty_face/formatter/view_helper.rb +61 -0
  38. data/lib/pretty_face/templates/_main_header.erb +1 -0
  39. data/lib/pretty_face/templates/_page_header.erb +2 -0
  40. data/lib/pretty_face/templates/_step.erb +46 -0
  41. data/lib/pretty_face/templates/face.png +0 -0
  42. data/lib/pretty_face/templates/failed.png +0 -0
  43. data/lib/pretty_face/templates/feature.erb +138 -0
  44. data/lib/pretty_face/templates/main.erb +146 -0
  45. data/lib/pretty_face/templates/passed.png +0 -0
  46. data/lib/pretty_face/templates/pending.png +0 -0
  47. data/lib/pretty_face/templates/skipped.png +0 -0
  48. data/lib/pretty_face/templates/style.css +338 -0
  49. data/lib/pretty_face/templates/table_failed.png +0 -0
  50. data/lib/pretty_face/templates/table_passed.png +0 -0
  51. data/lib/pretty_face/templates/table_pending.png +0 -0
  52. data/lib/pretty_face/templates/table_skipped.png +0 -0
  53. data/lib/pretty_face/templates/table_undefined.png +0 -0
  54. data/lib/pretty_face/templates/undefined.png +0 -0
  55. data/lib/pretty_face/version.rb +3 -0
  56. data/pretty_face.gemspec +28 -0
  57. data/spec/lib/customization_spec.rb +23 -0
  58. data/spec/lib/html_formatter_spec.rb +147 -0
  59. data/spec/spec_helper.rb +5 -0
  60. metadata +204 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 761b86ff282874b0dd78b978c304d7a173c91fbb
4
+ data.tar.gz: 75169cbdb656f53ce2b6db97973be4414324d4f6
5
+ SHA512:
6
+ metadata.gz: 08a113322610896ec648b535f080336a33b8564de005a30be182b958d3fd8b9342b330b929647ad373ce36883ff7ae0ec11d55f5bbaf9ad8b73fbfef53238cc3
7
+ data.tar.gz: b309dc4f83ef77d6b20589dc7f0da26590747ab13587b62686cf44d07967df128b4ecc2cf5fe99ac179395111032c0198700a543ea573be22b91c6a903aa648b
@@ -0,0 +1,11 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .DS_Store
6
+ *.swp
7
+ fixture.html
8
+ images
9
+ results
10
+ tmp
11
+ .idea
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format doc
@@ -0,0 +1 @@
1
+ testgen
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p195
@@ -0,0 +1,7 @@
1
+ before_install: mkdir results
2
+
3
+ language: ruby
4
+ rvm:
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - 1.8.7
@@ -0,0 +1,65 @@
1
+ === Release 0.10.2 / 2014-6-2
2
+ * Included explicit require of module Mime due to dependency load changes in ActionPack 4.1.1
3
+
4
+ === Release 0.10.1 / 2014-4-7
5
+ * Included handling for unknown files
6
+ * Removed unused code
7
+
8
+ === Release 0.10 / 2014-2-4
9
+ * Overrode cucumber option to expand set by RubyMine
10
+
11
+ === Release 0.9.1 / 2013-9-9
12
+ * Updated CSS for embbeded image resizing
13
+
14
+ === Release 0.9 / 2013-9-4
15
+ * Support for utf-8 (Thanks Eugene Batogov)
16
+ * Fixed error when multiple nested directories
17
+
18
+ === Release 0.8.2 / 2013-8-16
19
+ * More issues fixed with Windows
20
+
21
+ === Release 0.8.1 / 2013-8-11
22
+ * Fixing issues with windows paths
23
+ * Fixed issue with back link not working when page is nested in directory
24
+
25
+ === Release 0.8 / 2013-8-8
26
+ * Fixed pathing error when running within RubyMine
27
+
28
+ === Release 0.7 / 2013-7-29
29
+ * Fixed formatting for error detail display
30
+ * Creates directory if not present before saving results to html file
31
+
32
+ === Release 0.6.1 / 2013-7-29
33
+ * Fixed issue with new icons not being displayed
34
+ * Adjusted width inconsistencies
35
+
36
+ === Release 0.6 / 2013-7-24
37
+ * Changed icons
38
+ * Changed styling of summary table
39
+ * Added new logo
40
+ * Updated style for results header
41
+
42
+ === Release 0.5 / 2013-7-19
43
+ * Updated ReadMe
44
+ * Displaying step definition on step failure
45
+ * Added color to scenario headers indicating status
46
+ * Changed styling of scenario reporting
47
+
48
+ === Release 0.4 / 2013-4-13
49
+ * Make replacement items optional
50
+ * Updated actionpack dependency to the latest version 3.2.13
51
+
52
+ === Release 0.3 / 2013-3-9
53
+ * Allow users to provide replacement logo for report
54
+ * Allow users to provide replacement header for top level page
55
+ * Allow users to provide replacement header for feature pages
56
+
57
+ === Release 0.2 / 2013-2-23
58
+ * Creating a page for each feature file
59
+ * Displaying Background
60
+ * Displaying Errors on feature pages
61
+ * Displaying multi-line steps
62
+ * Displaying embedded images
63
+
64
+ === Release 0.1 / 2012-11-17
65
+ Initial release with single page basic report
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ gem 'fuubar'
5
+ gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
6
+ gem 'growl'
7
+ gem 'guard-rspec'
8
+ gem 'guard-cucumber'
9
+ gem 'page-object'
10
+ gem 'syntax'
11
+
12
+ # Specify your gem's dependencies in pretty_face.gemspec
13
+ gemspec
@@ -0,0 +1,19 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :cli => '--color --format Fuubar' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { "spec" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
9
+
10
+ guard 'cucumber', :notification => true, :all_after_pass => false, :cli => '--profile focus' do
11
+ watch(%r{^features/.+\.feature$})
12
+ watch(%r{^features/support/.+$}) { 'features' }
13
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
14
+ watch(%r{^lib/.+\.rb$}) { "features" }
15
+ watch(%r{^lib/.+\.erb$}) { "features" }
16
+ watch(%r{^lib/.+\.css$}) { "features" }
17
+
18
+ end
19
+
@@ -0,0 +1,58 @@
1
+ # pretty_face
2
+
3
+ HTML report for cucumber. You can customize the report by editing an erb file.
4
+
5
+ The current release is very basic but you can expect a lot more over the next month or so.
6
+
7
+ ## Getting Started
8
+
9
+ ### Download gem
10
+ Add the gem to your Gemfile
11
+
12
+ `gem 'pretty_face'`
13
+
14
+ Then do a `bundle update` to get the latest version
15
+
16
+ ### Add Formatter
17
+ Update your profile in cucumber.yml file with the following arguments
18
+
19
+ --format PrettyFace::Formatter::Html --out index.html
20
+
21
+ You can also run cucumber from the command line with the same arguments.
22
+
23
+ ## Customizing the report
24
+
25
+ Starting with version 0.3 of the gem you can customize some elements on the report. You will do this by first creating a directory named `pretty_face` in the `features/support` directory. Customization files should be placed in this directory.
26
+
27
+ ### Changing the image on all pages
28
+
29
+ To replace the image that appears at the top of all pages you simply need to place a file in the customization directory named `logo.png`. The extention can be png, gif, jpg, or jpeg but the filename must be logo in all lower case. The image will look best if it is around 220 X 220 pixels.
30
+
31
+ ### Replacing the header on the main landing page
32
+
33
+ To replace the header that appears at the top of the main landing page you simply need to create a file in the customization directory that contains the html you wish to display. The file must be named `_suite_header.erb`.
34
+
35
+ ### Replacing the header on the feature pages
36
+
37
+ To replace the header that appears on all of the pages with details about features you simply need to create a file in the customization directory that contains the html you wish to display. The file must be named `_feature_header.erb`.
38
+
39
+ ## Known Issues
40
+
41
+ Using this gem's formatter from within RubyMine causes the result tree not to expand Scenario Outlines when running in RubyMine.
42
+
43
+ For additional issues see:
44
+ [http://github.com/cheezy/pretty_face/issues](http://github.com/cheezy/pretty_face/issues)
45
+
46
+ ## Contribute
47
+
48
+ * Fork the project.
49
+ * Test drive your feature addition or bug fix. Adding specs is important and I will not accept a pull request that does not have tests.
50
+ * Make sure you describe your new feature with a cucumber scenario.
51
+ * Make sure you provide RDoc comments for any new public method you add. Remember, others will be using this gem.
52
+ * Commit, do not mess with Rakefile, version, or ChangeLog.
53
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
54
+ * Send me a pull request. Bonus points for topic branches.
55
+
56
+ ## Copyright
57
+
58
+ Copyright (c) 2012-2013 Jeffrey S. Morgan. See LICENSE for details.
@@ -0,0 +1,19 @@
1
+ require "bundler/gem_tasks"
2
+ require 'cucumber'
3
+ require 'cucumber/rake/task'
4
+ require 'rspec/core/rake_task'
5
+
6
+ Cucumber::Rake::Task.new(:features, "Run all features") do |t|
7
+ t.profile = 'default'
8
+ end
9
+
10
+ RSpec::Core::RakeTask.new(:spec) do |spec|
11
+ spec.ruby_opts = "-I lib:spec"
12
+ spec.pattern = 'spec/**/*_spec.rb'
13
+ end
14
+ task :spec
15
+
16
+ desc 'Run all specs and features'
17
+ task :test => %w[spec features]
18
+
19
+ task :default => :test
Binary file
@@ -0,0 +1,3 @@
1
+ default: --color --no-source --format pretty
2
+ fixture: --color --no-source --require fixtures/step_definitions --format PrettyFace::Formatter::Html --out results/fixture.html
3
+ focus: --color --no-source --format pretty --tags @focus
@@ -0,0 +1,113 @@
1
+ Feature: pages that show details for features
2
+
3
+ Background:
4
+ When I run `cucumber fixtures --profile fixture`
5
+
6
+ Scenario: Generate the pages
7
+ Then the following files should exist:
8
+ | results/basic.html |
9
+ | results/advanced.html |
10
+
11
+ Scenario: Generating the basic html page from the erb
12
+ Then the file "results/basic.html" should contain "DOCTYPE html PUBLIC"
13
+ And the file "results/basic.html" should contain "<html xmlns='http://www.w3.org/1999/xhtml'>"
14
+ And the file "results/basic.html" should contain "<head>"
15
+ And the file "results/basic.html" should contain "<body"
16
+ And the file "results/basic.html" should contain "<title>Feature Results</title>"
17
+
18
+ Scenario: Including an image / logo
19
+ Then the file "results/basic.html" should contain "<img src="
20
+
21
+ Scenario: It should show start time and duration in the header
22
+ Then the file "results/basic.html" should contain "started:"
23
+ And the file "results/basic.html" should contain "duration:"
24
+
25
+ Scenario: Generating some basic stats from the erb
26
+ Then the file "results/basic.html" should contain "<th>Executed<"
27
+ And the file "results/basic.html" should contain "<th>Average Duration"
28
+ And the file "results/basic.html" should contain "Scenarios"
29
+ And the file "results/basic.html" should contain "Steps"
30
+
31
+ Scenario: It should capture scenario and step statuses
32
+ Then the file "results/basic.html" should contain "Passed"
33
+ And the file "results/basic.html" should contain "Failed"
34
+ And the file "results/basic.html" should contain "Pending"
35
+ And the file "results/basic.html" should contain "Undefined"
36
+ And the file "results/basic.html" should contain "Skipped"
37
+
38
+ Scenario: It should display scenario names
39
+ Then the file "results/basic.html" should contain "A passing scenario"
40
+ And the file "results/advanced.html" should contain "A scenario outline"
41
+ And the file "results/background.html" should contain "Another passing scenario"
42
+
43
+ Scenario: It should display scenario steps
44
+ Then the file "results/basic.html" should contain "it should say hello"
45
+ And the file "results/background.html" should contain "it should say hello"
46
+ And the file "results/advanced.html" should contain "I am using a scenario outline"
47
+
48
+ Scenario: It should display the step and data for scenario outline steps
49
+ Then the file "results/advanced.html" should contain "I use aaa"
50
+ And the file "results/advanced.html" should contain "I use bbb"
51
+
52
+ Scenario: It should display descriptions for features
53
+ Then the file "results/basic.html" should contain "As a stakeholder"
54
+ Then the file "results/basic.html" should contain "I want to see some details about this feature"
55
+ Then the file "results/basic.html" should contain "So that I have some idea why this test matters"
56
+
57
+ Scenario: It should display a nested table
58
+ Then the file "results/advanced.html" should contain "<th>key1</th>"
59
+ And the file "results/advanced.html" should contain "<th>key2</th>"
60
+ And the file "results/advanced.html" should contain "<th>key3</th>"
61
+ And the file "results/advanced.html" should contain "<td>value1</td>"
62
+ And the file "results/advanced.html" should contain "<td>value2</td>"
63
+ And the file "results/advanced.html" should contain "<td>value3</td>"
64
+
65
+ Scenario: It should display the multi-line argument
66
+ Then the file "results/advanced.html" should contain "Hello with"
67
+ And the file "results/advanced.html" should contain "more than one"
68
+ And the file "results/advanced.html" should contain "line in a string"
69
+
70
+ Scenario: It should display errors for features
71
+ Then the file "results/basic.html" should contain "RSpec::Expectations::ExpectationNotMetError"
72
+ And the file "results/advanced.html" should contain "RSpec::Expectations::ExpectationNotMetError"
73
+ And the file "results/failing_background.html" should contain "RSpec::Expectations::ExpectationNotMetError"
74
+
75
+ Scenario: It should display error message with a yellow background and red text
76
+ Then the file "results/basic.html" should contain "RSpec::Expectations::ExpectationNotMetError"
77
+ And the background of the error message row should be "rgba(249, 231, 8, 1)"
78
+ And the text of the of the error message row should be "rgba(0, 0, 0, 1)"
79
+
80
+ Scenario: Embedding an image into the page
81
+ Then the file "results/basic.html" should contain "<img id='img_0' style='display: none' src='images/autotrader.png'/>"
82
+ And the file "results/basic.html" should contain "<a href='' onclick="
83
+ And the file "results/basic.html" should contain "img=document.getElementById('img_0'); img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false"
84
+ And the file "results/basic.html" should contain ">AutoTrader</a>"
85
+
86
+ Scenario: Embedding base64 image into the page
87
+ Then the file "results/basic.html" should contain "<img id='img_1' style='display: none' src='data:image/png;base64,"
88
+ And the file "results/basic.html" should contain "<a href='' onclick="
89
+ And the file "results/basic.html" should contain "img=document.getElementById('img_0'); img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false"
90
+ And the file "results/basic.html" should contain ">AutoTrader</a>"
91
+
92
+ Scenario: Displaying a background
93
+ Then the file "results/background.html" should contain "Background: A scenario can have a background"
94
+ And the file "results/background.html" should contain "When Cucumber puts"
95
+
96
+ Scenario: Feature pages should have a link back to the report summary
97
+ Then the file "results/advanced.html" should contain "<a href="
98
+
99
+ Scenario: Should create directories when directories exist in features directory
100
+ Then the following files should exist:
101
+ | results/more/more.html |
102
+
103
+ Scenario: Should create a directory for each directory under features
104
+ Then the following files should exist:
105
+ | results/onemore/more.html |
106
+ | results/onemore/deep/more.html |
107
+
108
+ Scenario: It should replace the header for the feature pages
109
+ When I have a feature header partial in the correct location
110
+ And I run `cucumber fixtures --profile fixture`
111
+ Then the file "results/basic.html" should contain "The Code Monkeys"
112
+ And the file "results/basic.html" should contain "Feature Results"
113
+ And I should remove the feature header partial file
@@ -0,0 +1,80 @@
1
+ Feature: pretty face report
2
+
3
+ Background:
4
+ When I run `cucumber fixtures --profile fixture`
5
+
6
+ Scenario: Cucumber crefates an html report
7
+ Then the following files should exist:
8
+ | results/fixture.html |
9
+
10
+ Scenario: Generating the basic html page from the erb
11
+ Then the file "results/fixture.html" should contain "DOCTYPE html PUBLIC"
12
+ And the file "results/fixture.html" should contain "<html xmlns='http://www.w3.org/1999/xhtml'>"
13
+ And the file "results/fixture.html" should contain "<head>"
14
+ And the file "results/fixture.html" should contain "<body"
15
+ And the file "results/fixture.html" should contain "<title>Test Results</title>"
16
+
17
+ Scenario: Generating some basic stats from the erb
18
+ Then the file "results/fixture.html" should contain "<th>Executed<"
19
+ And the file "results/fixture.html" should contain "<th>Average Duration"
20
+ And the file "results/fixture.html" should contain "Scenarios"
21
+ And the file "results/fixture.html" should contain "Steps"
22
+
23
+ Scenario: Including the styles for the main page
24
+ Then the file "results/fixture.html" should contain "<link href='stylesheets/style.css' type='text/css' rel='stylesheet' />"
25
+ And the file "results/fixture.html" should not contain "</style>"
26
+
27
+ Scenario: Including an image / logo
28
+ Then the file "results/fixture.html" should contain "<img src="
29
+
30
+ Scenario: It should copy the style sheet to the stylesheets directory
31
+ Then the following files should exist:
32
+ | results/stylesheets/style.css |
33
+
34
+ Scenario: It should copy the logo image to the images directory
35
+ Then the following files should exist:
36
+ | results/images/face.png |
37
+
38
+ Scenario: It should show start time and duration in the header
39
+ Then the file "results/fixture.html" should contain "started:"
40
+ And the file "results/fixture.html" should contain "duration:"
41
+
42
+ Scenario: It should capture scenario and step statuses
43
+ Then the file "results/fixture.html" should contain "Passed"
44
+ And the file "results/fixture.html" should contain "Failed"
45
+ And the file "results/fixture.html" should contain "Pending"
46
+ And the file "results/fixture.html" should contain "Undefined"
47
+ And the file "results/fixture.html" should contain "Skipped"
48
+
49
+ Scenario: It should display all of the tests with failures
50
+ Then the file "results/fixture.html" should contain "Tests With Failures:"
51
+
52
+ Scenario: It should display a list of all features / scenarios
53
+ Then the file "results/fixture.html" should contain "Feature Overview:"
54
+
55
+ Scenario: It should display useful information about each scenario
56
+ Then the file "results/fixture.html" should contain "Feature"
57
+ And the file "results/fixture.html" should contain "File"
58
+ And the file "results/fixture.html" should contain "Passed"
59
+ And the file "results/fixture.html" should contain "Failed"
60
+ And the file "results/fixture.html" should contain "Pending"
61
+ And the file "results/fixture.html" should contain "Undefined"
62
+ And the file "results/fixture.html" should contain "Skipped"
63
+
64
+ Scenario: It should display the data from scenario outlines
65
+ Then the file "results/fixture.html" should contain "| aaa | bbb |"
66
+ And the file "results/fixture.html" should contain "| ccc | ddd |"
67
+
68
+ Scenario: It should replace the logo image on the top level page
69
+ When I have a logo file in the correct location
70
+ And I run `cucumber fixtures --profile fixture`
71
+ Then the file "results/fixture.html" should contain "img src='images/logo.png'"
72
+ And I should remove the logo file
73
+
74
+ Scenario: It should replace the header for the main page of the report
75
+ When I have a suite header partial in the correct location
76
+ And I run `cucumber fixtures --profile fixture`
77
+ Then the file "results/fixture.html" should contain "The Code Monkeys"
78
+ And the file "results/fixture.html" should contain "Test Results"
79
+ And I should remove the suite header partial file
80
+
@@ -0,0 +1,36 @@
1
+ require 'fileutils'
2
+
3
+ When /^I have a logo file in the correct location$/ do
4
+ FileUtils.cp "features/support/logo.png", "features/support/pretty_face/"
5
+ end
6
+
7
+ Then /^I should remove the logo file$/ do
8
+ FileUtils.rm "features/support/pretty_face/logo.png"
9
+ end
10
+
11
+ When /^I have a suite header partial in the correct location$/ do
12
+ FileUtils.cp "features/support/_suite_header.erb", "features/support/pretty_face/"
13
+ end
14
+
15
+ Then /^I should remove the suite header partial file$/ do
16
+ FileUtils.rm "features/support/pretty_face/_suite_header.erb"
17
+ end
18
+
19
+ When /^I have a feature header partial in the correct location$/ do
20
+ FileUtils.cp "features/support/_feature_header.erb", "features/support/pretty_face/"
21
+ end
22
+
23
+ Then /^I should remove the feature header partial file$/ do
24
+ FileUtils.rm "features/support/pretty_face/_feature_header.erb"
25
+ end
26
+
27
+ Then(/^the background of the error message row should be "(.*?)"$/) do |background|
28
+ @browser = Watir::Browser.new :firefox
29
+ visit ErrorDisplay do |page|
30
+ page.error_background.should include background
31
+ end
32
+ end
33
+
34
+ Then(/^the text of the of the error message row should be "(.*?)"$/) do |color|
35
+ on(ErrorDisplay).error_text_color.should include color
36
+ end