bddfire 1.9.7 → 1.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +5 -13
  2. data/Gemfile +1 -2
  3. data/README.markdown +68 -37
  4. data/Rakefile +4 -4
  5. data/bddfire.gemspec +19 -16
  6. data/bin/bddfire +116 -106
  7. data/features/step_definitions/all_steps.rb +1 -4
  8. data/features/support/env.rb +4 -4
  9. data/lib/bddfire/accesibility/axe.rb +40 -0
  10. data/lib/bddfire/assertions/assert.rb +2 -2
  11. data/lib/bddfire/page-objects/HomePage.rb +7 -9
  12. data/lib/bddfire/require.rb +5 -4
  13. data/lib/bddfire/version.rb +1 -1
  14. data/lib/bddfire/web/browser_actions.rb +1 -1
  15. data/lib/bddfire/web/headless_steps.rb +9 -10
  16. data/lib/bddfire/web/web_methods.rb +4 -5
  17. data/lib/bddfire/web/web_steps.rb +3 -3
  18. data/lib/bddfire.rb +1 -3
  19. data/pre-defined-steps/accessibility_steps.md +24 -0
  20. data/pre-defined-steps/capybara_steps.md +1 -1
  21. data/scaffold/accessibility/features/01_validation.feature +6 -0
  22. data/scaffold/accessibility/features/02_javascript.feature +6 -0
  23. data/scaffold/accessibility/features/03_language.feature +9 -0
  24. data/scaffold/accessibility/features/04_page_titles.feature +7 -0
  25. data/scaffold/accessibility/features/05_main_landmark.feature +7 -0
  26. data/scaffold/accessibility/features/06_headings.feature +7 -0
  27. data/scaffold/accessibility/features/07_minimum_resizable_text.feature +8 -0
  28. data/scaffold/accessibility/features/08_tabindex.feature +6 -0
  29. data/scaffold/accessibility/features/09_focusable_controls.feature +9 -0
  30. data/scaffold/accessibility/features/10_color_contrast.feature +10 -0
  31. data/scaffold/accessibility/features/11_image.feature +10 -0
  32. data/scaffold/accessibility/features/12_form.feature +11 -0
  33. data/scaffold/accessibility/features/13_table.feature +10 -0
  34. data/scaffold/accessibility/features/general_accessibility_check.feature +9 -0
  35. data/scaffold/accessibility/features/step_definitions/base.rb +22 -0
  36. data/scaffold/accessibility/features/step_definitions/form.rb +0 -0
  37. data/scaffold/accessibility/features/step_definitions/headings.rb +7 -0
  38. data/scaffold/accessibility/features/step_definitions/image.rb +0 -0
  39. data/scaffold/accessibility/features/step_definitions/javascript.rb +3 -0
  40. data/scaffold/accessibility/features/step_definitions/language.rb +0 -0
  41. data/scaffold/accessibility/features/step_definitions/main_landmark.rb +15 -0
  42. data/scaffold/accessibility/features/step_definitions/minimum_resizable_text.rb +11 -0
  43. data/scaffold/accessibility/features/step_definitions/page_title.rb +10 -0
  44. data/scaffold/accessibility/features/step_definitions/tabindex.rb +3 -0
  45. data/scaffold/accessibility/features/step_definitions/table.rb +0 -0
  46. data/scaffold/accessibility/features/step_definitions/validation.rb +4 -0
  47. data/scaffold/accessibility/features/support/capybara.rb +42 -0
  48. data/scaffold/config_files/.rubocop.yml +5 -5
  49. data/scaffold/config_files/Dockerfile +24 -0
  50. data/scaffold/config_files/Gemfile +9 -5
  51. data/scaffold/config_files/Rakefile +36 -32
  52. data/scaffold/config_files/docker.sh +82 -0
  53. data/scaffold/features/pages/HomePage.rb +10 -10
  54. data/scaffold/features/support/env.rb +128 -130
  55. data/scaffold/features/support/hooks.rb +5 -6
  56. data/scaffold/load/Dockerfile +28 -0
  57. data/scaffold/load/README.md +31 -0
  58. data/scaffold/load/conf/application.conf +7 -0
  59. data/scaffold/load/conf/gatling.conf +157 -0
  60. data/scaffold/load/conf/logback.xml +22 -0
  61. data/scaffold/load/conf/recorder.conf +51 -0
  62. data/scaffold/load/docker-jenkins.sh +77 -0
  63. data/scaffold/load/gatling_jenkins.sh +28 -0
  64. data/scaffold/load/gatling_local.sh +29 -0
  65. data/scaffold/load/user-files/bodies/.keep +0 -0
  66. data/scaffold/load/user-files/data/search.csv +2 -0
  67. data/scaffold/load/user-files/simulations/SampleLoadTEST.scala +22 -0
  68. data/scaffold/rake_tasks/cucumber.rb +2 -3
  69. data/scaffold/rake_tasks/cuke_sniffer.rb +3 -3
  70. data/scaffold/rake_tasks/rspec.rb +3 -4
  71. data/scaffold/rake_tasks/rubocop.rb +4 -5
  72. data/scaffold/rake_tasks/yard.rb +3 -4
  73. metadata +142 -55
  74. data/scaffold/config_files/.ruby-version +0 -1
  75. data/scaffold/config_files/.travis.yml +0 -16
  76. data/scaffold/features/pages/Abstract.rb +0 -14
  77. data/scaffold/features/support/helpers.erb +0 -6
  78. data/scaffold/features/support/responsive.rb +0 -19
  79. data/scaffold/lib/project/version.erb +0 -3
  80. data/scaffold/lib/project.erb +0 -2
  81. data/scaffold/spec/spec_helper.rb +0 -8
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Y2ZkZDFmYmMyOGVlNDc3NzJjYjhjYjQ0MmMwN2RmYjlkZmYzNDExZg==
5
- data.tar.gz: !binary |-
6
- OTEwZGNhNWMxMWRhOGNiNjgzMzI2YzU3MWYxYzc1N2ZhNzAzNDExNw==
2
+ SHA1:
3
+ metadata.gz: b1f394078b63dc1c8bc662b060f3f50cb6e8fb40
4
+ data.tar.gz: 388c75bdbf8a5e0d102449c2101bea4242d1ab08
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NDU2NGIzMmQyNjc1MzM1OThhNzEyM2NmNzcyZDMyOTUwM2JlODU3MzkwZGQz
10
- YWRjMThjMzI4OTNiNjE5OTYyNGI5MTU4MTQwZWY2Yjc5MWNkNDFhZTU5YzE5
11
- NTRlZTQzMzkzYzgyODRhMWU0MTNiYzIzZmM3MWIxY2JlMGViN2M=
12
- data.tar.gz: !binary |-
13
- MWYzMGFhMDU4ODQ5Njg0ZmM5MTlhYWI3NzdjN2FlYmUxNjA0MmJhNjM1MjQx
14
- NWRhYzgxZTk4NGRiN2EzMDYwMDA5NGRhYmFlMGFkNDAyOWUzMGMwMTg4MDRl
15
- Njc4MTdjY2U1N2I4ZmI0NzgwOTJiNTk2YzNhNGJmYmY4YzA5OTE=
6
+ metadata.gz: 922b5480b4017f32d64b151f50c0b17e5a42d7e5e87077c76a8b197c86fde9ca9db979e7f23b4cbb50e05b0c25f1fea8eb752adae5cb9b5009d4a8eef42c4c0e
7
+ data.tar.gz: 2702bd41818cf7b559237cfa289f7785f41a6bd69e0d7f6c7648d05013e1e2e420de92f2e820448ee9519496ab5f4dadc86c71e307f08f1c6b79c76dfafad50a
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
  gemspec
