howitzer 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,8 +1,3 @@
|
|
1
|
-
###########################################################
|
2
|
-
# COMMON SETTINGS #
|
3
|
-
###########################################################
|
4
|
-
debug_mode: false
|
5
|
-
|
6
1
|
###########################################################
|
7
2
|
# APPLICATION SETTINGS #
|
8
3
|
###########################################################
|
@@ -11,109 +6,82 @@
|
|
11
6
|
app_protocol: http
|
12
7
|
app_host: my.website.com
|
13
8
|
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
app_test_user: test@test.com
|
10
|
+
app_test_pass: mypass
|
11
|
+
app_test_user_name: Auto Tester
|
12
|
+
|
13
|
+
app_api_token:
|
14
|
+
app_api_end_point: "api/v1"
|
17
15
|
|
18
16
|
###########################################################
|
19
17
|
# TEST ENVIRONMENTS SETTINGS #
|
20
18
|
###########################################################
|
19
|
+
page_load_idle_timeout: 20
|
20
|
+
maximized_window: true # Specify maximized browser window size
|
21
21
|
|
22
|
-
# Specify
|
23
|
-
|
24
|
-
|
25
|
-
# Specify one of the following drivers: selenium, selenium_dev, selenium_grid, webkit, poltergeist, phantomjs, sauce, testingbot, browserstack
|
22
|
+
# Specify one of the following drivers: selenium, selenium_grid, webkit, poltergeist, phantomjs, sauce,
|
23
|
+
# testingbot, browserstack
|
26
24
|
driver: phantomjs
|
27
25
|
|
28
26
|
# -Selenium-
|
29
|
-
# specify one of next browsers: iexplore (ie), firefox (ff), chrome,
|
30
|
-
|
27
|
+
# specify one of next browsers: iexplore (ie), firefox (ff), chrome, safari
|
28
|
+
selenium_browser: ff
|
31
29
|
|
32
30
|
# -Selenium Grid-
|
33
|
-
|
31
|
+
selenium_hub_url: "http://example.com:4444/wd/hub"
|
34
32
|
|
35
|
-
# -PhantomJS-
|
33
|
+
# -PhantomJS/Poltergeist-
|
36
34
|
# specify settings for poltergeist
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
# -SauceLabs-
|
41
|
-
sl_user: some_user
|
42
|
-
sl_api_key: some_api_key
|
43
|
-
sl_url: "http://${sl_user}:${sl_api_key}@ondemand.saucelabs.com:80/wd/hub"
|
44
|
-
sl_platform: :VISTA
|
45
|
-
sl_browser_name: firefox
|
46
|
-
sl_selenium_version: "2.18.0"
|
47
|
-
sl_max_duration: '1800'
|
48
|
-
sl_idle_timeout: '180'
|
49
|
-
|
50
|
-
# -TestingBot- browsers that are supported: firefox => '8', googlechrome, iexplore => '9'
|
51
|
-
tb_api_key: client_key
|
52
|
-
tb_api_secret: client_secret
|
53
|
-
tb_url: "http://${tb_api_key}:${tb_api_secret}@hub.testingbot.com:80/wd/hub"
|
54
|
-
tb_platform: :WIN8
|
55
|
-
tb_browser_name: firefox
|
56
|
-
tb_browser_version: 8
|
57
|
-
tb_selenium_version: "2.18.0"
|
58
|
-
tb_max_duration: '1800'
|
59
|
-
tb_idle_timeout: '180'
|
60
|
-
tb_record_screenshot: false
|
61
|
-
|
62
|
-
# -BrowserStack
|
63
|
-
bs_user_name: bs_user
|
64
|
-
bs_password: bs_password
|
65
|
-
bs_url: "http://${bs_user_name}:${bs_password}@hub.browserstack.com/wd/hub"
|
66
|
-
bs_os_name: 'Windows'
|
67
|
-
bs_os_version: '8'
|
68
|
-
bs_browser_name: 'Firefox'
|
69
|
-
bs_browser_version: '16.0'
|
70
|
-
bs_resolution: '1024x768'
|
71
|
-
bs_max_duration: '1800'
|
72
|
-
bs_idle_timeout: '180'
|
73
|
-
|
74
|
-
# Run tests on mobile browsers
|
75
|
-
bs_mobile: false
|
76
|
-
bs_m_browser: 'iPhone'
|
77
|
-
bs_m_platform: 'MAC'
|
78
|
-
bs_m_device: 'iPhone 5'
|
79
|
-
|
80
|
-
bs_local: 'false'
|
81
|
-
bs_local_ID: 'Testing123'
|
82
|
-
bs_build: 'v1'
|
83
|
-
bs_project: 'Test Project'
|
84
|
-
bs_ssl: 'true'
|
85
|
-
bs_debug: 'false'
|
35
|
+
phantom_ignore_js_errors: false
|
36
|
+
phantom_ignore_ssl_errors: true
|
86
37
|
|
87
38
|
###########################################################
|
88
|
-
#
|
39
|
+
# Cloud-based Cross-browser Services #
|
89
40
|
###########################################################
|
41
|
+
cloud_auth_login: some_user_or_client_key
|
42
|
+
cloud_auth_pass: api_key_or_api_secret_or_access_key
|
43
|
+
cloud_platform: any
|
44
|
+
cloud_browser_name: Chrome
|
45
|
+
cloud_browser_version: '31'
|
46
|
+
cloud_max_duration: '1800'
|
47
|
+
cloud_http_idle_timeout: 40
|
48
|
+
|
49
|
+
# -SauceLabs- (https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options)
|
50
|
+
cloud_sauce_record_screenshots: false
|
51
|
+
cloud_sauce_idle_timeout: '180'
|
52
|
+
cloud_sauce_video_upload_on_pass: false
|
53
|
+
|
54
|
+
# -TestingBot- (https://testingbot.com/support/other/test-options)
|
55
|
+
cloud_testingbot_idle_timeout: '180'
|
56
|
+
cloud_testingbot_screenshots: false
|
57
|
+
|
58
|
+
# -BrowserStack (https://www.browserstack.com/automate/capabilities)
|
59
|
+
cloud_bstack_resolution: '1024x768'
|
60
|
+
cloud_bstack_project: 'Howitzer Example'
|
61
|
+
cloud_bstack_build: 'v1'
|
62
|
+
cloud_bstack_resolution: '1024x768'
|
63
|
+
cloud_bstack_mobile_device:
|
90
64
|
|
91
|
-
|
65
|
+
###########################################################
|
66
|
+
# CAPYBARA SETTINGS #
|
67
|
+
###########################################################
|
68
|
+
capybara_wait_time: 20
|
92
69
|
|
93
70
|
###########################################################
|
94
71
|
# LOGGER SETTINGS #
|
95
72
|
###########################################################
|
96
73
|
log_dir: "log"
|
97
|
-
|
74
|
+
debug_mode: false
|
98
75
|
html_log: log.html
|
99
76
|
selenium_server_log: selenium-server.log
|
100
77
|
required_clean_logs: true
|
101
|
-
|
102
|
-
add_rawler_xml_log: false
|
103
|
-
rawler_xml_log: rawler_log.xml
|
104
|
-
add_rawler_html_log: false # not implemented yet
|
105
|
-
rawler_html_log: rawler_log.html # not implemented yet
|
78
|
+
hide_datetime_from_log: false
|
106
79
|
|
107
80
|
###########################################################
|
108
|
-
#
|
81
|
+
# MAIL SETTINGS #
|
109
82
|
###########################################################
|
83
|
+
mail_adapter: mailgun
|
110
84
|
mailgun_key: mailgun_account_private_key
|
111
85
|
mailgun_domain: mailgun_domain_with_stored_method
|
112
|
-
|
113
|
-
|
114
|
-
# TIMEOUTS #
|
115
|
-
############################################################
|
116
|
-
timeout_tiny: 1
|
117
|
-
timeout_short: 3
|
118
|
-
timeout_small: 20
|
119
|
-
timeout_medium: 60
|
86
|
+
mailgun_idle_timeout: 60
|
87
|
+
mailgun_sleep_time: 3
|
@@ -1,25 +1,25 @@
|
|
1
1
|
require_relative '../base_generator'
|
2
2
|
|
3
3
|
module Howitzer
|
4
|
+
# This class responsible for Cucumber based files generation
|
4
5
|
class CucumberGenerator < BaseGenerator
|
5
6
|
def manifest
|
6
7
|
{ files:
|
7
8
|
[
|
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
|
-
|
14
|
-
]
|
15
|
-
}
|
9
|
+
{ source: 'common_steps.rb', destination: 'features/step_definitions/common_steps.rb' },
|
10
|
+
{ source: 'env.rb', destination: 'features/support/env.rb' },
|
11
|
+
{ source: 'transformers.rb', destination: 'features/support/transformers.rb' },
|
12
|
+
{ source: 'example.feature', destination: 'features/example.feature' },
|
13
|
+
{ source: 'cucumber.rake', destination: 'tasks/cucumber.rake' }
|
14
|
+
] }
|
16
15
|
end
|
17
16
|
|
18
17
|
protected
|
18
|
+
|
19
19
|
def banner
|
20
20
|
<<-EOS
|
21
21
|
* Cucumber integration to the framework ...
|
22
22
|
EOS
|
23
23
|
end
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# PREREQUISITES #
|
3
3
|
#############################################################
|
4
4
|
|
5
|
-
Given /^I have entered (.*) into the calculator$/ do |
|
5
|
+
Given /^I have entered (.*) into the calculator$/ do |_input_|
|
6
6
|
pending
|
7
7
|
end
|
8
8
|
|
@@ -10,7 +10,7 @@ end
|
|
10
10
|
# ACTIONS #
|
11
11
|
####################################
|
12
12
|
|
13
|
-
When /^I press (.*)$/ do |
|
13
|
+
When /^I press (.*)$/ do |_button|
|
14
14
|
pending
|
15
15
|
end
|
16
16
|
|
@@ -18,6 +18,6 @@ end
|
|
18
18
|
# CHECKS #
|
19
19
|
####################################
|
20
20
|
|
21
|
-
Then /^the result should be (.*) on the screen$/ do |
|
21
|
+
Then /^the result should be (.*) on the screen$/ do |_output|
|
22
22
|
pending
|
23
|
-
end
|
23
|
+
end
|
@@ -1,57 +1,66 @@
|
|
1
|
+
require 'cucumber'
|
2
|
+
require 'cucumber/rake/task'
|
1
3
|
|
2
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
4
|
+
opts = lambda do |task_name|
|
5
|
+
[
|
6
|
+
'-r features',
|
7
|
+
'-v',
|
8
|
+
'-x',
|
9
|
+
"-f html -o ./#{Howitzer.log_dir}/#{Howitzer.driver}_#{task_name}_#{Howitzer.html_log}",
|
10
|
+
"-f junit -o ./#{Howitzer.log_dir}",
|
11
|
+
'-f pretty'
|
12
|
+
].join(' ').freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run all cucumber scenarios') do |t|
|
16
|
+
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
17
|
+
t.fork = false
|
18
|
+
t.cucumber_opts = opts.call(t.instance_variable_get(:@task_name))
|
19
|
+
end
|
20
|
+
|
21
|
+
Cucumber::Rake::Task.new(:features, 'Run all workable scenarios (without @wip and @bug tags)') do |t|
|
22
|
+
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
23
|
+
t.fork = false
|
24
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags ~@wip --tags ~@bug"
|
25
|
+
end
|
26
|
+
|
27
|
+
namespace :features do
|
28
|
+
Cucumber::Rake::Task.new(:wip, 'Run scenarios in progress (with @wip tag)') do |t|
|
29
|
+
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
30
|
+
t.fork = false
|
31
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags @wip"
|
32
|
+
end
|
33
|
+
|
34
|
+
Cucumber::Rake::Task.new(:bug, 'Run scenarios with known bugs (with @bug tag)') do |t|
|
35
|
+
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
36
|
+
t.fork = false
|
37
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags @bug"
|
38
|
+
end
|
39
|
+
|
40
|
+
Cucumber::Rake::Task.new(:smoke, 'Run workable smoke scenarios (with @smoke tag)') do |t|
|
41
|
+
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
42
|
+
t.fork = false
|
43
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags @smoke --tags ~@wip --tags ~@bug"
|
44
|
+
end
|
45
|
+
|
46
|
+
Cucumber::Rake::Task.new(:bvt, 'Run workable build verification test scenarios') do |t|
|
47
|
+
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
48
|
+
t.fork = false
|
49
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))}
|
50
|
+
--tags ~@wip --tags ~@bug --tags ~@smoke --tags ~@p1 --tags ~@p2"
|
51
|
+
end
|
52
|
+
|
53
|
+
Cucumber::Rake::Task.new(:p1, 'Run workable scenarios with normal priority (with @p1 tag)') do |t|
|
54
|
+
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
55
|
+
t.fork = false
|
56
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags ~@wip --tags ~@bug --tags @p1"
|
57
|
+
end
|
58
|
+
|
59
|
+
Cucumber::Rake::Task.new(:p2, 'Run workable scenarios with low priority (with @p2 tag)') do |t|
|
60
|
+
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
61
|
+
t.fork = false
|
62
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags ~@wip --tags ~@bug --tags @p2"
|
55
63
|
end
|
64
|
+
end
|
56
65
|
|
57
|
-
|
66
|
+
task default: :features
|
@@ -1,39 +1,40 @@
|
|
1
1
|
require 'cucumber'
|
2
|
-
require 'capybara/cucumber'
|
3
|
-
require_relative '../../boot'
|
2
|
+
require 'capybara-screenshot/cucumber'
|
3
|
+
require_relative '../../config/boot'
|
4
|
+
require_relative '../../config/capybara'
|
4
5
|
|
5
|
-
World(
|
6
|
-
World(DataGenerator)
|
6
|
+
World(FactoryGirl::Syntax::Methods)
|
7
7
|
|
8
|
-
|
9
|
-
DataStorage.store('sauce', :start_time, Time.now.utc)
|
10
|
-
DataStorage.store('sauce', :status, true)
|
8
|
+
FileUtils.mkdir_p(Howitzer.log_dir)
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
Howitzer::Log.settings_as_formatted_text
|
11
|
+
Howitzer::Cache.store(:cloud, :start_time, Time.now.utc)
|
12
|
+
Howitzer::Cache.store(:cloud, :status, true)
|
15
13
|
|
16
14
|
Before do |scenario|
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
Capybara.use_default_driver
|
16
|
+
Howitzer::Log.print_feature_name(scenario.feature.name)
|
17
|
+
Howitzer::Log.print_scenario_name(scenario.name)
|
18
|
+
@session_start = CapybaraHelpers.duration(Time.now.utc - Howitzer::Cache.extract(:cloud, :start_time))
|
20
19
|
end
|
21
20
|
|
22
21
|
After do |scenario|
|
23
|
-
if
|
24
|
-
|
25
|
-
session_end = duration(Time.now.utc -
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
if CapybaraHelpers.cloud_driver?
|
23
|
+
Howitzer::Cache.store(:cloud, :status, false) if scenario.failed?
|
24
|
+
session_end = CapybaraHelpers.duration(Time.now.utc - Howitzer::Cache.extract(:cloud, :start_time))
|
25
|
+
Howitzer::Log.info "CLOUD VIDEO #{@session_start} - #{session_end}" \
|
26
|
+
" URL: #{CapybaraHelpers.cloud_resource_path(:video)}"
|
27
|
+
elsif CapybaraHelpers.ie_browser?
|
28
|
+
Howitzer::Log.info 'IE reset session'
|
29
29
|
page.execute_script("void(document.execCommand('ClearAuthenticationCache', false));")
|
30
30
|
end
|
31
|
-
|
31
|
+
Howitzer::Cache.clear_all_ns
|
32
|
+
Capybara.reset_sessions!
|
32
33
|
end
|
33
34
|
|
34
35
|
at_exit do
|
35
|
-
if
|
36
|
-
|
37
|
-
|
36
|
+
if CapybaraHelpers.cloud_driver?
|
37
|
+
Howitzer::Log.info "CLOUD SERVER LOG URL: #{CapybaraHelpers.cloud_resource_path(:server_log)}"
|
38
|
+
CapybaraHelpers.update_cloud_job_status(passed: Howitzer::Cache.extract(:cloud, :status))
|
38
39
|
end
|
39
40
|
end
|
@@ -1,30 +1,38 @@
|
|
1
1
|
#############################################################
|
2
2
|
# TRANSFORMERS #
|
3
3
|
#############################################################
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
# Revives factory or factory property from step to real value
|
6
|
+
# @note any factory is building once per scenario for the same number.
|
7
|
+
# if number is ommited, then it is assigned to 0 number.
|
8
|
+
# Built factories are stored in Howitzer::Cache and cleared after each
|
9
|
+
# scenario automatically
|
10
|
+
# @example
|
11
|
+
# 'When I fill first name field with FACTORY_USER1[:first_name] value'
|
12
|
+
# #=> build(:user).first_name
|
13
|
+
Transform /FACTORY_([a-z_]+)(\d*)(?:\[\:(.+)\])?/i do |factory, num, property|
|
14
|
+
res = FactoryGirl.given_by_number(factory.downcase, num)
|
6
15
|
res = res.send(property) if property
|
7
16
|
res
|
8
17
|
end
|
9
18
|
|
19
|
+
# Revives factories or factory properties from table to real values
|
20
|
+
# @example
|
21
|
+
# When I sign up with following data:
|
22
|
+
# | name | email |
|
23
|
+
# | FACTORY_USER1[:name] | FACTORY_USER1[:email] |
|
24
|
+
# #=> build(:user).name and build(:user).email
|
10
25
|
Transform /^table:.*$/ do |table|
|
11
26
|
raw = table.raw.map do |array|
|
12
27
|
array.map do |el|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
res = Gen::given_user_by_number(data[:num])
|
19
|
-
if data[:property]
|
20
|
-
res = res.send(data[:property])
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
res
|
28
|
+
data = /FACTORY_(?<factory>[a-z_]+)(?<num>\d*)(?:\[\:(?<property>.+)\])?/i.match(el)
|
29
|
+
next(el) unless data
|
30
|
+
res = FactoryGirl.given_by_number(data[:factory].downcase, data[:num])
|
31
|
+
next(res) if data[:property].blank?
|
32
|
+
res.send(data[:property])
|
25
33
|
end
|
26
34
|
end
|
27
35
|
location = Cucumber::Core::Ast::Location.of_caller
|
28
36
|
ast_table = Cucumber::Core::Ast::DataTable.new(raw, location)
|
29
37
|
Cucumber::MultilineArgument::DataTable.new(ast_table)
|
30
|
-
end
|
38
|
+
end
|