howitzer 0.0.3 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.rspec +3 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +32 -0
- data/GETTING_STARTED.md +529 -0
- data/Gemfile +4 -2
- data/LICENSE +2 -2
- data/README.md +57 -13
- data/Rakefile +9 -2
- data/bin/howitzer +79 -31
- data/generators/base_generator.rb +87 -0
- data/generators/config/config_generator.rb +16 -20
- data/generators/config/templates/default.yml +26 -7
- data/generators/cucumber/cucumber_generator.rb +20 -26
- data/generators/{tasks → cucumber}/templates/cucumber.rake +0 -0
- data/generators/{config → cucumber}/templates/cucumber.yml +0 -0
- data/generators/emails/emails_generator.rb +11 -18
- data/generators/emails/templates/example_email.rb +1 -0
- data/generators/pages/pages_generator.rb +16 -18
- data/generators/pages/templates/example_menu.rb +1 -0
- data/generators/pages/templates/example_page.rb +1 -1
- data/generators/root/root_generator.rb +18 -20
- data/generators/root/templates/.gitignore +2 -1
- data/generators/root/templates/Gemfile +3 -2
- data/generators/root/templates/Rakefile +10 -0
- data/generators/root/templates/boot.rb +3 -9
- data/generators/rspec/rspec_generator.rb +23 -0
- data/generators/rspec/templates/example_spec.rb +7 -0
- data/generators/rspec/templates/rspec.rake +34 -0
- data/generators/rspec/templates/spec_helper.rb +56 -0
- data/generators/tasks/tasks_generator.rb +11 -17
- data/generators/tasks/templates/common.rake +15 -0
- data/howitzer.gemspec +13 -2
- data/lib/howitzer.rb +1 -0
- data/lib/howitzer/helpers.rb +87 -2
- data/lib/howitzer/init.rb +0 -1
- data/lib/howitzer/patches/rawler_patched.rb +86 -0
- data/lib/howitzer/settings.rb +27 -0
- data/lib/howitzer/utils.rb +3 -12
- data/lib/howitzer/utils/capybara_patched.rb +3 -2
- data/lib/howitzer/utils/capybara_settings.rb +158 -24
- data/lib/howitzer/utils/data_generator/data_storage.rb +35 -1
- data/lib/howitzer/utils/data_generator/gen.rb +45 -3
- data/lib/howitzer/utils/email/email.rb +44 -5
- data/lib/howitzer/utils/email/mail_client.rb +28 -22
- data/lib/howitzer/utils/email/mailgun_helper.rb +30 -4
- data/lib/howitzer/utils/locator_store.rb +111 -19
- data/lib/howitzer/utils/log.rb +137 -0
- data/lib/howitzer/utils/page_validator.rb +86 -0
- data/lib/howitzer/vendor/firebug-1.12.1-fx.xpi +0 -0
- data/lib/howitzer/vendor/firepath-0.9.7-fx.xpi +0 -0
- data/lib/howitzer/version.rb +2 -2
- data/lib/howitzer/web_page.rb +159 -19
- data/spec/active_resource.rb +0 -0
- data/spec/config/custom.yml +1 -0
- data/spec/config/default.yml +28 -0
- data/spec/spec_helper.rb +46 -1
- data/spec/support/boot_helper.rb +15 -0
- data/spec/support/generator_helper.rb +13 -0
- data/spec/support/logger_helper.rb +12 -0
- data/spec/unit/bin/howitzer_spec.rb +175 -0
- data/spec/unit/generators/generators_spec.rb +175 -0
- data/spec/unit/lib/capybara_settings_spec.rb +170 -0
- data/spec/unit/lib/helpers_spec.rb +619 -0
- data/spec/unit/lib/init_spec.rb +14 -0
- data/spec/unit/lib/settings_spec.rb +17 -0
- data/spec/unit/lib/utils/data_generator/data_storage_spec.rb +62 -0
- data/spec/unit/lib/utils/data_generator/gen_spec.rb +151 -0
- data/spec/unit/lib/utils/email/email_spec.rb +75 -0
- data/spec/unit/lib/utils/email/mail_client_spec.rb +115 -0
- data/spec/unit/lib/utils/email/mailgun_helper_spec.rb +95 -0
- data/spec/unit/lib/utils/locator_store_spec.rb +122 -0
- data/spec/unit/lib/utils/log_spec.rb +107 -0
- data/spec/unit/lib/utils/page_validator_spec.rb +142 -0
- data/spec/unit/lib/web_page_spec.rb +250 -0
- data/spec/unit/version_spec.rb +8 -0
- metadata +215 -15
- data/Gemfile.lock +0 -103
- data/History.md +0 -20
- data/lib/howitzer/utils/logger.rb +0 -108
- data/spec/howitzer/version_spec.rb +0 -8
@@ -1,31 +1,25 @@
|
|
1
|
-
|
1
|
+
require_relative '../base_generator'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
m.template 'example.feature', 'example.feature'
|
3
|
+
module Howitzer
|
4
|
+
class CucumberGenerator < BaseGenerator
|
5
|
+
def manifest
|
6
|
+
{ files:
|
7
|
+
[
|
8
|
+
{ source: 'common_steps.rb', destination: 'features/step_definitions/common_steps.rb'},
|
9
|
+
{ source: 'env.rb', destination: 'features/support/env.rb'},
|
10
|
+
{ source: 'transformers.rb', destination: 'features/support/transformers.rb'},
|
11
|
+
{ source: 'example.feature', destination: 'features/example.feature'},
|
12
|
+
{ source: 'cucumber.rake', destination: 'tasks/cucumber.rake'},
|
13
|
+
{ source: 'cucumber.yml', destination: 'config/cucumber.yml'}
|
14
|
+
]
|
15
|
+
}
|
17
16
|
end
|
18
|
-
end
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
protected
|
19
|
+
def banner
|
20
|
+
<<-EOS
|
21
|
+
Integrates Cucumber to the framework
|
22
|
+
EOS
|
23
|
+
end
|
25
24
|
end
|
26
|
-
|
27
|
-
BASEDIRS = %w(
|
28
|
-
step_definitions
|
29
|
-
support
|
30
|
-
)
|
31
25
|
end
|
File without changes
|
File without changes
|
@@ -1,23 +1,16 @@
|
|
1
|
-
|
1
|
+
require_relative '../base_generator'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@destination_root = File.expand_path('emails')
|
8
|
-
end
|
9
|
-
|
10
|
-
def manifest
|
11
|
-
record do |m|
|
12
|
-
m.directory ''
|
13
|
-
m.template 'example_email.rb', 'example_email.rb'
|
3
|
+
module Howitzer
|
4
|
+
class EmailsGenerator < BaseGenerator
|
5
|
+
def manifest
|
6
|
+
{ files: [ source: 'example_email.rb', destination: '/emails/example_email.rb' ] }
|
14
7
|
end
|
15
|
-
end
|
16
8
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Creates a simple email class."
|
21
|
-
|
9
|
+
protected
|
10
|
+
def banner
|
11
|
+
<<-EOS
|
12
|
+
Creates a simple email class."
|
13
|
+
EOS
|
14
|
+
end
|
22
15
|
end
|
23
16
|
end
|
@@ -1,23 +1,21 @@
|
|
1
|
-
|
1
|
+
require_relative '../base_generator'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
m.template 'example_page.rb', 'example_page.rb'
|
13
|
-
m.template 'example_menu.rb', 'example_menu.rb'
|
3
|
+
module Howitzer
|
4
|
+
class PagesGenerator < BaseGenerator
|
5
|
+
def manifest
|
6
|
+
{ files:
|
7
|
+
[
|
8
|
+
{ source: 'example_page.rb', destination: 'pages/example_page.rb'},
|
9
|
+
{ source: 'example_menu.rb', destination: 'pages/example_menu.rb'}
|
10
|
+
]
|
11
|
+
}
|
14
12
|
end
|
15
|
-
end
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
protected
|
15
|
+
def banner
|
16
|
+
<<-EOS
|
17
|
+
Creates PageOriented pattern structure
|
18
|
+
EOS
|
19
|
+
end
|
22
20
|
end
|
23
21
|
end
|
@@ -2,7 +2,7 @@ require_relative 'example_menu'
|
|
2
2
|
|
3
3
|
class ExamplePage < WebPage
|
4
4
|
URL = '/'
|
5
|
-
|
5
|
+
validates :url, pattern: /#{Regexp.escape(settings.app_host)}\/?/
|
6
6
|
|
7
7
|
add_field_locator :search_input, 'lst-ib'
|
8
8
|
add_button_locator :search_btn, 'btnK'
|
@@ -1,25 +1,23 @@
|
|
1
|
-
|
1
|
+
require_relative '../base_generator'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
m.template 'Rakefile', 'Rakefile'
|
15
|
-
m.template 'boot.rb', 'boot.rb'
|
3
|
+
module Howitzer
|
4
|
+
class RootGenerator < BaseGenerator
|
5
|
+
def manifest
|
6
|
+
{ files:
|
7
|
+
[
|
8
|
+
{ source: '.gitignore', destination: '.gitignore'},
|
9
|
+
{ source: 'Gemfile', destination: 'Gemfile'},
|
10
|
+
{ source: 'Rakefile', destination: 'Rakefile'},
|
11
|
+
{ source: 'boot.rb', destination: 'boot.rb'}
|
12
|
+
]
|
13
|
+
}
|
16
14
|
end
|
17
|
-
end
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
protected
|
17
|
+
def banner
|
18
|
+
<<-EOF
|
19
|
+
Creates root config files.
|
20
|
+
EOF
|
21
|
+
end
|
24
22
|
end
|
25
23
|
end
|
@@ -1,4 +1,14 @@
|
|
1
1
|
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'howitzer/settings'
|
4
|
+
require 'howitzer/utils/log'
|
5
|
+
|
6
|
+
Dir.chdir(File.join(File.dirname(__FILE__), '.'))
|
7
|
+
|
8
|
+
if settings.required_clean_logs
|
9
|
+
CLEAN.include("#{settings.log_dir}/*")
|
10
|
+
Rake::Task[:clean].invoke
|
11
|
+
end
|
2
12
|
|
3
13
|
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
4
14
|
ENV['RAKE_TASK'] = ARGV[0] if /^(?:r?spec|cucumber)/ === ARGV[0]
|
@@ -1,16 +1,10 @@
|
|
1
|
-
require 'howitzer'
|
2
|
-
|
3
1
|
Dir.chdir(File.join(File.dirname(__FILE__), '.'))
|
4
2
|
|
5
3
|
def settings
|
6
4
|
SexySettings::Base.instance()
|
7
5
|
end
|
8
6
|
|
9
|
-
|
10
|
-
require 'rake/clean'
|
11
|
-
CLEAN.include("#{settings.log_dir}/*")
|
12
|
-
Rake::Task[:clean].invoke
|
13
|
-
end
|
7
|
+
require 'howitzer'
|
14
8
|
|
15
|
-
Dir[File.join(File.dirname(__FILE__), "./emails
|
16
|
-
Dir[File.join(File.dirname(__FILE__), "./pages
|
9
|
+
Dir[File.join(File.dirname(__FILE__), "./emails/**/*.rb")].each {|f| require f}
|
10
|
+
Dir[File.join(File.dirname(__FILE__), "./pages/**/*.rb")].each {|f| require f}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '../base_generator'
|
2
|
+
|
3
|
+
module Howitzer
|
4
|
+
class RspecGenerator < BaseGenerator
|
5
|
+
def manifest
|
6
|
+
{ files:
|
7
|
+
[
|
8
|
+
{ source: 'spec_helper.rb', destination: 'spec/spec_helper.rb'},
|
9
|
+
{ source: 'example_spec.rb', destination: 'spec/example_spec.rb'},
|
10
|
+
{ source: 'rspec.rake', destination: 'tasks/rspec.rake'}
|
11
|
+
]
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
def banner
|
17
|
+
<<-EOS
|
18
|
+
Integrates RSpec to the framework.
|
19
|
+
EOS
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
include RSpec::Core
|
4
|
+
|
5
|
+
# Specify here your group tests
|
6
|
+
TEST_TYPES = [:all, :health, :bvt, :p1]
|
7
|
+
|
8
|
+
# Specify here your business areas, ex. [:accounts, :blog, :news]
|
9
|
+
TEST_AREAS = []
|
10
|
+
|
11
|
+
namespace :rspec do
|
12
|
+
std_opts = "--format html --out=./#{settings.log_dir}/#{settings.html_log}"
|
13
|
+
TEST_TYPES.each do |type|
|
14
|
+
RakeTask.new(type) do |s|
|
15
|
+
s.send :desc, "Run all #{"'#{s.name}' " unless type == :all}tests"
|
16
|
+
s.pattern = "./spec/#{type == :all ? '**': s.name}/**/*_spec.rb"
|
17
|
+
s.rspec_opts = std_opts
|
18
|
+
s.verbose = true
|
19
|
+
end
|
20
|
+
TEST_AREAS.each do |group|
|
21
|
+
type_text = type == :all ? '**': type
|
22
|
+
pattern = "./spec/#{type_text}/#{group}/**/*_spec.rb"
|
23
|
+
RakeTask.new("#{"#{type}:" unless type == :all}#{group}") do |s|
|
24
|
+
s.send :desc, "Run all '#{s.name}' tests"
|
25
|
+
s.pattern = pattern
|
26
|
+
s.rspec_opts = std_opts
|
27
|
+
s.verbose = true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
task default: "rspec:all"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'capybara/rspec'
|
3
|
+
require_relative '../boot'
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
log.settings_as_formatted_text
|
7
|
+
|
8
|
+
DataStorage.store('sauce', :start_time, Time.now.utc)
|
9
|
+
DataStorage.store('sauce', :status, true)
|
10
|
+
|
11
|
+
config.include CapybaraSettings
|
12
|
+
config.include Capybara::RSpecMatchers
|
13
|
+
config.include DataGenerator
|
14
|
+
|
15
|
+
config.mock_with(:rspec){|c| c.syntax = :expect}
|
16
|
+
config.expect_with(:rspec) { |c| c.syntax = :expect }
|
17
|
+
|
18
|
+
config.color_enabled = true
|
19
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
20
|
+
|
21
|
+
config.before(:all) do
|
22
|
+
if sauce_driver?
|
23
|
+
suite_name = "#{(ENV['RAKE_TASK'] || 'CUSTOM').sub("rspec:", '').upcase} #{settings.sl_browser_name.upcase}"
|
24
|
+
Capybara.drivers[:sauce][].options[:desired_capabilities][:name] = suite_name
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
config.before(:each) do
|
29
|
+
log.print_scenario_name(example.description.empty? ? example.metadata[:full_description] : example.description)
|
30
|
+
@session_start = duration(Time.now.utc - DataStorage.extract('sauce', :start_time))
|
31
|
+
end
|
32
|
+
|
33
|
+
config.after(:each) do
|
34
|
+
Gen.delete_all_mailboxes
|
35
|
+
DataStorage.clear_ns("user")
|
36
|
+
if sauce_driver?
|
37
|
+
session_end = duration(Time.now.utc - DataStorage.extract('sauce', :start_time))
|
38
|
+
log.info "SAUCE VIDEO #@session_start - #{session_end} URL: #{sauce_resource_path('video.flv')}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
config.after(:suite) do
|
43
|
+
if sauce_driver?
|
44
|
+
report_failures_count = config.reporter.instance_variable_get(:@failure_count)
|
45
|
+
DataStorage.store('sauce', :status, report_failures_count.zero?)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
at_exit do
|
50
|
+
if sauce_driver?
|
51
|
+
log.info "SAUCE SERVER LOG URL: #{CapybaraSettings.sauce_resource_path('selenium-server.log')}"
|
52
|
+
CapybaraSettings.update_sauce_job_status(passed: DataStorage.extract('sauce', :status))
|
53
|
+
end
|
54
|
+
Gen.delete_all_mailboxes
|
55
|
+
end
|
56
|
+
end
|
@@ -1,22 +1,16 @@
|
|
1
|
-
|
1
|
+
require_relative '../base_generator'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def manifest
|
10
|
-
record do |m|
|
11
|
-
m.directory ''
|
12
|
-
m.template 'cucumber.rake', 'cucumber.rake'
|
3
|
+
module Howitzer
|
4
|
+
class TasksGenerator < BaseGenerator
|
5
|
+
def manifest
|
6
|
+
{ files: [ source: 'common.rake', destination: 'tasks/common.rake' ] }
|
13
7
|
end
|
14
|
-
end
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
9
|
+
protected
|
10
|
+
def banner
|
11
|
+
<<-EOF
|
12
|
+
Creates RAKE tasks folder and file.
|
13
|
+
EOF
|
14
|
+
end
|
21
15
|
end
|
22
16
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
desc "Check broken links"
|
2
|
+
task :check_links do
|
3
|
+
require 'rawler'
|
4
|
+
require 'active_support/core_ext'
|
5
|
+
require 'howitzer/helpers'
|
6
|
+
|
7
|
+
log.settings_as_formatted_text
|
8
|
+
opts = {
|
9
|
+
wait: 0.1,
|
10
|
+
logfile: File.expand_path(settings.rawler_log, settings.log_dir)
|
11
|
+
}
|
12
|
+
opts[:username] = settings.app_base_auth_login unless settings.app_base_auth_login.blank?
|
13
|
+
opts[:password] = settings.app_base_auth_pass unless settings.app_base_auth_pass.blank?
|
14
|
+
Rawler::Base.new(app_base_url, $stdout, opts).validate
|
15
|
+
end
|
data/howitzer.gemspec
CHANGED
@@ -15,11 +15,11 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.name = "howitzer"
|
16
16
|
gem.require_paths = ["lib"]
|
17
17
|
gem.version = Howitzer::VERSION
|
18
|
-
gem.required_ruby_version = '
|
18
|
+
gem.required_ruby_version = '>= 1.9.3'
|
19
19
|
|
20
20
|
gem.add_runtime_dependency 'rake'
|
21
|
-
gem.add_runtime_dependency 'rubigen'
|
22
21
|
gem.add_runtime_dependency 'i18n'
|
22
|
+
gem.add_runtime_dependency 'syntax'
|
23
23
|
gem.add_runtime_dependency 'cucumber'
|
24
24
|
gem.add_runtime_dependency 'rspec', '~> 2.0'
|
25
25
|
gem.add_runtime_dependency 'sexy_settings'
|
@@ -29,4 +29,15 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.add_runtime_dependency 'mail'
|
30
30
|
gem.add_runtime_dependency 'rest-client'
|
31
31
|
gem.add_runtime_dependency 'poltergeist'
|
32
|
+
gem.add_runtime_dependency 'rawler'
|
33
|
+
gem.add_runtime_dependency 'capybara'
|
34
|
+
gem.add_runtime_dependency 'selenium-webdriver'
|
35
|
+
gem.add_runtime_dependency 'activeresource', '~>4.0'
|
36
|
+
gem.add_runtime_dependency 'testingbot'
|
37
|
+
|
38
|
+
gem.add_development_dependency("rspec", [">= 2.14.1"])
|
39
|
+
gem.add_development_dependency("fuubar", [">= 0.0.1"])
|
40
|
+
gem.add_development_dependency("rake")
|
41
|
+
gem.add_development_dependency("ffaker")
|
42
|
+
|
32
43
|
end
|