3
-
data/README.markdown CHANGED
@@ -1,12 +1,12 @@
1
1
  # bddfire
2
2
 
3
- BDDfire: Automate Mobile & Web apps with less code. An instant Ruby-Cucumber BDD framework which supports various popular open-source libraries like Capybara, Selenium-WebDriver, Poltergeist, Relish, Cuke_sniffer, Rubocop, Appium, Saucelabs, Browserstack.Generate default toolkit around BDD with cucumber and friends
3
+ BDDfire: Automate Mobile & Web apps with less code. An instant Ruby-Cucumber BDD framework which supports various popular open-source libraries like Capybara, Selenium-WebDriver, Poltergeist, Relish, Cuke_sniffer, Rubocop, Appium, Saucelabs, Browserstack. Generate default toolkit around BDD with cucumber and friends. It also added support for Docker, Gatling, Axe Accessibility Engine
4
4
 
5
- ### ===BDDfire: Write your tests not Framework===
5
+ ### ***** BDDfire: Instant Ruby-Cucumber Framework with Docker, Gatling, Accessibility Support************
6
6
 
7
7
  ## Installation
8
8
 
9
- The usual:
9
+ Assuming you got Ruby installed. You can run
10
10
 
11
11
  $ gem install bddfire
12
12
 
@@ -16,35 +16,52 @@ or include it into the Gemfile
16
16
 
17
17
  ## Usage
18
18
 
