howitzer 1.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +32 -0
  4. data/.travis.yml +1 -4
  5. data/.yardopts +1 -2
  6. data/CHANGELOG.md +28 -1
  7. data/Gemfile +6 -0
  8. data/LICENSE +1 -1
  9. data/README.md +55 -85
  10. data/Rakefile +7 -7
  11. data/bin/howitzer +56 -31
  12. data/features/cli_new.feature +162 -79
  13. data/features/cli_update.feature +114 -21
  14. data/features/step_definitions/common_steps.rb +29 -9
  15. data/features/support/env.rb +1 -1
  16. data/features/support/transformers.rb +2 -2
  17. data/generators/base_generator.rb +121 -49
  18. data/generators/config/config_generator.rb +8 -5
  19. data/generators/config/templates/boot.rb +14 -0
  20. data/generators/config/templates/capybara.rb +156 -0
  21. data/generators/config/templates/custom.yml +2 -3
  22. data/generators/config/templates/default.yml +50 -82
  23. data/generators/cucumber/cucumber_generator.rb +9 -9
  24. data/generators/cucumber/templates/common_steps.rb +4 -4
  25. data/generators/cucumber/templates/cucumber.rake +63 -54
  26. data/generators/cucumber/templates/env.rb +24 -23
  27. data/generators/cucumber/templates/transformers.rb +23 -15
  28. data/generators/emails/emails_generator.rb +4 -2
  29. data/generators/emails/templates/example_email.rb +4 -4
  30. data/generators/prerequisites/prerequisites_generator.rb +24 -0
  31. data/generators/prerequisites/templates/base.rb +22 -0
  32. data/generators/prerequisites/templates/factory_girl.rb +30 -0
  33. data/generators/prerequisites/templates/user.rb +7 -0
  34. data/generators/prerequisites/templates/users.rb +12 -0
  35. data/generators/root/root_generator.rb +11 -7
  36. data/generators/root/templates/.rubocop.yml +32 -0
  37. data/generators/root/templates/Gemfile.erb +27 -0
  38. data/generators/root/templates/Rakefile +6 -8
  39. data/generators/rspec/rspec_generator.rb +7 -7
  40. data/generators/rspec/templates/example_spec.rb +1 -1
  41. data/generators/rspec/templates/rspec.rake +48 -29
  42. data/generators/rspec/templates/spec_helper.rb +33 -32
  43. data/generators/tasks/tasks_generator.rb +4 -2
  44. data/generators/tasks/templates/common.rake +1 -16
  45. data/generators/turnip/templates/.rspec +1 -0
  46. data/generators/turnip/templates/common_steps.rb +25 -0
  47. data/generators/turnip/templates/example.feature +8 -0
  48. data/generators/turnip/templates/spec_helper.rb +56 -0
  49. data/generators/turnip/templates/turnip.rake +61 -0
  50. data/generators/turnip/templates/turnip_helper.rb +6 -0
  51. data/generators/turnip/turnip_generator.rb +26 -0
  52. data/generators/web/templates/example_page.rb +15 -0
  53. data/generators/web/templates/menu_section.rb +13 -0
  54. data/generators/web/web_generator.rb +22 -0
  55. data/howitzer.gemspec +14 -21
  56. data/lib/howitzer.rb +47 -7
  57. data/lib/howitzer/cache.rb +70 -0
  58. data/lib/howitzer/capybara_helpers.rb +194 -0
  59. data/lib/howitzer/email.rb +96 -104
  60. data/lib/howitzer/exceptions.rb +10 -6
  61. data/lib/howitzer/log.rb +120 -0
  62. data/lib/howitzer/mail_adapters.rb +7 -0
  63. data/lib/howitzer/mail_adapters/abstract.rb +84 -0
  64. data/lib/howitzer/mail_adapters/mailgun.rb +115 -0
  65. data/lib/howitzer/mailgun_api.rb +9 -0
  66. data/lib/howitzer/mailgun_api/client.rb +79 -0
  67. data/lib/howitzer/mailgun_api/connector.rb +37 -0
  68. data/lib/howitzer/mailgun_api/response.rb +28 -0
  69. data/lib/howitzer/tasks/framework.rake +2 -2
  70. data/lib/howitzer/utils.rb +7 -1
  71. data/lib/howitzer/utils/string_extensions.rb +66 -0
  72. data/lib/howitzer/version.rb +2 -1
  73. data/lib/howitzer/web.rb +11 -0
  74. data/lib/howitzer/web/base_section.rb +27 -0
  75. data/lib/howitzer/web/blank_page.rb +12 -0
  76. data/lib/howitzer/web/capybara_methods_proxy.rb +29 -0
  77. data/lib/howitzer/web/element_dsl.rb +109 -0
  78. data/lib/howitzer/web/iframe_dsl.rb +93 -0
  79. data/lib/howitzer/web/page.rb +173 -0
  80. data/lib/howitzer/web/page_dsl.rb +64 -0
  81. data/lib/howitzer/web/page_validator.rb +118 -0
  82. data/lib/howitzer/web/section.rb +27 -0
  83. data/lib/howitzer/web/section_dsl.rb +154 -0
  84. data/spec/config/custom.yml +10 -1
  85. data/spec/spec_helper.rb +37 -19
  86. data/spec/support/generator_helper.rb +12 -11
  87. data/spec/support/logger_helper.rb +10 -9
  88. data/spec/support/mailgun_unit_client.rb +52 -44
  89. data/spec/support/shared_examples/capybara_context_holder.rb +33 -0
  90. data/spec/support/shared_examples/capybara_methods_proxy.rb +94 -0
  91. data/spec/support/shared_examples/dynamic_section_methods.rb +35 -0
  92. data/spec/support/shared_examples/element_dsl.rb +119 -0
  93. data/spec/unit/generators/base_generator_spec.rb +64 -33
  94. data/spec/unit/generators/config_generator_spec.rb +11 -7
  95. data/spec/unit/generators/cucumber_generator_spec.rb +26 -17
  96. data/spec/unit/generators/emails_generator_spec.rb +10 -6
  97. data/spec/unit/generators/prerequisites_generator_spec.rb +53 -0
  98. data/spec/unit/generators/root_generator_spec.rb +50 -13
  99. data/spec/unit/generators/rspec_generator_spec.rb +9 -9
  100. data/spec/unit/generators/tasks_generator_spec.rb +6 -6
  101. data/spec/unit/generators/turnip_generator_spec.rb +52 -0
  102. data/spec/unit/generators/web_generator_spec.rb +52 -0
  103. data/spec/unit/lib/cache_spec.rb +85 -0
  104. data/spec/unit/lib/capybara_helpers_spec.rb +696 -0
  105. data/spec/unit/lib/email_spec.rb +104 -91
  106. data/spec/unit/lib/howitzer.rb +31 -0
  107. data/spec/unit/lib/init_spec.rb +0 -1
  108. data/spec/unit/lib/log_spec.rb +122 -0
  109. data/spec/unit/lib/mail_adapters/abstract_spec.rb +62 -0
  110. data/spec/unit/lib/mail_adapters/mailgun_spec.rb +163 -0
  111. data/spec/unit/lib/mailgun_api/client_spec.rb +58 -0
  112. data/spec/unit/lib/mailgun_api/connector_spec.rb +54 -0
  113. data/spec/unit/lib/mailgun_api/response_spec.rb +28 -0
  114. data/spec/unit/lib/utils/string_extensions_spec.rb +77 -0
  115. data/spec/unit/lib/web/base_section_spec.rb +41 -0
  116. data/spec/unit/lib/web/element_dsl_spec.rb +17 -0
  117. data/spec/unit/lib/web/iframe_dsl_spec.rb +99 -0
  118. data/spec/unit/lib/web/page_dsl_spec.rb +52 -0
  119. data/spec/unit/lib/web/page_spec.rb +304 -0
  120. data/spec/unit/lib/web/page_validator_spec.rb +218 -0
  121. data/spec/unit/lib/web/section_dsl_spec.rb +165 -0
  122. data/spec/unit/lib/web/section_spec.rb +61 -0
  123. data/spec/unit/version_spec.rb +1 -1
  124. metadata +116 -203
  125. data/GETTING_STARTED.md +0 -774
  126. data/generators/cucumber/templates/cucumber.yml +0 -10
  127. data/generators/pages/pages_generator.rb +0 -21
  128. data/generators/pages/templates/example_menu.rb +0 -15
  129. data/generators/pages/templates/example_page.rb +0 -15
  130. data/generators/root/templates/Gemfile +0 -7
  131. data/generators/root/templates/boot.rb +0 -10
  132. data/lib/howitzer/blank_page.rb +0 -6
  133. data/lib/howitzer/capybara/dsl_ex.rb +0 -15
  134. data/lib/howitzer/capybara/settings.rb +0 -343
  135. data/lib/howitzer/helpers.rb +0 -230
  136. data/lib/howitzer/init.rb +0 -1
  137. data/lib/howitzer/mailgun/client.rb +0 -65
  138. data/lib/howitzer/mailgun/connector.rb +0 -34
  139. data/lib/howitzer/mailgun/response.rb +0 -28
  140. data/lib/howitzer/patches/rawler_patched.rb +0 -86
  141. data/lib/howitzer/settings.rb +0 -27
  142. data/lib/howitzer/utils/data_generator/data_storage.rb +0 -88
  143. data/lib/howitzer/utils/data_generator/gen.rb +0 -135
  144. data/lib/howitzer/utils/locator_store.rb +0 -217
  145. data/lib/howitzer/utils/log.rb +0 -139
  146. data/lib/howitzer/utils/page_validator.rb +0 -133
  147. data/lib/howitzer/vendor/firebug-1.12.1-fx.xpi +0 -0
  148. data/lib/howitzer/vendor/firepath-0.9.7-fx.xpi +0 -0
  149. data/lib/howitzer/web_page.rb +0 -253
  150. data/spec/active_resource.rb +0 -0
  151. data/spec/config/default.yml +0 -26
  152. data/spec/support/boot_helper.rb +0 -15
  153. data/spec/unit/generators/pages_generator_spec.rb +0 -33
  154. data/spec/unit/lib/capybara/dsl_ex_spec.rb +0 -60
  155. data/spec/unit/lib/capybara/settings_spec.rb +0 -441
  156. data/spec/unit/lib/helpers_spec.rb +0 -1129
  157. data/spec/unit/lib/mailgun/client_spec.rb +0 -36
  158. data/spec/unit/lib/mailgun/connector_spec.rb +0 -70
  159. data/spec/unit/lib/mailgun/response_spec.rb +0 -28
  160. data/spec/unit/lib/settings_spec.rb +0 -17
  161. data/spec/unit/lib/utils/data_generator/data_storage_spec.rb +0 -80
  162. data/spec/unit/lib/utils/data_generator/gen_spec.rb +0 -90
  163. data/spec/unit/lib/utils/locator_store_spec.rb +0 -157
  164. data/spec/unit/lib/utils/log_spec.rb +0 -107
  165. data/spec/unit/lib/utils/page_validator_spec.rb +0 -265
  166. data/spec/unit/lib/web_page_spec.rb +0 -346
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 822093c8e01134d6819f07781fcfc9533ec21191
4
- data.tar.gz: b6081c2e41b5c78b2c6cdbdb31e088021c9b1cad
3
+ metadata.gz: b3377af22722ffdd00c6ec6067a03d035550efa2
4
+ data.tar.gz: 1ddd61bd420afbd578e960f8056e1ccdd3efb261
5
5
  SHA512:
