howitzer 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +32 -0
- data/.travis.yml +1 -4
- data/.yardopts +1 -2
- data/CHANGELOG.md +28 -1
- data/Gemfile +6 -0
- data/LICENSE +1 -1
- data/README.md +55 -85
- data/Rakefile +7 -7
- data/bin/howitzer +56 -31
- data/features/cli_new.feature +162 -79
- data/features/cli_update.feature +114 -21
- data/features/step_definitions/common_steps.rb +29 -9
- data/features/support/env.rb +1 -1
- data/features/support/transformers.rb +2 -2
- data/generators/base_generator.rb +121 -49
- data/generators/config/config_generator.rb +8 -5
- data/generators/config/templates/boot.rb +14 -0
- data/generators/config/templates/capybara.rb +156 -0
- data/generators/config/templates/custom.yml +2 -3
- data/generators/config/templates/default.yml +50 -82
- data/generators/cucumber/cucumber_generator.rb +9 -9
- data/generators/cucumber/templates/common_steps.rb +4 -4
- data/generators/cucumber/templates/cucumber.rake +63 -54
- data/generators/cucumber/templates/env.rb +24 -23
- data/generators/cucumber/templates/transformers.rb +23 -15
- data/generators/emails/emails_generator.rb +4 -2
- data/generators/emails/templates/example_email.rb +4 -4
- data/generators/prerequisites/prerequisites_generator.rb +24 -0
- data/generators/prerequisites/templates/base.rb +22 -0
- data/generators/prerequisites/templates/factory_girl.rb +30 -0
- data/generators/prerequisites/templates/user.rb +7 -0
- data/generators/prerequisites/templates/users.rb +12 -0
- data/generators/root/root_generator.rb +11 -7
- data/generators/root/templates/.rubocop.yml +32 -0
- data/generators/root/templates/Gemfile.erb +27 -0
- data/generators/root/templates/Rakefile +6 -8
- data/generators/rspec/rspec_generator.rb +7 -7
- data/generators/rspec/templates/example_spec.rb +1 -1
- data/generators/rspec/templates/rspec.rake +48 -29
- data/generators/rspec/templates/spec_helper.rb +33 -32
- data/generators/tasks/tasks_generator.rb +4 -2
- data/generators/tasks/templates/common.rake +1 -16
- data/generators/turnip/templates/.rspec +1 -0
- data/generators/turnip/templates/common_steps.rb +25 -0
- data/generators/turnip/templates/example.feature +8 -0
- data/generators/turnip/templates/spec_helper.rb +56 -0
- data/generators/turnip/templates/turnip.rake +61 -0
- data/generators/turnip/templates/turnip_helper.rb +6 -0
- data/generators/turnip/turnip_generator.rb +26 -0
- data/generators/web/templates/example_page.rb +15 -0
- data/generators/web/templates/menu_section.rb +13 -0
- data/generators/web/web_generator.rb +22 -0
- data/howitzer.gemspec +14 -21
- data/lib/howitzer.rb +47 -7
- data/lib/howitzer/cache.rb +70 -0
- data/lib/howitzer/capybara_helpers.rb +194 -0
- data/lib/howitzer/email.rb +96 -104
- data/lib/howitzer/exceptions.rb +10 -6
- data/lib/howitzer/log.rb +120 -0
- data/lib/howitzer/mail_adapters.rb +7 -0
- data/lib/howitzer/mail_adapters/abstract.rb +84 -0
- data/lib/howitzer/mail_adapters/mailgun.rb +115 -0
- data/lib/howitzer/mailgun_api.rb +9 -0
- data/lib/howitzer/mailgun_api/client.rb +79 -0
- data/lib/howitzer/mailgun_api/connector.rb +37 -0
- data/lib/howitzer/mailgun_api/response.rb +28 -0
- data/lib/howitzer/tasks/framework.rake +2 -2
- data/lib/howitzer/utils.rb +7 -1
- data/lib/howitzer/utils/string_extensions.rb +66 -0
- data/lib/howitzer/version.rb +2 -1
- data/lib/howitzer/web.rb +11 -0
- data/lib/howitzer/web/base_section.rb +27 -0
- data/lib/howitzer/web/blank_page.rb +12 -0
- data/lib/howitzer/web/capybara_methods_proxy.rb +29 -0
- data/lib/howitzer/web/element_dsl.rb +109 -0
- data/lib/howitzer/web/iframe_dsl.rb +93 -0
- data/lib/howitzer/web/page.rb +173 -0
- data/lib/howitzer/web/page_dsl.rb +64 -0
- data/lib/howitzer/web/page_validator.rb +118 -0
- data/lib/howitzer/web/section.rb +27 -0
- data/lib/howitzer/web/section_dsl.rb +154 -0
- data/spec/config/custom.yml +10 -1
- data/spec/spec_helper.rb +37 -19
- data/spec/support/generator_helper.rb +12 -11
- data/spec/support/logger_helper.rb +10 -9
- data/spec/support/mailgun_unit_client.rb +52 -44
- data/spec/support/shared_examples/capybara_context_holder.rb +33 -0
- data/spec/support/shared_examples/capybara_methods_proxy.rb +94 -0
- data/spec/support/shared_examples/dynamic_section_methods.rb +35 -0
- data/spec/support/shared_examples/element_dsl.rb +119 -0
- data/spec/unit/generators/base_generator_spec.rb +64 -33
- data/spec/unit/generators/config_generator_spec.rb +11 -7
- data/spec/unit/generators/cucumber_generator_spec.rb +26 -17
- data/spec/unit/generators/emails_generator_spec.rb +10 -6
- data/spec/unit/generators/prerequisites_generator_spec.rb +53 -0
- data/spec/unit/generators/root_generator_spec.rb +50 -13
- data/spec/unit/generators/rspec_generator_spec.rb +9 -9
- data/spec/unit/generators/tasks_generator_spec.rb +6 -6
- data/spec/unit/generators/turnip_generator_spec.rb +52 -0
- data/spec/unit/generators/web_generator_spec.rb +52 -0
- data/spec/unit/lib/cache_spec.rb +85 -0
- data/spec/unit/lib/capybara_helpers_spec.rb +696 -0
- data/spec/unit/lib/email_spec.rb +104 -91
- data/spec/unit/lib/howitzer.rb +31 -0
- data/spec/unit/lib/init_spec.rb +0 -1
- data/spec/unit/lib/log_spec.rb +122 -0
- data/spec/unit/lib/mail_adapters/abstract_spec.rb +62 -0
- data/spec/unit/lib/mail_adapters/mailgun_spec.rb +163 -0
- data/spec/unit/lib/mailgun_api/client_spec.rb +58 -0
- data/spec/unit/lib/mailgun_api/connector_spec.rb +54 -0
- data/spec/unit/lib/mailgun_api/response_spec.rb +28 -0
- data/spec/unit/lib/utils/string_extensions_spec.rb +77 -0
- data/spec/unit/lib/web/base_section_spec.rb +41 -0
- data/spec/unit/lib/web/element_dsl_spec.rb +17 -0
- data/spec/unit/lib/web/iframe_dsl_spec.rb +99 -0
- data/spec/unit/lib/web/page_dsl_spec.rb +52 -0
- data/spec/unit/lib/web/page_spec.rb +304 -0
- data/spec/unit/lib/web/page_validator_spec.rb +218 -0
- data/spec/unit/lib/web/section_dsl_spec.rb +165 -0
- data/spec/unit/lib/web/section_spec.rb +61 -0
- data/spec/unit/version_spec.rb +1 -1
- metadata +116 -203
- data/GETTING_STARTED.md +0 -774
- data/generators/cucumber/templates/cucumber.yml +0 -10
- data/generators/pages/pages_generator.rb +0 -21
- data/generators/pages/templates/example_menu.rb +0 -15
- data/generators/pages/templates/example_page.rb +0 -15
- data/generators/root/templates/Gemfile +0 -7
- data/generators/root/templates/boot.rb +0 -10
- data/lib/howitzer/blank_page.rb +0 -6
- data/lib/howitzer/capybara/dsl_ex.rb +0 -15
- data/lib/howitzer/capybara/settings.rb +0 -343
- data/lib/howitzer/helpers.rb +0 -230
- data/lib/howitzer/init.rb +0 -1
- data/lib/howitzer/mailgun/client.rb +0 -65
- data/lib/howitzer/mailgun/connector.rb +0 -34
- data/lib/howitzer/mailgun/response.rb +0 -28
- data/lib/howitzer/patches/rawler_patched.rb +0 -86
- data/lib/howitzer/settings.rb +0 -27
- data/lib/howitzer/utils/data_generator/data_storage.rb +0 -88
- data/lib/howitzer/utils/data_generator/gen.rb +0 -135
- data/lib/howitzer/utils/locator_store.rb +0 -217
- data/lib/howitzer/utils/log.rb +0 -139
- data/lib/howitzer/utils/page_validator.rb +0 -133
- 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/web_page.rb +0 -253
- data/spec/active_resource.rb +0 -0
- data/spec/config/default.yml +0 -26
- data/spec/support/boot_helper.rb +0 -15
- data/spec/unit/generators/pages_generator_spec.rb +0 -33
- data/spec/unit/lib/capybara/dsl_ex_spec.rb +0 -60
- data/spec/unit/lib/capybara/settings_spec.rb +0 -441
- data/spec/unit/lib/helpers_spec.rb +0 -1129
- data/spec/unit/lib/mailgun/client_spec.rb +0 -36
- data/spec/unit/lib/mailgun/connector_spec.rb +0 -70
- data/spec/unit/lib/mailgun/response_spec.rb +0 -28
- data/spec/unit/lib/settings_spec.rb +0 -17
- data/spec/unit/lib/utils/data_generator/data_storage_spec.rb +0 -80
- data/spec/unit/lib/utils/data_generator/gen_spec.rb +0 -90
- data/spec/unit/lib/utils/locator_store_spec.rb +0 -157
- data/spec/unit/lib/utils/log_spec.rb +0 -107
- data/spec/unit/lib/utils/page_validator_spec.rb +0 -265
- data/spec/unit/lib/web_page_spec.rb +0 -346
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
require_relative '../base_generator'
|
|
2
2
|
|
|
3
3
|
module Howitzer
|
|
4
|
+
# This class responsible for email examples generation
|
|
4
5
|
class EmailsGenerator < BaseGenerator
|
|
5
6
|
def manifest
|
|
6
|
-
{ files: [
|
|
7
|
+
{ files: [source: 'example_email.rb', destination: '/emails/example_email.rb'] }
|
|
7
8
|
end
|
|
8
9
|
|
|
9
10
|
protected
|
|
11
|
+
|
|
10
12
|
def banner
|
|
11
13
|
<<-EOS
|
|
12
14
|
* Email example generation ...
|
|
13
15
|
EOS
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
|
-
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require_relative '../base_generator'
|
|
2
|
+
|
|
3
|
+
module Howitzer
|
|
4
|
+
# This class responsible for prerequisites files generation
|
|
5
|
+
class PrerequisitesGenerator < BaseGenerator
|
|
6
|
+
def manifest
|
|
7
|
+
{ files:
|
|
8
|
+
[
|
|
9
|
+
{ source: 'factory_girl.rb', destination: 'prerequisites/factory_girl.rb' },
|
|
10
|
+
{ source: 'users.rb', destination: 'prerequisites/factories/users.rb' },
|
|
11
|
+
{ source: 'base.rb', destination: 'prerequisites/models/base.rb' },
|
|
12
|
+
{ source: 'user.rb', destination: 'prerequisites/models/user.rb' }
|
|
13
|
+
] }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
|
|
18
|
+
def banner
|
|
19
|
+
<<-EOS
|
|
20
|
+
* Pre-requisites integration to the framework ...
|
|
21
|
+
EOS
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# The base model. Models allow to communicate with
|
|
2
|
+
# AUT (application under test) api endpoints. They are used by
|
|
3
|
+
# FactoryGirl on create
|
|
4
|
+
#
|
|
5
|
+
# To implement a custom model, override the following methods:
|
|
6
|
+
# * {Base.find}
|
|
7
|
+
# * {Base.where}
|
|
8
|
+
# * {Base.save!}
|
|
9
|
+
#
|
|
10
|
+
class Base
|
|
11
|
+
def self.find(_id)
|
|
12
|
+
raise NotImplementedError
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.where(_params)
|
|
16
|
+
raise NotImplementedError
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def save!
|
|
20
|
+
raise NotImplementedError
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @see http://www.rubydoc.info/gems/factory_girl/file/GETTING_STARTED.md
|
|
2
|
+
require 'factory_girl'
|
|
3
|
+
|
|
4
|
+
FactoryGirl.definition_file_paths = [File.join(__dir__, 'factories')]
|
|
5
|
+
FactoryGirl.find_definitions
|
|
6
|
+
|
|
7
|
+
# This module holds custom FactoryGirl methods
|
|
8
|
+
module FactoryGirl
|
|
9
|
+
# Fetches data from the cache, using factory name and number.
|
|
10
|
+
# If there is data in the cache with the given name and number,
|
|
11
|
+
# then that data is returned. Otherwise it stores firstly and then returns
|
|
12
|
+
# @param factory [String] underscored factory name
|
|
13
|
+
# @param num [Integer] a factory number
|
|
14
|
+
# @return [Object] the factory
|
|
15
|
+
def self.given_by_number(factory, num)
|
|
16
|
+
data = Howitzer::Cache.extract(factory, num.to_i)
|
|
17
|
+
return data if data.present?
|
|
18
|
+
Howitzer::Cache.store(factory, num.to_i, build(factory))
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# This module holds data generators
|
|
23
|
+
module Gen
|
|
24
|
+
# Generates unique string
|
|
25
|
+
# @return [String]
|
|
26
|
+
def self.serial
|
|
27
|
+
a = [('a'..'z').to_a, (0..9).to_a].flatten.shuffle
|
|
28
|
+
"#{Time.now.utc.strftime('%j%H%M%S')}#{a[0..4].join}"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
FactoryGirl.define do
|
|
2
|
+
factory :user do
|
|
3
|
+
email { "u#{serial}@#{Howitzer.mailgun_domain}" }
|
|
4
|
+
name { "FirstName LastName #{serial}" }
|
|
5
|
+
password { Howitzer.app_test_pass }
|
|
6
|
+
password_confirmation { Howitzer.app_test_pass }
|
|
7
|
+
|
|
8
|
+
trait :default do
|
|
9
|
+
initialize_with { User.default || User.new }
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
require_relative '../base_generator'
|
|
2
2
|
|
|
3
3
|
module Howitzer
|
|
4
|
+
# This class responsible for project root files generation
|
|
4
5
|
class RootGenerator < BaseGenerator
|
|
5
6
|
def manifest
|
|
6
7
|
{ files:
|
|
7
8
|
[
|
|
8
|
-
{ source: '.gitignore', destination: '.gitignore'},
|
|
9
|
-
{ source: '
|
|
10
|
-
{ source: 'Rakefile', destination: 'Rakefile'}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
{ source: '.gitignore', destination: '.gitignore' },
|
|
10
|
+
{ source: '.rubocop.yml', destination: '.rubocop.yml' },
|
|
11
|
+
{ source: 'Rakefile', destination: 'Rakefile' }
|
|
12
|
+
],
|
|
13
|
+
templates:
|
|
14
|
+
[
|
|
15
|
+
{ source: 'Gemfile.erb', destination: 'Gemfile' }
|
|
16
|
+
] }
|
|
14
17
|
end
|
|
15
18
|
|
|
16
19
|
protected
|
|
20
|
+
|
|
17
21
|
def banner
|
|
18
22
|
<<-EOF
|
|
19
23
|
* Root files generation ...
|
|
20
24
|
EOF
|
|
21
25
|
end
|
|
22
26
|
end
|
|
23
|
-
end
|
|
27
|
+
end
|
|
@@ -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
|
+
Include:
|
|
7
|
+
- Rakefile
|
|
8
|
+
- Gemfile
|
|
9
|
+
|
|
10
|
+
LineLength:
|
|
11
|
+
Max: 120
|
|
12
|
+
|
|
13
|
+
Style/CaseIndentation:
|
|
14
|
+
Enabled: false
|
|
15
|
+
|
|
16
|
+
Style/EmptyElse:
|
|
17
|
+
Enabled: false
|
|
18
|
+
|
|
19
|
+
Lint/AmbiguousRegexpLiteral:
|
|
20
|
+
Enabled: false
|
|
21
|
+
|
|
22
|
+
Style/CaseEquality:
|
|
23
|
+
Enabled: false
|
|
24
|
+
|
|
25
|
+
Documentation:
|
|
26
|
+
Enabled: false
|
|
27
|
+
|
|
28
|
+
Style/FrozenStringLiteralComment:
|
|
29
|
+
Enabled: false
|
|
30
|
+
|
|
31
|
+
Metrics/ModuleLength:
|
|
32
|
+
Max: 150
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Uncomment it if you are going to use 'webkit' driver. QT library should be installed.
|
|
4
|
+
# See https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit
|
|
5
|
+
#
|
|
6
|
+
# gem 'capybara-webkit'
|
|
7
|
+
|
|
8
|
+
gem 'howitzer'
|
|
9
|
+
# Uncomment it if you are going to use 'poltergeist' driver. PhantomJS should be installed.
|
|
10
|
+
# See https://github.com/jnicklas/capybara#poltergeist
|
|
11
|
+
# gem 'poltergeist', github: 'teampoltergeist/poltergeist', branch: :master
|
|
12
|
+
gem 'rest-client'
|
|
13
|
+
gem 'repeater'
|
|
14
|
+
gem 'factory_girl'
|
|
15
|
+
gem 'capybara-screenshot'
|
|
16
|
+
<% if cucumber %>
|
|
17
|
+
gem 'syntax'
|
|
18
|
+
gem 'cucumber', '~>2.0'
|
|
19
|
+
<% elsif rspec %>
|
|
20
|
+
gem 'rspec', '~>3.2'
|
|
21
|
+
<% elsif turnip %>
|
|
22
|
+
gem 'rspec', '~>3.2'
|
|
23
|
+
gem 'turnip'
|
|
24
|
+
<% end %>
|
|
25
|
+
gem 'rubocop'
|
|
26
|
+
gem 'pry'
|
|
27
|
+
gem 'pry-byebug'
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
require 'rake'
|
|
2
2
|
require 'rake/clean'
|
|
3
|
-
require 'howitzer
|
|
4
|
-
require '
|
|
3
|
+
require 'howitzer'
|
|
4
|
+
require 'rubocop/rake_task'
|
|
5
5
|
|
|
6
6
|
load 'howitzer/tasks/framework.rake'
|
|
7
|
+
RuboCop::RakeTask.new
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if settings.required_clean_logs
|
|
11
|
-
CLEAN.include("#{settings.log_dir}/*")
|
|
9
|
+
if Howitzer.required_clean_logs
|
|
10
|
+
CLEAN.include("#{Howitzer.log_dir}/*")
|
|
12
11
|
Rake::Task[:clean].invoke
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
|
16
|
-
ENV['RAKE_TASK'] = ARGV[0] if /^(?:r?spec|cucumber)/ === ARGV[0]
|
|
14
|
+
Dir['./tasks/**/*.rake'].each { |rake| load rake }
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
require_relative '../base_generator'
|
|
2
2
|
|
|
3
3
|
module Howitzer
|
|
4
|
+
# This class responsible for rspec based files generation
|
|
4
5
|
class RspecGenerator < BaseGenerator
|
|
5
6
|
def manifest
|
|
6
7
|
{ files:
|
|
7
8
|
[
|
|
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
|
-
}
|
|
9
|
+
{ source: 'spec_helper.rb', destination: 'spec/spec_helper.rb' },
|
|
10
|
+
{ source: 'example_spec.rb', destination: 'spec/example_spec.rb' },
|
|
11
|
+
{ source: 'rspec.rake', destination: 'tasks/rspec.rake' }
|
|
12
|
+
] }
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
protected
|
|
16
|
+
|
|
16
17
|
def banner
|
|
17
18
|
<<-EOS
|
|
18
19
|
* RSpec integration to the framework ...
|
|
19
20
|
EOS
|
|
20
21
|
end
|
|
21
|
-
|
|
22
22
|
end
|
|
23
|
-
end
|
|
23
|
+
end
|
|
@@ -1,34 +1,53 @@
|
|
|
1
|
-
require 'rspec'
|
|
2
1
|
require 'rspec/core/rake_task'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
|
|
3
|
+
opts = lambda do |task_name|
|
|
4
|
+
[
|
|
5
|
+
"--format html --out ./#{Howitzer.log_dir}/#{Howitzer.driver}_#{task_name}_#{Howitzer.html_log}",
|
|
6
|
+
'--format documentation',
|
|
7
|
+
'--color'
|
|
8
|
+
].join(' ').freeze
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
RSpec::Core::RakeTask.new(:rspec, 'Run all rspec scenarios') do |t|
|
|
12
|
+
Howitzer.current_rake_task = t.name
|
|
13
|
+
t.opts = opts.call(t.name)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
RSpec::Core::RakeTask.new(:features, 'Run all workable scenarios (without @wip and @bug tags)') do |t|
|
|
17
|
+
Howitzer.current_rake_task = t.name
|
|
18
|
+
t.opts = "#{opts.call(t.name)} --tag ~wip --tag ~bug"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
namespace :features do
|
|
22
|
+
RSpec::Core::RakeTask.new(:wip, 'Run scenarios in progress (with @wip tag)') do |t|
|
|
23
|
+
Howitzer.current_rake_task = t.name
|
|
24
|
+
t.opts = "#{opts.call(t.name)} --tag wip"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
RSpec::Core::RakeTask.new(:bug, 'Run scenarios with known bugs (with @bug tag)') do |t|
|
|
28
|
+
Howitzer.current_rake_task = t.name
|
|
29
|
+
t.opts = "#{opts.call(t.name)} --tag bug"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
RSpec::Core::RakeTask.new(:smoke, 'Run workable smoke scenarios (with @smoke tag)') do |t|
|
|
33
|
+
Howitzer.current_rake_task = t.name
|
|
34
|
+
t.opts = "#{opts.call(t.name)} --tag smoke --tag ~wip --tag ~bug"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
RSpec::Core::RakeTask.new(:bvt, 'Run workable build verification test scenarios') do |t|
|
|
38
|
+
Howitzer.current_rake_task = t.name
|
|
39
|
+
t.opts = "#{opts.call(t.name)} --tag ~wip --tag ~bug --tag ~p1 --tag ~p2 --tag ~smoke"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
RSpec::Core::RakeTask.new(:p1, 'Run workable scenarios with normal priority (with @p1 tag)') do |t|
|
|
43
|
+
Howitzer.current_rake_task = t.name
|
|
44
|
+
t.opts = "#{opts.call(t.name)} --tag p1 --tag ~wip --tag ~bug"
|
|
30
45
|
end
|
|
31
46
|
|
|
47
|
+
RSpec::Core::RakeTask.new(:p2, 'Run workable scenarios with low priority (with @p2 tag)') do |t|
|
|
48
|
+
Howitzer.current_rake_task = t.name
|
|
49
|
+
t.opts = "#{opts.call(t.name)} --tag p2 --tag ~wip --tag ~bug"
|
|
50
|
+
end
|
|
32
51
|
end
|
|
33
52
|
|
|
34
|
-
task default:
|
|
53
|
+
task default: :features
|
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
require 'rspec'
|
|
2
|
-
require 'capybara/rspec'
|
|
3
|
-
require_relative '../boot'
|
|
1
|
+
require 'capybara-screenshot/rspec'
|
|
2
|
+
require 'capybara/rspec/features'
|
|
3
|
+
require_relative '../config/boot'
|
|
4
|
+
require_relative '../config/capybara'
|
|
4
5
|
|
|
5
|
-
Dir[
|
|
6
|
+
Dir['./spec/support/**/*.rb'].each { |f| require f }
|
|
6
7
|
|
|
7
8
|
RSpec.configure do |config|
|
|
8
|
-
|
|
9
|
+
Howitzer::Log.settings_as_formatted_text
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
Howitzer::Cache.store(:cloud, :start_time, Time.now.utc)
|
|
12
|
+
Howitzer::Cache.store(:cloud, :status, true)
|
|
12
13
|
|
|
13
|
-
config.include
|
|
14
|
-
config.include Capybara::RSpecMatchers
|
|
15
|
-
config.include DataGenerator
|
|
14
|
+
config.include FactoryGirl::Syntax::Methods
|
|
16
15
|
|
|
17
16
|
config.disable_monkey_patching = true
|
|
18
17
|
config.color = true
|
|
19
18
|
|
|
20
|
-
config.before(:all) do
|
|
21
|
-
if sauce_driver?
|
|
22
|
-
suite_name = "#{(ENV['RAKE_TASK'] || 'CUSTOM').sub('rspec:', '').upcase} #{settings.sl_browser_name.upcase}"
|
|
23
|
-
Capybara.drivers[:sauce][].options[:desired_capabilities][:name] = suite_name
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
19
|
config.before(:each) do
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
scenario_name =
|
|
21
|
+
if RSpec.current_example.description.blank?
|
|
22
|
+
RSpec.current_example.metadata[:full_description]
|
|
23
|
+
else
|
|
24
|
+
RSpec.current_example.description
|
|
25
|
+
end
|
|
26
|
+
Howitzer::Log.print_scenario_name(scenario_name)
|
|
27
|
+
@session_start = CapybaraHelpers.duration(Time.now.utc - Howitzer::Cache.extract(:cloud, :start_time))
|
|
30
28
|
end
|
|
31
29
|
|
|
32
30
|
config.after(:each) do
|
|
33
|
-
|
|
34
|
-
if
|
|
35
|
-
session_end = duration(Time.now.utc -
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
Howitzer::Cache.clear_all_ns
|
|
32
|
+
if CapybaraHelpers.cloud_driver?
|
|
33
|
+
session_end = CapybaraHelpers.duration(Time.now.utc - Howitzer::Cache.extract(:cloud, :start_time))
|
|
34
|
+
Howitzer::Log.info "CLOUD VIDEO #{@session_start} - #{session_end}" \
|
|
35
|
+
" URL: #{CapybaraHelpers.cloud_resource_path(:video)}"
|
|
36
|
+
elsif CapybaraHelpers.ie_browser?
|
|
37
|
+
Howitzer::Log.info 'IE reset session'
|
|
39
38
|
page.execute_script("void(document.execCommand('ClearAuthenticationCache', false));")
|
|
40
|
-
end
|
|
39
|
+
end
|
|
40
|
+
Capybara.reset_sessions!
|
|
41
|
+
Capybara.use_default_driver
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
config.after(:suite) do
|
|
44
|
-
if
|
|
45
|
-
report_failures_count = config.reporter.
|
|
46
|
-
|
|
45
|
+
if CapybaraHelpers.cloud_driver?
|
|
46
|
+
report_failures_count = config.reporter.failed_examples.count
|
|
47
|
+
Howitzer::Cache.store(:cloud, :status, report_failures_count.zero?)
|
|
47
48
|
end
|
|
48
49
|
end
|
|
49
50
|
|
|
50
51
|
at_exit do
|
|
51
|
-
if
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if CapybaraHelpers.cloud_driver?
|
|
53
|
+
Howitzer::Log.info "CLOUD SERVER LOG URL: #{CapybaraHelpers.cloud_resource_path(:server_log)}"
|
|
54
|
+
CapybaraHelpers.update_cloud_job_status(passed: Howitzer::Cache.extract(:cloud, :status))
|
|
54
55
|
end
|
|
55
56
|
end
|
|
56
57
|
end
|