19
- In your project's root directory...
20
-
21
19
  ### Instant Ruby Cucumber Framework
22
20
 
23
21
  $ bddfire fire_cucumber
24
22
 
25
23
 
26
- This will create 'cucumber' direcory and one command will install Ruby Cucumber framework with all possibly supported tools in the 'cucumber' directory. This will create all the directories and files to support following tools
24
+ This will create 'cucumber' directory and one command will install Ruby Cucumber framework with all possibly supported tools in the 'cucumber' directory. This will create all the directories and files to support following tools
27
25
  * Capybara
28
26
  * Selenium-Webdriver
29
27
  * Poltergeist: PhantomJS based headless driver for capybara
28
+ * Docker support to execute scenarios inside docker containers
30
29
  * Run scenarios in parallel 10 processes and rerun failed scenarios.
31
30
  * Appium : Mobile test automation Framework
32
31
  * Saucelabs : Cloud testing framework
33
32
  * Browserstack : Cloud testing framework
34
33
  * TestingBot : Cloud testing framework
35
- * Relish : Living Documenation
34
+ * Relish : Living Documentation
36
35
  * Yard : Cucumber documentation
37
36
  * Rubocop : Ruby code review tool
38
37
  * CI Support Script
39
38
 
39
+ ## Load Testing : Gatling
40
+ You can optionally install Gatling load testing setup.
41
+
42
+ $ bddfire fire_load
43
+ It will setup Load testing environment with gatling. It will create 'load' directory. It's optional but BDDfire will support it to execute your load tests.
44
+
45
+ ## Accessibility Testing : Axe Engine
46
+ You can optionally setup Accessibility Testing setup support Axe Engine
47
+
48
+ $ bddfire fire_accessibility
40
49
 
41
- If you don't already have a `Gemfile` or `Rakefile`, one will be created.
50
+ It will setup accessibility frameworks in the 'accessibility' directory. It uses Axe engine to run accessibility tests.
51
+
52
+ ## Docker Support
53
+
54
+ BDDfire allow you execute your cucumber scenarios inside Docker containers. Scenarios with Poltergeist driver can be ran inside containers. One script will do everything for you !
42
55
 
43
56
 
44
57
  ### Install & Run BDDfire framework
45
58
 
59
+ Install your skeleton framework with BDDfire
46
60
 
47
- Now, we need to run bundle install [Fix nokogiri error if you get any by using supported nokogiri version]
61
+ $ bddfire fire_cucumber
62
+ $ bddfire fire_load
63
+ $ bddfire fire_accessibility
64
+ Now you should have your framework ready inside 'cucumber' directory. Just install predefine Gems or you can add your own Gems.
48
65
 
49
66
  $ cd cucumber
50
67
  $ bundle install