6
- metadata.gz: 1374d0e20e3ffeeb0ac2feb61680b1edfef288cb56554b624adf2307e9f27b264111047692393ea117c4f60aebc4cd3fcdfab0810abaabeed1dd3b680063f779
7
- data.tar.gz: 63bf664720ec9d50af9b3d0118dae1f7669ae4f0c47de50a589675fa86e3787528f95a33b06f77e0bb8b40c307c0858c2594f027dd4b135c009b08c7e35a0ce7
6
+ metadata.gz: f38792fab666d6b97c8b638214901522d2c2f75862619ef0afa64dc8d73df4dc85403b1366c7921eaf5f31c9048091f00d25b734fd619aa4d77d405fb357362f
7
+ data.tar.gz: 5f5a2b10f02da32f4d618f1192ce380a246998a2fa4cdd8692d12830ef2d2f62e6fea36b0a1d63c80c0cb905a3d80ae46a10fd4ba7b46ffd4971c72546afba28
data/.gitignore CHANGED
@@ -11,3 +11,4 @@ tmp/*
11
11
  .bundle
12
12
  **/.DS_Store
13
13
  .ruby-version
14
+ .byebug_history
@@ -0,0 +1,32 @@
1
+ # See full list of defaults here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
+ # To see all cops used see here: https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 2.3
6
+
7
+ LineLength:
8
+ Max: 120
9
+
10
+ Style/CaseIndentation:
11
+ Enabled: false
12
+
13
+ Style/EmptyElse:
14
+ Enabled: false
15
+
16
+ Lint/AmbiguousRegexpLiteral:
17
+ Enabled: false
18
+
19
+ Style/CaseEquality:
20
+ Enabled: false
21
+
22
+ MethodLength:
23
+ Max: 30
24
+
25
+ Style/TrivialAccessors:
26
+ AllowDSLWriters: true
27
+
28
+ Style/FrozenStringLiteralComment:
29
+ Enabled: false
30
+
31
+ Metrics/ModuleLength:
32
+ Max: 150
@@ -1,9 +1,6 @@
1
1
  language: ruby
2
2
  before_install:
3
3
  - gem install bundler
4
- rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1.10
4
+ rvm:
8
5
  - 2.2.5
9
6
  - 2.3.1
data/.yardopts CHANGED
@@ -1,5 +1,4 @@
1
1
  lib/**/*.rb
2
2
  -
3
- GETTING_STARTED.md
4
3
  CONTRIBUTING.md
5
- LICENSE
4
+ LICENSE
@@ -1,9 +1,36 @@
1
- ## [In git](https://github.com/strongqa/howitzer/compare/v1.1.1...master)
1
+ ## [In git](https://github.com/strongqa/howitzer/compare/v2.0.0...master)
2
2
 
3
3
  ### New Features
4
4
 
5
5
  ### Bugfixes
6
6
 
7
+ ## [v2.0.0](https://github.com/strongqa/howitzer/compare/v1.1.1...v2.0.0)
8
+
9
+ ### New Features
10
+ - Added REST API prerequisites with FactoryGirl
11
+ - Added Turnip supporting
12
+ - Restricted using several bdd frameworks at the same time
13
+ - Removed Opera browser supporting
14
+ - Integrated Rubocop
15
+ - Stopped Ruby supporting less than v2.2.2
16
+ - Introduced /web folder for page object elements
17
+ - Moved capybara settings to framework side
18
+ - Integrated Capybara screenshots
19
+ - Renamed and restructured default settings
20
+ - Placed everything to own namespace
21
+ - Introduced "subject" dsl method for emails
22
+ - Moved framework dependent libraries from the gem
23
+ - Introduced common tag groups for all BDD frameworks
24
+ - Stopped Rawler supporting
25
+ - Reimplemented page dsl methods from scratch
26
+ - Introduced sections and iframes
27
+ - Introduced email adapters
28
+ - Stopped supporting of output to txt file
29
+ - Removed raising error on log.error
30
+ - Removed locator storage
31
+ - Prevented capybara form dsl method usage
32
+ - Introduced new Page.on method
33
+
7
34
  ## [v1.1.1](https://github.com/strongqa/howitzer/compare/v1.1.0...v1.1.1)