@@ -52,54 +69,49 @@ Now, we need to run bundle install [Fix nokogiri error if you get any by using s
52
69
  Once installed, you can run cucumber with multiple cabybara driver
53
70
 
54
71
  #Usage
55
- ### Pre-defined-steps
72
+ ## BDDfire Pre-defined-steps
73
+ BDDfire allow us to use predefined steps so that we don't have to write more code while writing cucumber steps. BDDfire has following predefined steps which can be used anytime during your project.
74
+
75
+ ### Browser Based Pre-defined-steps
76
+
56
77
  You can use[Browser based](https://github.com/Shashikant86/bddfire/blob/master/pre-defined-steps/capybara_steps.md) steps
78
+
79
+ ### Poltergeist Based Pre-defined-steps
57
80
  You can use headless Poltergeist based [headless Poltergeist based](https://github.com/Shashikant86/bddfire/blob/master/pre-defined-steps/headless_steps.md) steps
58
81
 
82
+ ### Accessibility related Pre-defined-steps
83
+
84
+ You can also use [Accessibility steps](https://github.com/Shashikant86/bddfire/blob/major-refactor/pre-defined-steps/accessibility_steps.md)
85
+
59
86
  ### Parallel Cucumber & Re-run Failed
87
+
60
88
  You can run entire test suite in 10 different processes but you can increase number of processes. The reports are generated for each process. If any scenario failed it will re-run. It will use poltergeist by default but you can change in Rakefile
61
89
 
62
- $ rake parallel_cucumber
90
+ $ bundle exec rake parallel_cucumber
63
91
 
64
- ###Selenium Firefox
92
+ ### Selenium Firefox
65
93
  You can use selenium driver to run scenario in browser [firefox].
66
94
 
67
- $ rake selenium
68
-
69
- You can run cucumber with profile like this
70
-
71
- $ bundle exec cucumber -p selenium
95
+ $ bundle exec rake selenium
72
96
 
73
97
  ###Headless Poletergeist
74
98
  You can use PhantomJS based Capybara driver Poltergeist driver.
75
99
 
76
-
77
- You can run cucumber with profile like this
78
-
79
- $ bundle exec cucumber -p poltergeist
80
-
81
- OR
82
-
83
- $ rake poltergeist
100
+ $ bundle exec rake poltergeist
84
101
 
85
102
  ###Chrome Driver
86
103
  You can run your scenarios in Google Chrome
87
104
 
88
- $ rake poltergeist
89
- You can run cucumber with profile like this
90
-
91
- $ bundle exec cucumber -p chrome
92
-
105
+ $ bundle exec rake chrome
93
106
 
94
107
  ###Cloud Testing Frameworks
95
108
  Please enter your USERNAME and KEY in the env.rb file
96
109
 
97
- $ rake sauce/browserstack/testingbot
98
- OR
110
+ $ bundle exec rake sauce/browserstack/testingbot
99
111
 
100
- $ bundle exec cucumber -p sauce/browserstack/testingbot
101
112
 
102
113
  ###Appium:
114
+
103
115
  Run Appium server in the background.
104
116
 
105
117
  $ npm install
@@ -117,6 +129,7 @@ OR
117
129
  $ bundle exec cucumber -p appium
118
130
 
119
131
  ###Cuke_sniffer
132
+
120
133
  You can use cuke_sniffer to detect smells in your Cucumber. It will generate reports in the cuke_sniffer.html in the 'reports' directory.
121
134
 
122
135
  $ rake cuke_sniffer
@@ -126,15 +139,33 @@ You can use cuke_sniffer to detect smells in your Cucumber. It will generate rep
126
139
  You can use rubocop to detect ruby errors in your Ruby file
127
140
 
128
141
  $ rake rubocop
142
+
129
143
  This will report all the offence in rubocop.
130
144
 
131
- ## CI Integration
132
145
 
133
- Currently, you can use the script 'ci_script' on Jenkins or Hudson. More CI Integration is on the way.
146
+ ## Docker
147
+
148
+ We can run our cucumber scenario inside Docker containers. Assuming you have Docker installed. Check your Docker installation before using.
149
+
150
+ $ bundle exec rake docker
151
+ This will build Docker image 'bddfire-ci' and run cucumber scenarios inside container 'bddfire-ci'.
152
+
153
+ ## Gatling
154
+
155
+ You can use Gatling setup to execute load tests against your endpoints. Simply change 'load/user-files/simulation/SampleLoadTEST.scala' file and puts your URL to Test as base URL.
156
+
157
+ $ cd load
158
+ $ sh gatling_local.sh
159
+ This will run load tests against your url. You are free to record new simulations. Once finished there will be link to HTML report at the end.
160
+
161
+ There is CI integration to plug it with jenkins.
162
+
163
+ ## Accessibility Testing : Axe
164
+
165
+ We can run accessibility checks on our web page using BDDfire. You have to pass URL as environment variable e.g
134
166
 
135
- You need pass rake rask to the script
167
+ $ bundle exec cucumber accessibility/features URL="http://www.google.co.uk"
136
168
 
137
- $ ./ci_script features
138
169
 
139
170
 
140
171
  # TODO
data/Rakefile CHANGED
@@ -8,12 +8,12 @@ Bundler::GemHelper.install_tasks
8
8
  # Cucumber tasks
9
9
  require 'cucumber/rake/task'
10
10
  YARD::Rake::YardocTask.new(:yard) do |t|
11
- t.files = ['features/**/*.feature', 'features/**/*.rb']
12
- #t.options = ['--any', '--extra', '--opts'] # optional
11
+ t.files = ['features/**/*.feature', 'features/**/*.rb']
12
+ # t.options = ['--any', '--extra', '--opts'] # optional
13
13
  end
14
14
 
15
15
  Cucumber::Rake::Task.new(:features) do |t|
16
- t.cucumber_opts = "features --format pretty"
16
+ t.cucumber_opts = 'features --format pretty'
17
17
  end
18
18
 
19
- task :default => [:features]
19
+ task default: [:features]
data/bddfire.gemspec CHANGED
@@ -1,26 +1,29 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "bddfire/version"
2
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
+ require 'bddfire/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "bddfire"
6
+ s.name = 'bddfire'
7
7
  s.version = BDDfire::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Shashikant Jagtap"]
10
- s.email = ["shashikant.jagtap@aol.co.uk"]
11
- s.homepage = "https://github.com/Shashikant86/bddfire"
12
- s.license = 'MIT'
9
+ s.authors = ['Shashikant Jagtap']
10
+ s.email = ['shashikant.jagtap@aol.co.uk']
11
+ s.homepage = 'https://github.com/Shashikant86/bddfire'
12
+ s.license = 'MIT'
13
13
  s.required_ruby_version = '>= 1.9.3'
14
- s.summary = "BDDfire: Automate Mobile & Web apps with less code. An instant Ruby-Cucumber BDD framework"
15
- s.description = %q{BDDfire: Automate Mobile and Web apps with less code - Instant BDD framework with Ruby, Cucumber, Capybara, selenium, Appium, Saucelabs, Browserstack, Testingbot, poltergeist, cuke_sniffer, rubocop, relish, yard and many more awesome libraries}
16
- s.add_runtime_dependency "cucumber", '~> 1.3', '>= 1.3.18'
17
- s.add_runtime_dependency "capybara", '~> 2.4.4', '>= 2.4.1'
18
- s.add_runtime_dependency "rspec", '~> 3.2.0', '>= 3.0.0'
19
- s.add_runtime_dependency "selenium-webdriver", '~> 2.44.0', '>= 2.41.0'
14
+ s.summary = 'BDDfire: Automate Mobile & Web apps with less code. An instant Ruby-Cucumber BDD framework'
15
+ s.description = 'BDDfire: Automate Mobile and Web apps with less code - Instant BDD framework with Ruby, Cucumber, Capybara, selenium, Appium, Docker, Gatling and Axe Engine'
16
+ s.add_runtime_dependency "bundler"
17
+ s.add_runtime_dependency "cucumber", '~> 2.3', '>= 2.3'
18
+ s.add_runtime_dependency "capybara", '~> 2.6', '>= 2.4'
19
+ s.add_runtime_dependency "rspec", '~> 3.4', '>= 3.0.0'
20
+ s.add_runtime_dependency "selenium-webdriver", '~> 2.52', '>= 2.52'
21
+ s.add_runtime_dependency "axe-matchers", '~> 1.1.1', '>= 1.0.0'
22
+ s.add_runtime_dependency 'be_valid_asset', '~> 1.3', '>= 1.3.0'
20
23
  s.add_runtime_dependency 'require_all', '~> 1.3.1', '>= 1.3.0'
21
24
  s.files = `git ls-files`.split("\n")
22
25
  s.test_files = `git ls-files -- {features}/*`.split("\n")
23
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
- s.require_paths = ["lib"]
25
- s.post_install_message = "Thanks for installing BDDfire gem. More exciting BDD stuff on the way. Stay Tuned !"
26
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
27
+ s.require_paths = ['lib']
28
+ s.post_install_message = 'Thanks for installing BDDfire gem. BDDfire supports Docker, Load Test and Accessibility Testing'
26
29
  end
data/bin/bddfire CHANGED
@@ -3,126 +3,122 @@ require 'bddfire/version'
3
3
  require 'fileutils'
4
4
  require 'tempfile'
5
5
  require 'json'
6
- require "rubygems"
6
+ require 'rubygems'
7
7
 
8
- lib_dir = File.expand_path("../lib", File.dirname(__FILE__))
9
- $:.unshift lib_dir unless $:.include?(lib_dir)
8
+ lib_dir = File.expand_path('../lib', File.dirname(__FILE__))
9
+ $LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include?(lib_dir)
10
10
 
11
- @root_dir =File.join(FileUtils.pwd, "cucumber")
12
- @root_feature_dir =File.join(@root_dir, "features")
13
- @root_lib_dir =File.join(@root_dir, "lib")
14
- @root_scripts_dir =File.join(@root_dir, "script")
11
+ @root_dir = File.join(FileUtils.pwd, 'cucumber')
12
+ @root_feature_dir = File.join(@root_dir, 'features')
13
+ @root_scripts_dir = File.join(@root_dir, 'script')
14
+ @root_accessibility_dir = File.join(@root_dir, 'accessibility')
15
+ @root_load_dir = File.join(@root_dir, 'load')
15
16
  @source_dir = File.join(File.dirname(__FILE__), '..', 'scaffold')
16
- @source_feature_dir =File.join(@source_dir, "features")
17
- @source_lib_dir =File.join(@source_dir, "lib")
18
- @source_scripts_dir =File.join(@source_dir, "scripts")
19
- @source_config_dir =File.join(@source_dir, "config_files")
17
+ @source_feature_dir = File.join(@source_dir, 'features')
18
+ @source_scripts_dir = File.join(@source_dir, 'scripts')
19
+ @source_config_dir = File.join(@source_dir, 'config_files')
20
+ @source_load_dir = File.join(@source_dir, 'load')
21
+ @source_accessibility_dir = File.join(@source_dir, 'accessibility')
20
22
 
21
23
  def bddfire_scaffold
22
- if File.exists?(@root_feature_dir)
23
- puts "There is already features directory. Please remane existing features directory to carry on "
24
+ if File.exist?(@root_dir)
25
+ puts 'There is already cucumber directory. Please move existing cucumber directory to carry on '
24
26
  exit 1
25
27
  end
26
28
 
27
- msg("Info") do
28
-
29
- puts "=======CREATING 'cucumber' DIRECTORY WITH TEST FRAMEWORK============\n \n \n"
30
- puts "\n"
31
- puts "\n"
32
- sleep (2)
33
- puts "=======Copying all config files for cucumber projects============\n"
34
- sleep (2)
35
- puts "=======Copying Gemfile containing all required Gems============\n"
36
- sleep (2)
37
- puts "=======Copying cucumber.yml file with profiles of all Capybara Drivers============\n"
38
- sleep (2)
39
- puts "=======Copying pakage.json file with required npm dependencies============\n"
40
- sleep (2)
41
- puts "=======Copying README.md file with template usage============\n"
42
- sleep (2)
43
- puts "=======Copying browser.json file with browsers and devices config for cloud testng============\n"
44
- sleep (2)
45
- puts "=======Copying .relish file, you need to add your relish api key============\n"
46
- sleep (2)
47
- puts "=======Copying .rubocop.yml file to check Ruby code============\n"
48
- sleep (2)
49
- puts "=======Copying c.ruby-version file ============\n"
50
- sleep (2)
51
- puts "=======Copying .travis.yml, you can delete if you are using other CI tool============\n"
52
- sleep (2)
53
- puts "=======Copying .yard.yml to generate YARD documentation for your project============\n"
54
- sleep (2)
55
- puts "=======Copying Rakefile to generate Rake tasks ============\n"
56
- sleep (2)
57
- end
58
-
59
29
  FileUtils.cp_r(@source_config_dir, @root_dir)
60
-
61
- msg("Info") do
62
- puts "All Config files created. \n"
30
+ msg ('Info') do
31
+ puts "=======BDDfire is creating 'cucumber' framework. Please have a look which files are being created============\n"
63
32
  end
64
33
 
65
- if File.exists?(@root_feature_dir)
66
- puts "There is already features directory. Please remane existing features directory to carry on "
67
- exit 1
34
+ msg('Gemfile') do
35
+ puts "=======BDDfire created Gemfile containing all required Gems============\n"
68
36
  end
69
-
70
- msg("Info") do
71
- puts "=======Copying features and support directories for cucumber projects============\n"
72
- sleep (2)
73
- puts "=======Copying Pages directories with Page Object Classes============\n"
74
- sleep (2)
75
- puts "=======Copying step_definitions directoy============\n"
76
- sleep (2)
77
- puts "=======Copying Suppoort directory with all Capybara driver setup============\n"
78
- sleep (2)
79
- puts "=======Creating env.rb and setting Selenium, Poltergeist, Saucelabs, Appium, browerstack drivers============\n"
80
- sleep (2)
81
- puts "=======Creating responsive.rb file to run scenarios with different viewports============\n"
82
- sleep (2)
37
+ msg('cucumber.yml') do
38
+ puts "=======BDDfire created cucumber.yml file with profiles of all Capybara Drivers============\n"
83
39
  end
84
-
85
- FileUtils.cp_r(@source_feature_dir, @root_feature_dir)
86
-
87
- msg("Info") do
88
- puts "features and subdirectories created. \n"
40
+ msg('package.json') do
41
+ puts "=======BDDfire created pakage.json file with required npm dependencies============\n"
89
42
  end
90
-
91
- if File.exists?(@root_lib_dir)
92
- puts "There is already lib directory. Please remane existing lib directory to carry on "
93
- exit 1
43
+ msg('README.md') do
44
+ puts "=======BDDfire created README.md file with template usage============\n"
94
45
  end
95
- msg("Info") do
96
- puts "=======Copying lib directory to put ruby config files for cucumber projects============\n"
97
- sleep (2)
46
+ msg('browser.json') do
47
+ puts "=======BDDfire created browser.json file with browsers and devices config for cloud testng============\n"
98
48
  end
99
-
100
- FileUtils.cp_r(@source_lib_dir, @root_lib_dir)
101
-
102
- msg("Info") do
103
- puts "lib subdirectory created. \n"
49
+ msg('.relish') do
50
+ puts "=======BDDfire created .relish file, you need to add your relish api key============\n"
104
51
  end
105
-
106
- if File.exists?(@root_scripts_dir)
107
- puts "There is already scripts directory. Please remane existing scripts directory to carry on "
108
- exit 1
52
+ msg('.rubocop.yml') do
53
+ puts "=======BDDfire created .rubocop.yml file to check Ruby code============\n"
109
54
  end
110
- msg("Info") do
111
- puts "=======Copying lib directory to put ruby config files for cucumber projects============\n"
112
- sleep (2)
55
+ msg('Dockerfile') do
56
+ puts "=======BDDfire created Dockerfile===========\n"
57
+ end
58
+ msg('docker.sh') do
59
+ puts "=======BDDfire created script for Docker ============\n"
60
+ end
61
+ msg('.yard.yml') do
62
+ puts "=======BDDfire created .yard.yml to generate YARD documentation for your project============\n"
63
+ end
64
+ msg('Rakefile') do
65
+ puts "=======BDDfire created Rakefile to generate Rake tasks ============\n"
66
+ end
67
+ msg('Info') do
68
+ puts "All Config files created. \n"
69
+ end
70
+
71
+ FileUtils.cp_r(@source_feature_dir, @root_feature_dir)
72
+ msg('feature directory') do
73
+ puts "=======BDDfire created features and support directories for cucumber projects============\n"
113
74
  end
114
75
 
115
76
  FileUtils.cp_r(@source_scripts_dir, @root_scripts_dir)
116
77
 
117
- msg("Info") do
78
+ msg('Scripts') do
118
79
  puts "Scripts subdirectory created. \n"
119
80
  end
120
81
  end
121
82
 
122
- def msg(title, &block)
123
- puts "\n" + "-"*10 + title + "-"*10
124
- block.call
125
- puts "-"*10 + "-------" + "-"*10 + "\n"
83
+ def msg(title, &_block)
84
+ puts "\n" + '-' * 10 + title + '-' * 10
85
+ yield
86
+ puts '-' * 10 + '-------' + '-' * 10 + "\n"
87
+ sleep 2
88
+ end
89
+
90
+ def install
91
+ msg('Installing BDDfire Dependencies') do
92
+ puts "Wait till bundler finish installtions. \n"
93
+ end
94
+ cmd = 'bundle install --gemfile=$(pwd)/cucumber/Gemfile --path=$(pwd)/cucumber/vendor/'
95
+ system(cmd)
96
+ end
97
+
98
+ def accessibility
99
+ if File.exist?(@root_dir)
100
+ FileUtils.cp_r(@source_accessibility_dir, @root_accessibility_dir)
101
+ msg('Accessibility Setup') do
102
+ puts "Accessibility Setup to run accessibility tests \n"
103
+ end
104
+ else
105
+ msg('BDDfire Voilation') do
106
+ puts "Please run 'fire_cucumber' before 'fire_accessibility' \n"
107
+ end
108
+ end
109
+ end
110
+
111
+ def load
112
+ if File.exist?(@root_dir)
113
+ FileUtils.cp_r(@source_load_dir, @root_load_dir)
114
+ msg('Gatling') do
115
+ puts "Gatling setup to run load tests. \n"
116
+ end
117
+ else
118
+ msg('BDDfire Voilation') do
119
+ puts "Please run 'fire_cucumber' before 'fire_load' \n"
120
+ end
121
+ end
126
122
  end
127
123
 
128
124
  def print_usage
@@ -135,9 +131,14 @@ def print_usage
135
131
  prints more detailed help information.
136
132
  fire_cucumber
137
133
  generate a features folder structure.
134
+ fire_accessibility
135
+ setup accessibility checks with axe-matchers
136
+ fire_load
137
+ setup load and performance tests using Gatling
138
138
  version
139
139
  prints the gem version
140
140
 
141
+
141
142
  <options> can be
142
143
  -v, --verbose Turns on verbose logging
143
144
  EOF
@@ -151,15 +152,21 @@ def print_help
151
152
  <command-name> can be one of
152
153
  help
153
154
  fire_cucumber
155
+ fire_accessibility
156
+ fire_load
154
157
  version
155
158
 
156
159
  Commands:
157
160
  help : prints more detailed help information.
158
161
 
159
162
  fire_cucumber : creates a skeleton features dir. This is usually used once when
160
- setting up selnium-cucumber to ensure that the features folder contains
163
+ setting up project to ensure that the features folder contains
161
164
  the right step definitions and environment to run with cucumber.
162
165
 
166
+ fire_accessibility : setup accessibility checks with axe-matchers
167
+
168
+ fire_load : setup load and performance tests using Gatling
169
+
163
170
  version : prints the gem version
164
171
 
165
172
  <Options>
@@ -167,18 +174,21 @@ def print_help
167
174
  EOF
168
175
  end
169
176
 
170
-
171
- if (ARGV.length == 0)
177
+ if ARGV.length == 0
172
178
  print_usage
173
179
  else
174
- cmd = ARGV.shift
175
- if cmd == "help"
176
- print_help
177
- elsif cmd == "fire_cucumber"
180
+ cmd = ARGV.shift
181
+ if cmd == 'help'
182
+ print_help
183
+ elsif cmd == 'fire_cucumber'
178
184
  bddfire_scaffold
179
- elsif cmd == "version"
180
- puts BDDfire::VERSION
181
- else
182
- print_usage
183
- end
185
+ elsif cmd == 'version'
186
+ puts BDDfire::VERSION
187
+ elsif cmd == 'fire_accessibility'
188
+ accessibility
189
+ elsif cmd == 'fire_load'
190
+ load
191
+ else
192
+ print_usage
193
+ end
184
194
  end
@@ -1,11 +1,8 @@
1
1
  Given(/^I have empty directory$/) do
2
-
3
2
  end
4
3
 
5
4
  When(/^I run BDDfire$/) do
6
-
7
5
  end
8
6
 
9
7
  Then(/^I shouls see all the files and directories are created$/) do
10
-
11
- end
8
+ end
@@ -1,6 +1,6 @@
1
- require "rubygems"
2
- require "bundler/setup"
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
3
 
4
- require "aruba"
4
+ require 'aruba'
5
5
 
6
- require 'bddfire'
6
+ require 'bddfire'
@@ -0,0 +1,40 @@
1
+ require 'axe/cucumber/step_definitions'
2
+
3
+ Then(/^page should not check section "([^"]*)" for the accessibility guideline$/) do |_section|
4
+ step 'the page should be accessible excluding "#{section}"'
5
+ end
6
+
7
+ Then(/^page should check section"([^"]*)" for the accessibility guideline$/) do |_section|
8
+ step 'the page should be accessible excluding "#{section}"'
9
+ end
10
+
11
+ Then(/^the page should have exactly one h(\d+) heading and heading order must follow$/) do |_headings|
12
+ page.html.should include('<h1')
13
+ page.should have_css('h1', count: 1)
14
+ step 'the page should be accessible checking: heading-order'
15
+ step 'the page should be accessible checking: empty-heading'
16
+ end
17
+
18
+ Then(/^there should be one instance of role=main as an attribute of an HTML element$/) do
19
+ page.html.should include('role="main"')
20
+ step 'the page should be accessible checking: area-alt'
21
+ step 'the page should be accessible checking: aria-allowed-attr'
22
+ step 'the page should be accessible checking: aria-required-attr'
23
+ step 'the page should be accessible checking: aria-required-children'
24
+ step 'the page should be accessible checking: aria-required-parent'
25
+ step 'the page should be accessible checking: aria-valid-attr-value'
26
+ step 'the page should be accessible checking: aria-roles'
27
+ step 'the page should be accessible checking: aria-valid-attr-value'
28
+ step 'the page should be accessible checking: aria-valid-attr'
29
+ step 'the page should be accessible checking: aria-roles'
30
+ end
31
+
32
+ Then(/^page should have title html attribute with meaningful text$/) do
33
+ title = page.title
34
+ puts "======You page title is '#{title}'. We hope it's meaningful===="
35
+ title.should_not be_empty
36
+ end
37
+
38
+ Then(/^There must be no instances of attributes with positive or zero values$/) do
39
+ step 'the page should be accessible checking: tabindex'
40
+ end
@@ -4,7 +4,7 @@ Then(/^the page title is "(.*?)"$/) do |title|
4
4
  end
5
5
 
6
6
  Then(/^I see the element "(.*?)" with the text "(.*?)"$/) do |element, text|
7
- page.should have_css(element, :text => text)
7
+ page.should have_css(element, text: text)
8
8
  end
9
9
 
10
10
  Then(/^page contains "(.*?)"$/) do |element|
@@ -12,7 +12,7 @@ Then(/^page contains "(.*?)"$/) do |element|
12
12
  end
13
13
 
14
14
  Then(/^I see element "(.*?)" "(.*?)" times$/) do |element, count|
15
- page.should have_css(element, :count => count)
15
+ page.should have_css(element, count: count)
16
16
  end
17
17
 
18
18
  Then(/^page contains the button "(.*?)"$/) do |button|