8
35
 
9
36
  ### Bugfixes
data/Gemfile CHANGED
@@ -3,5 +3,11 @@ source 'https://rubygems.org'
3
3
  group :test do
4
4
  gem 'coveralls', require: false
5
5
  gem 'simplecov', require: false
6
+ gem 'repeater', require: false
7
+ gem 'rest-client', require: false
6
8
  end
7
9
  gemspec
10
+
11
+ group :development do
12
+ gem 'rubocop'
13
+ end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2015 Roman Parashchenko and StrongQA, Ltd.
1
+ Copyright (c) 2012-2016 Roman Parashchenko and StrongQA, Ltd.
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,52 +1,50 @@
1
- # Howitzer
1
+ <p align="center" style="overflow: hidden;">
2
+ <a href="http://howitzer-framework.io">
3
+ <img src="https://raw.githubusercontent.com/strongqa/howitzer/gh-pages/images/howitzer-logo.png" alt="Howitzer" />
4
+ </a>
5
+ <br/>
2
6
 
3
- [![Join the chat at https://gitter.im/strongqa/howitzer](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/strongqa/howitzer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
- [![Gem Version](http://img.shields.io/gem/v/howitzer.svg)][gem]
5
- [![Build Status](https://travis-ci.org/strongqa/howitzer.svg?branch=master)][travis]
6
- [![Dependency Status](https://gemnasium.com/strongqa/howitzer.svg)][gemnasium]
7
- [![Code Climate](https://codeclimate.com/github/romikoops/howitzer.png)][codeclimate]
8
- [![Coverage Status](https://coveralls.io/repos/strongqa/howitzer/badge.png?branch=master)][coveralls]
9
- [![License](http://img.shields.io/badge/license-MIT-blue.svg)][license]
7
+ <p align="center"><b>Ruby-based framework for acceptance testing of web applications.</b></p>
10
8
 
11
- [gem]: https://rubygems.org/gems/howitzer
12
- [travis]: https://travis-ci.org/strongqa/howitzer
13
- [gemnasium]: https://gemnasium.com/strongqa/howitzer
14
- [codeclimate]: https://codeclimate.com/github/romikoops/howitzer
15
- [coveralls]: https://coveralls.io/r/strongqa/howitzer?branch=master
16
- [license]: https://github.com/strongqa/howitzer/blob/master/LICENSE
9
+ <p align="center">The framework was built with modern patterns, techniques, and tools in automated testing in order to speed up tests development and simplify supporting.</p>
17
10
 
18
- Howitzer is a Ruby-based framework for acceptance testing.
11
+ <p align="center">
12
+ <a href="https://gitter.im/strongqa/howitzer"><img src="https://badges.gitter.im/Join%20Chat.svg" /></a>
13
+ <a href="https://rubygems.org/gems/howitzer"><img src="http://img.shields.io/gem/v/howitzer.svg" /></a>
14
+ <a href="https://travis-ci.org/strongqa/howitzer"><img src="https://travis-ci.org/strongqa/howitzer.svg?branch=master" /></a>
15
+ <a href='https://gemnasium.com/strongqa/howitzer'><img src="https://gemnasium.com/strongqa/howitzer.svg" /></a>
16
+ <a href="https://codeclimate.com/github/strongqa/howitzer"><img src="https://codeclimate.com/github/strongqa/howitzer.png" /></a>
17
+ <a href='https://coveralls.io/github/strongqa/howitzer?branch=master'><img src='https://coveralls.io/repos/github/strongqa/howitzer/badge.svg?branch=master' alt='Coverage Status' /></a>
18
+ <a href="https://github.com/strongqa/howitzer/blob/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg" /></a>
19
+ </p>
19
20
 
20
- It was originally developed for testing web applications, but you can also use it for API testing and web service testing.
21
-
22
- The framework was built with modern patterns, techniques, and tools in automated testing. For details, please see [Test Framework Design](https://github.com/strongqa/howitzer/wiki/Test-Framework-Design).
21
+ </p>
23
22
 
24
23
  ## Key Benefits
25
- - Independent of test web application, its technologies and lanquage.
26
- - Fast installation of the complete testing infrastructure (takes less than 5 minutes).
27
- - Flexible configuration of the test framework.
28
- - Possibility to choose between Cucumber or RSpec BDD tool.
24
+ - Independent of a web application technical stack, language and architecture.
25
+ - Fast installation and configuration of the complete testing infrastructure (takes less than 5 minutes).
26
+ - Elegant, intuitive and powerful Ruby language underneath.
27
+ - Possibility to choose your favorite BDD tool (Cucumber, RSpec or Turnip).
29
28
  - Integration with SauceLabs, Testingbot, BrowserStack and MailGun web services.
30
- - Easy tests support.
29
+ - Easy tests support based on the best patterns, techniques, principles.
31
30
  - Ability to execute tests against to both browserless driver and actual browsers with no changes in your tests.
32
- - Searches for broken links.
33
-
34
31
 
35
32
  ## Documentation
36
- Refer to the [GETTING STARTED](http://rubydoc.info/gems/howitzer/file/GETTING_STARTED.md) document to start working with *Howitzer*.
33
+ Refer to the [GETTING STARTED](http://docs.howitzer-framework.io) document to start working with *Howitzer*.
37
34
 
38
35
  You can also find the Rdoc documentation on [Rubygems](https://rubygems.org/gems/howitzer).
39
36
 
40
37
  ## Related Products
41
- * [Howitzer Example](https://github.com/strongqa/howitzer_example) – an example of Howitzer based project for demo web application.
42
- * [Howitzer Stat](https://github.com/strongqa/howitzer_stat) – is the extension to Howitzer product. It is used for automated tests coverage visualization of web pages.
38
+ * [Howitzer Example RSpec](https://github.com/strongqa/howitzer_example_rspec) – an example of Howitzer based project for demo web application based on RSpec.
39
+ * [Howitzer Example Cucumber](https://github.com/strongqa/howitzer_example_cucumber) – an example of Howitzer based project for demo web application based on Cucumber.
40
+ * [Howitzer Example Turnip](https://github.com/strongqa/howitzer_example_turnip) – an example of Howitzer based project for demo web application based on Turnip.
43
41
 
44
42
  ## Requirements
45
43
  * Supported OS: Mac OS X, Linux, Windows
46
- * [Ruby](https://www.ruby-lang.org/en/downloads/) 1.9.3+
44
+ * [Ruby](https://www.ruby-lang.org/en/downloads/) 2.2.2+
47
45
  * [DevKit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#installation-instructions) (For **Windows** only)
48
- * [PhantomJS](http://phantomjs.org/download.html)
49
- * [ChromeDriver](https://code.google.com/p/selenium/wiki/ChromeDriver)
46
+ * [PhantomJS](http://phantomjs.org/download.html) (For **phantomjs** and **poltergeist** drivers only)
47
+ * [ChromeDriver](https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver)
50
48
  * [QT](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit) (For **webkit** driver only)
51
49
 
52
50
  ## Setup
@@ -59,47 +57,22 @@ gem install howitzer
59
57
  ## Usage
60
58
  Browse to a desired directory where a new project will be created.
61
59
 
62
- To deploy the framework with Cucumber, type:
60
+ To generate the project with [Cucumber](https://cucumber.io/), type:
63
61
 
64
62
  ```bash
65
63
  howitzer new <PROJECT NAME> --cucumber
66
64
  ```
67
65
 
68
- The following folders and files will be generated:
69
- ```
70
- config/
71
- cucumber.yml
72
- default.yml
73
- custom.yml
74
- tasks/
75
- common.rake
76
- cucumber.rake
77
- rspec.rake
78
- emails/
79
- example_email.rb
80
- features/
81
- support/env.rb
82
- step_definitions/common_steps.rb
83
- example.feature
84
- pages/
85
- example_page.rb
86
- example_menu.rb
87
- boot.rb
88
- Gemfile
89
- Rakefile
90
- .gitignore
91
- ```
92
-
93
- With Rspec:
66
+ With [Rspec](http://rspec.info/):
94
67
 
95
68
  ```bash
96
69
  howitzer new <PROJECT NAME> --rspec
97
70
  ```
98
71
 
99
- With both Cucumber and Rspec:
72
+ With [Turnip](https://github.com/jnicklas/turnip):
100
73
 
101
74
  ```bash
102
- howitzer new <PROJECT NAME> --cucumber --rspec
75
+ howitzer new <PROJECT NAME> --turnip
103
76
  ```
104
77
 
105
78
  **Configuration**
@@ -108,19 +81,26 @@ Learn and specify correct default settings in the `config/default.yml` file. For
108
81
 
109
82
  ## Test Implementation Workflow
110
83
 
111
- - Prepare features and scenarios
112
- - Implement appropriate pages in the `pages` folder. For details, refer to [Page Object Pattern](https://github.com/strongqa/howitzer/wiki/PageObject-pattern).
113
- - Implement emails in `emails` folder.
84
+ - Prepare BDD feature with scenarios
85
+ - Mark feature/scenarios with priority tags.
86
+ - Implement prerequisites generation (optional):
87
+ * implement factories
88
+ * implement models
89
+ - Implement appropriate pages in the `web/pages` folder. For details, refer to [Page Object Pattern](https://github.com/strongqa/howitzer/wiki/PageObject-pattern).
90
+ - Implement emails in `emails` folder (optional).
114
91
  - Implement scenarios:
115
92
  * For Cucumber:
116
93
  1. Read and learn [Cucumber Best Practices](https://github.com/strongqa/howitzer/wiki/Cucumber-Best-Practices)
117
- 2. Implement step definitions in the `features/step_definitions/common_steps.rb` file.
94
+ 2. Implement step definitions in the `features/step_definitions` folder.
118
95
  * For Rspec: Use [DSL](https://github.com/jnicklas/capybara/blob/master/lib/capybara/rspec/features.rb) provided by Capybara to create descriptive acceptance tests.
119
- - Debug feature against to desired driver.
96
+ * For Turnip: Implement step definitions in the `spec/steps` folder.
97
+ - Debug features against to desired drivers.
120
98
  - Enjoy it!
121
99
 
122
100
  ## Rake Tasks
123
101
 
102
+ [Rake](https://ruby.github.io/rake/) was originally created to handle software build processes, but the combination of convenience and flexibility that it provides has made it the standard method of job automation for Ruby projects.
103
+
124
104
  You can get a list of all available tasks by typing the following command:
125
105
 
126
106
  ```bash
@@ -131,25 +111,15 @@ rake -T
131
111
  ## Upgrading Howitzer
132
112
  Before attempting to upgrade an existing project, you should be sure you have a good reason to upgrade. You need to balance several factors: the need for new features, the increasing difficulty of finding support for old code, and your available time and skills, to name a few.
133
113
 
134
- From version _v1.1.0_ howitzer provides **howitzer update** command. After updating the Howitzer version in the Gemfile, run this rake task. This will help you with the creation of new files and changes of old files in an interactive session.
114
+ From version _v1.1.0_ howitzer provides **howitzer update** command. After updating the Howitzer version in the Gemfile, run following commands:
135
115
 
136
116
  ```
137
- $ howitzer update
138
- * Config files generation ...
139
- Identical 'config/custom.yml' file
140
- Added 'config/default.yml' file
141
- * Root files generation ...
142
- Added '.gitignore' file
143
- Conflict with 'Gemfile' file
144
- Overwrite 'Gemfile' file? [Yn]:Y
145
- Forced 'Gemfile' file
146
- Identical 'Rakefile' file
147
- Conflict with 'boot.rb' file
148
- Overwrite 'boot.rb' file? [Yn]:n
149
- Skipped 'boot.rb' file
150
-
151
- ...
117
+ bundle update howitzer
118
+ bundle exec howitzer update
152
119
  ```
120
+
121
+ This will help you with the creation of new files and changes of old files in an interactive session.
122
+
153
123
  Don't forget to review the difference, to see if there were any unexpected changes and merge them. It is easy if your project is under revision control systems like _Git_.
154
124
 
155
125
  ## Additional Information
@@ -161,7 +131,7 @@ Don't forget to review the difference, to see if there were any unexpected chang
161
131
  Contributing
162
132
  ------------
163
133
 
164
- Please see [CONTRIBUTING.md](https://github.com/strongqa/howitzer/blob/master/CONTRIBUTING.md).
134
+ Please see [CONTRIBUTING.md](CONTRIBUTING.md).
165
135
 
166
136
  howitzer was originally designed by Roman Parashchenko and is now maintained by StrongQA team. You can find list of contributors here [open source
167
137
  community](https://github.com/strongqa/howitzer/graphs/contributors).
@@ -169,14 +139,14 @@ community](https://github.com/strongqa/howitzer/graphs/contributors).
169
139
  License
170
140
  -------
171
141
 
172
- howitzer is Copyright © 2012-2015 Roman Parashchenko and StrongQA. It is free
142
+ howitzer is Copyright © 2012-2016 Roman Parashchenko and StrongQA Ltd. It is free
173
143
  software, and may be redistributed under the terms specified in the
174
- [LICENSE](/LICENSE) file.
144
+ [LICENSE](LICENSE) file.
175
145
 
176
146
  About StrongQA
177
147
  ----------------
178
148
 
179
- ![StrongQA](http://strongqa.com/head_logo_big.png)
149
+ ![StrongQA](https://github.com/strongqa/howitzer/blob/gh-pages/images/strongqa-logo.png)
180
150
 
181
151
  howitzer is maintained and funded by StrongQA, Ltd.
182
152
  The names and logos for StrongQA are trademarks of StrongQA, Ltd.
data/Rakefile CHANGED
@@ -1,22 +1,22 @@
1
1
  require 'rubygems'
2
- require "bundler"
2
+ require 'bundler'
3
3
  Bundler.setup
4
4
 
5
5
  require 'rake'
6
6
  require 'yard'
7
7
  require 'rspec/core/rake_task'
8
8
  require 'cucumber/rake/task'
9
+ require 'rubocop/rake_task'
10
+
9
11
  Bundler::GemHelper.install_tasks
10
- RSpec::Core::RakeTask.new(:spec) { |spec| }
12
+ RSpec::Core::RakeTask.new(:spec) { |_spec| }
11
13
 
12
14
  Cucumber::Rake::Task.new(:cucumber, 'Run all cucumber features') do |t|
13
15
  t.fork = false
14
16
  end
15
17
 
16
- desc "All tests"
17
- task(all_tests: [:spec, :cucumber]) {}
18
+ YARD::Rake::YardocTask.new { |_t| }
18
19
 
19
- YARD::Rake::YardocTask.new do |t|
20
- end
20
+ RuboCop::RakeTask.new
21
21
 
22
- task :default => :all_tests
22
+ task default: [:rubocop, :spec, :cucumber]
@@ -2,8 +2,8 @@
2
2
  require 'gli'
3
3
  require_relative '../lib/howitzer/version'
4
4
 
5
+ # Howitzer Command line interface
5
6
  module HowitzerCli
6
-
7
7
  extend GLI::App
8
8
  synopsis_format :compact
9
9
  program_desc 'Ruby based framework for acceptance testing'
@@ -13,30 +13,39 @@ module HowitzerCli
13
13
  arg_name '<PROJECT NAME>'
14
14
  command :new do |c|
15
15
  c.desc 'Integrate Cucumber'
16
- c.switch [:c, :cucumber] , negatable: false
16
+ c.switch [:c, :cucumber], negatable: false
17
17
 
18
18
  c.desc 'Integrate Rspec'
19
19
  c.switch [:r, :rspec], negatable: false
20
20
 
21
- c.action do |global_options, options, args|
22
- if args.size > 0
21
+ c.desc 'Integrate Turnip'
22
+ c.switch [:t, :turnip], negatable: false
23
+
24
+ c.action do |_global_options, options, args|
25
+ if !args.empty?
23
26
  validate_options(options)
24
27
  load_generators
25
28
  path_to_dir = File.join(Dir.pwd, args.first)
26
- puts " * New project directory creation ..."
29
+ puts ' * New project directory creation ...'
27
30
  Dir.mkdir(path_to_dir)
28
31
  puts " Created new './#{args.first}' folder"
29
32
  Dir.chdir(path_to_dir)
30
- Howitzer::ConfigGenerator.new
31
- Howitzer::PagesGenerator.new
32
- Howitzer::TasksGenerator.new
33
- Howitzer::EmailsGenerator.new
34
- Howitzer::RootGenerator.new
35
- Howitzer::CucumberGenerator.new if options['cucumber']
36
- Howitzer::RspecGenerator.new if options['rspec']
37
- puts "[WARN] Extra parameters were skipped" if args.size > 1
33
+ Howitzer::ConfigGenerator.new(options)
34
+ Howitzer::WebGenerator.new(options)
35
+ Howitzer::TasksGenerator.new(options)
36
+ Howitzer::EmailsGenerator.new(options)
37
+ Howitzer::RootGenerator.new(options)
38
+ Howitzer::PrerequisitesGenerator.new(options)
39
+ if options[:cucumber]
40
+ Howitzer::CucumberGenerator.new(options)
41
+ elsif options[:rspec]
42
+ Howitzer::RspecGenerator.new(options)
43
+ elsif options['turnip']
44
+ Howitzer::TurnipGenerator.new(options)
45
+ end
46
+ puts '[WARN] Extra parameters were skipped' if args.size > 1
38
47
  elsif args.size.zero?
39
- exit_now!("Please specify <PROJECT NAME>", 64)
48
+ exit_now!('Please specify <PROJECT NAME>', 64)
40
49
  end
41
50
  end
42
51
  end
@@ -44,22 +53,34 @@ module HowitzerCli
44
53
  desc 'Upgrade existing project'
45
54
  command :update do |c|
46
55
  c.action do
47
- check_project_presence
48
- load_generators
49
- Howitzer::ConfigGenerator.new
50
- Howitzer::RootGenerator.new
51
- Howitzer::CucumberGenerator.new if cucumber_integrated?
52
- Howitzer::RspecGenerator.new if rspec_integrated?
56
+ check_project_presence
57
+ load_generators
58
+ Howitzer::ConfigGenerator.new
59
+ Howitzer::WebGenerator.new
60
+ Howitzer::TasksGenerator.new
61
+ Howitzer::EmailsGenerator.new
62
+ Howitzer::PrerequisitesGenerator.new
63
+ if cucumber_integrated?
64
+ Howitzer::RootGenerator.new(cucumber: true)
65
+ Howitzer::CucumberGenerator.new
66
+ elsif rspec_integrated?
67
+ Howitzer::RootGenerator.new(rspec: true)
68
+ Howitzer::RspecGenerator.new
69
+ elsif turnip_integrated?
70
+ Howitzer::RootGenerator.new(turnip: true)
71
+ Howitzer::TurnipGenerator.new
72
+ end
53
73
  end
54
74
  end
55
75
 
56
- #helpers
76
+ # helpers
57
77
  class << self
58
78
  private
79
+
59
80
  def validate_options(options)
60
- if !options['cucumber'] && !options['rspec']
61
- exit_now!("Provide --cucumber and/or --rspec option", 64)
62
- end
81
+ return if [options[:cucumber], options[:rspec], options[:turnip]].count { |el| el } == 1
82
+
83
+ exit_now!('Provide --cucumber, --rspec or --turnip option', 64)
63
84
  end
64
85
 
65
86
  def check_project_presence
@@ -67,23 +88,27 @@ module HowitzerCli
67
88
  end
68
89
 
69
90
  def howitzer_project?
70
- Dir.exists?('pages') && Dir.exists?('config') && File.exists?('boot.rb')
91
+ (Dir.exist?('web') || Dir.exist?('pages')) && Dir.exist?('config')
71
92
  end
72
93
 
73
94
  def load_generators
74
- Dir[File.join(File.dirname(__FILE__), '..', 'generators', '**', '*_generator.rb')].each{ |f| require File.expand_path(f) }
95
+ Dir[
96
+ File.join(__dir__, '..', 'generators', '**', '*_generator.rb')
97
+ ].each { |f| require File.expand_path(f) }
75
98
  end
76
99
 
77
100
  def cucumber_integrated?
78
- Dir.exists?('features')
101
+ Dir.exist?('features')
79
102
  end
80
103
 
81
104
  def rspec_integrated?
82
- Dir.exists?('spec')
105
+ File.exist?('spec/spec_helper.rb') && !File.exist?('spec/turnip_helper.rb')
106
+ end
107
+
108
+ def turnip_integrated?
109
+ File.exist?('spec/spec_helper.rb') && File.exist?('spec/turnip_helper.rb')
83
110
  end
84
111
  end
85
112
  end
86
113
 
87
- unless ENV['TEST_MODE']
88
- exit(HowitzerCli.run(ARGV))
89
- end
114
+ exit(HowitzerCli.run(ARGV)) unless ENV['TEST_MODE']