howitzer 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +14 -1
- data/generators/config/templates/capybara.rb +2 -0
- data/generators/config/templates/drivers/browserstack.rb +4 -0
- data/generators/config/templates/drivers/crossbrowsertesting.rb +4 -0
- data/generators/config/templates/drivers/headless_chrome.rb +2 -3
- data/generators/config/templates/drivers/phantomjs.rb +2 -3
- data/generators/config/templates/drivers/sauce.rb +4 -0
- data/generators/config/templates/drivers/selenium_grid.rb +4 -0
- data/generators/config/templates/drivers/testingbot.rb +4 -0
- data/generators/cucumber/templates/common_steps.rb +3 -3
- data/generators/cucumber/templates/cucumber.rake +5 -5
- data/generators/cucumber/templates/transformers.rb +1 -1
- data/generators/rspec/templates/rspec.rake +8 -8
- data/lib/howitzer.rb +26 -10
- data/lib/howitzer/exceptions.rb +1 -0
- data/lib/howitzer/version.rb +1 -1
- data/lib/howitzer/web/iframe_dsl.rb +19 -1
- data/spec/unit/generators/config_generator_spec.rb +7 -7
- data/spec/unit/lib/howitzer_spec.rb +29 -0
- data/spec/unit/lib/web/iframe_dsl_spec.rb +59 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94940ab8c75aebb8875f48220c8019504db644bd
|
4
|
+
data.tar.gz: 1228bad1fea3a9b128e74d248c394c8a4ac1bcfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87eefa4b47bfc459116c1ada0bd47b013f4ef7f519b8e88297adbe2b6526513a78bc401980b97a07fc50ce737505b2a95e13738ad21b42a9bf2cf22097f88cd9
|
7
|
+
data.tar.gz: 520dc413394cdc682f421477f0e6779fc403dd364172e5b83afbfd28d99c22d957fd5841852dfd427f0ce3b08f398921afa5a6dcb5fdb90a91e4d741a80ed99a
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,22 @@
|
|
1
|
-
## [In git](https://github.com/strongqa/howitzer/compare/v2.1.
|
1
|
+
## [In git](https://github.com/strongqa/howitzer/compare/v2.1.1...master)
|
2
2
|
|
3
3
|
### New Features
|
4
4
|
|
5
5
|
### Bug-fixes
|
6
6
|
|
7
|
+
## [v2.1.1](https://github.com/strongqa/howitzer/compare/v2.1.0...v2.1.1)
|
8
|
+
|
9
|
+
### New Features
|
10
|
+
- Cucumber rake tasks minor updates
|
11
|
+
- [#257](https://github.com/strongqa/howitzer/issues/257) Simplify working with multiple domains
|
12
|
+
|
13
|
+
### Bug-fixes
|
14
|
+
- [#225](https://github.com/strongqa/howitzer/issues/225) Frames under namespace support
|
15
|
+
- [#254](https://github.com/strongqa/howitzer/issues/254) Screenshot driver now created for the active driver
|
16
|
+
- [#252](https://github.com/strongqa/howitzer/issues/252) Wrong location of log files fixed
|
17
|
+
- [#248](https://github.com/strongqa/howitzer/issues/248) FactoryGirl renamed to FactoryBot in cucumber transformation.
|
18
|
+
- [#246](https://github.com/strongqa/howitzer/issues/246) Options fixed for rspec rake tasks
|
19
|
+
|
7
20
|
## [v2.1.0](https://github.com/strongqa/howitzer/compare/v2.0.3...v2.1.0)
|
8
21
|
|
9
22
|
### New Features
|
@@ -39,6 +39,8 @@ end
|
|
39
39
|
|
40
40
|
require_relative "drivers/#{Howitzer.driver}"
|
41
41
|
|
42
|
+
Capybara.save_path = Howitzer.log_dir
|
43
|
+
|
42
44
|
Capybara::Screenshot.append_timestamp = false
|
43
45
|
Capybara::Screenshot.register_filename_prefix_formatter(:default) do
|
44
46
|
"capybara-screenshot-#{Gen.serial}"
|
@@ -17,3 +17,7 @@ Capybara.register_driver :browserstack do |app|
|
|
17
17
|
url = "http://#{Howitzer.cloud_auth_login}:#{Howitzer.cloud_auth_pass}@hub.browserstack.com/wd/hub"
|
18
18
|
CapybaraHelpers.cloud_driver(app, caps, url)
|
19
19
|
end
|
20
|
+
|
21
|
+
Capybara::Screenshot.class_eval do
|
22
|
+
register_driver :browserstack, ®istered_drivers[:selenium]
|
23
|
+
end
|
@@ -23,3 +23,7 @@ Capybara.register_driver :crossbrowsertesting do |app|
|
|
23
23
|
'@hub.crossbrowsertesting.com/wd/hub'
|
24
24
|
CapybaraHelpers.cloud_driver(app, caps, url)
|
25
25
|
end
|
26
|
+
|
27
|
+
Capybara::Screenshot.class_eval do
|
28
|
+
register_driver :crossbrowsertesting, ®istered_drivers[:selenium]
|
29
|
+
end
|
@@ -10,7 +10,6 @@ Capybara.register_driver :headless_chrome do |app|
|
|
10
10
|
Capybara::Selenium::Driver.new app, params
|
11
11
|
end
|
12
12
|
|
13
|
-
Capybara.
|
14
|
-
|
15
|
-
driver.browser.save_screenshot path
|
13
|
+
Capybara::Screenshot.class_eval do
|
14
|
+
register_driver :headless_chrome, ®istered_drivers[:selenium]
|
16
15
|
end
|
@@ -14,7 +14,6 @@ Capybara.register_driver :phantomjs do |app|
|
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
|
-
Capybara.
|
18
|
-
|
19
|
-
driver.browser.save_screenshot path
|
17
|
+
Capybara::Screenshot.class_eval do
|
18
|
+
register_driver :phantomjs, ®istered_drivers[:selenium]
|
20
19
|
end
|
@@ -19,3 +19,7 @@ Capybara.register_driver :sauce do |app|
|
|
19
19
|
url = "http://#{Howitzer.cloud_auth_login}:#{Howitzer.cloud_auth_pass}@ondemand.saucelabs.com:80/wd/hub"
|
20
20
|
CapybaraHelpers.cloud_driver(app, caps, url)
|
21
21
|
end
|
22
|
+
|
23
|
+
Capybara::Screenshot.class_eval do
|
24
|
+
register_driver :sauce, ®istered_drivers[:selenium]
|
25
|
+
end
|
@@ -25,3 +25,7 @@ Capybara.register_driver :selenium_grid do |app|
|
|
25
25
|
end
|
26
26
|
Capybara::Selenium::Driver.new(app, browser: :remote, url: Howitzer.selenium_hub_url, desired_capabilities: caps)
|
27
27
|
end
|
28
|
+
|
29
|
+
Capybara::Screenshot.class_eval do
|
30
|
+
register_driver :selenium_grid, ®istered_drivers[:selenium]
|
31
|
+
end
|
@@ -18,3 +18,7 @@ Capybara.register_driver :testingbot do |app|
|
|
18
18
|
url = "http://#{Howitzer.cloud_auth_login}:#{Howitzer.cloud_auth_pass}@hub.testingbot.com/wd/hub"
|
19
19
|
CapybaraHelpers.cloud_driver(app, caps, url)
|
20
20
|
end
|
21
|
+
|
22
|
+
Capybara::Screenshot.class_eval do
|
23
|
+
register_driver :testingbot, ®istered_drivers[:selenium]
|
24
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# PREREQUISITES #
|
3
3
|
#############################################################
|
4
4
|
|
5
|
-
Given
|
5
|
+
Given 'I have entered {float} 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
|
13
|
+
When 'I press {word}' do |_button|
|
14
14
|
pending
|
15
15
|
end
|
16
16
|
|
@@ -18,6 +18,6 @@ end
|
|
18
18
|
# CHECKS #
|
19
19
|
####################################
|
20
20
|
|
21
|
-
Then
|
21
|
+
Then 'the result should be {float} on the screen' do |_output|
|
22
22
|
pending
|
23
23
|
end
|
@@ -19,7 +19,7 @@ end
|
|
19
19
|
|
20
20
|
Cucumber::Rake::Task.new(:features, 'Run all workable scenarios (without @wip and @bug tags)') do |t|
|
21
21
|
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
22
|
-
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags
|
22
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags 'not @wip and not @bug'"
|
23
23
|
end
|
24
24
|
|
25
25
|
namespace :features do
|
@@ -35,23 +35,23 @@ namespace :features do
|
|
35
35
|
|
36
36
|
Cucumber::Rake::Task.new(:smoke, 'Run workable smoke scenarios (with @smoke tag)') do |t|
|
37
37
|
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
38
|
-
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags @smoke
|
38
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags '@smoke and not @wip and not @bug'"
|
39
39
|
end
|
40
40
|
|
41
41
|
Cucumber::Rake::Task.new(:bvt, 'Run workable build verification test scenarios') do |t|
|
42
42
|
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
43
43
|
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))}
|
44
|
-
--tags
|
44
|
+
--tags 'not @wip and not @bug and not @smoke and not @p1 and not @p2'"
|
45
45
|
end
|
46
46
|
|
47
47
|
Cucumber::Rake::Task.new(:p1, 'Run workable scenarios with normal priority (with @p1 tag)') do |t|
|
48
48
|
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
49
|
-
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags
|
49
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags 'not @wip and not @bug and @p1'"
|
50
50
|
end
|
51
51
|
|
52
52
|
Cucumber::Rake::Task.new(:p2, 'Run workable scenarios with low priority (with @p2 tag)') do |t|
|
53
53
|
Howitzer.current_rake_task = t.instance_variable_get :@task_name
|
54
|
-
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags
|
54
|
+
t.cucumber_opts = "#{opts.call(t.instance_variable_get(:@task_name))} --tags 'not @wip and not @bug and @p2'"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -17,7 +17,7 @@ ParameterType(
|
|
17
17
|
name: 'factory',
|
18
18
|
regexp: /(?:factory|FACTORY)_([A-Za-z_]+)(\d*)(?:\[\:(.+)\])?/,
|
19
19
|
transformer: lambda do |_, factory, num, property|
|
20
|
-
res =
|
20
|
+
res = FactoryBot.given_by_number(factory.downcase, num)
|
21
21
|
res = res.send(property) if property
|
22
22
|
res
|
23
23
|
end
|
@@ -10,43 +10,43 @@ end
|
|
10
10
|
|
11
11
|
RSpec::Core::RakeTask.new(:rspec, 'Run all rspec scenarios') do |t|
|
12
12
|
Howitzer.current_rake_task = t.name
|
13
|
-
t.
|
13
|
+
t.rspec_opts = opts.call(t.name)
|
14
14
|
end
|
15
15
|
|
16
16
|
RSpec::Core::RakeTask.new(:features, 'Run all workable scenarios (without @wip and @bug tags)') do |t|
|
17
17
|
Howitzer.current_rake_task = t.name
|
18
|
-
t.
|
18
|
+
t.rspec_opts = "#{opts.call(t.name)} --tag ~wip --tag ~bug"
|
19
19
|
end
|
20
20
|
|
21
21
|
namespace :features do
|
22
22
|
RSpec::Core::RakeTask.new(:wip, 'Run scenarios in progress (with @wip tag)') do |t|
|
23
23
|
Howitzer.current_rake_task = t.name
|
24
|
-
t.
|
24
|
+
t.rspec_opts = "#{opts.call(t.name)} --tag wip"
|
25
25
|
end
|
26
26
|
|
27
27
|
RSpec::Core::RakeTask.new(:bug, 'Run scenarios with known bugs (with @bug tag)') do |t|
|
28
28
|
Howitzer.current_rake_task = t.name
|
29
|
-
t.
|
29
|
+
t.rspec_opts = "#{opts.call(t.name)} --tag bug"
|
30
30
|
end
|
31
31
|
|
32
32
|
RSpec::Core::RakeTask.new(:smoke, 'Run workable smoke scenarios (with @smoke tag)') do |t|
|
33
33
|
Howitzer.current_rake_task = t.name
|
34
|
-
t.
|
34
|
+
t.rspec_opts = "#{opts.call(t.name)} --tag smoke --tag ~wip --tag ~bug"
|
35
35
|
end
|
36
36
|
|
37
37
|
RSpec::Core::RakeTask.new(:bvt, 'Run workable build verification test scenarios') do |t|
|
38
38
|
Howitzer.current_rake_task = t.name
|
39
|
-
t.
|
39
|
+
t.rspec_opts = "#{opts.call(t.name)} --tag ~wip --tag ~bug --tag ~p1 --tag ~p2 --tag ~smoke"
|
40
40
|
end
|
41
41
|
|
42
42
|
RSpec::Core::RakeTask.new(:p1, 'Run workable scenarios with normal priority (with @p1 tag)') do |t|
|
43
43
|
Howitzer.current_rake_task = t.name
|
44
|
-
t.
|
44
|
+
t.rspec_opts = "#{opts.call(t.name)} --tag p1 --tag ~wip --tag ~bug"
|
45
45
|
end
|
46
46
|
|
47
47
|
RSpec::Core::RakeTask.new(:p2, 'Run workable scenarios with low priority (with @p2 tag)') do |t|
|
48
48
|
Howitzer.current_rake_task = t.name
|
49
|
-
t.
|
49
|
+
t.rspec_opts = "#{opts.call(t.name)} --tag p2 --tag ~wip --tag ~bug"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
data/lib/howitzer.rb
CHANGED
@@ -2,6 +2,8 @@ require 'selenium-webdriver'
|
|
2
2
|
require 'capybara'
|
3
3
|
require 'sexy_settings'
|
4
4
|
require 'rspec/wait'
|
5
|
+
require 'howitzer/version'
|
6
|
+
require 'howitzer/exceptions'
|
5
7
|
|
6
8
|
SexySettings.configure do |config|
|
7
9
|
config.path_to_default_settings = File.expand_path('config/default.yml', Dir.pwd)
|
@@ -30,25 +32,39 @@ module Howitzer
|
|
30
32
|
attr_accessor :current_rake_task
|
31
33
|
end
|
32
34
|
|
33
|
-
# @return an application uri
|
35
|
+
# @return an application uri for particular application name
|
36
|
+
#
|
37
|
+
# @param name [Symbol, String] an application name from framework settings
|
34
38
|
#
|
35
|
-
# @example returns url with auth
|
39
|
+
# @example returns default application url with auth
|
36
40
|
# app_uri.site
|
37
|
-
# @example returns url
|
41
|
+
# @example returns example application url with auth
|
42
|
+
# app_uri(:example).site
|
43
|
+
# @example returns default application url without auth
|
38
44
|
# app_uri.origin
|
39
45
|
|
40
|
-
def self.app_uri
|
46
|
+
def self.app_uri(name = nil)
|
47
|
+
prefix = "#{name}_" if name.present?
|
41
48
|
::Addressable::URI.new(
|
42
|
-
user: Howitzer.app_base_auth_login,
|
43
|
-
password: Howitzer.app_base_auth_pass,
|
44
|
-
host: Howitzer.app_host,
|
45
|
-
scheme: Howitzer.app_protocol || 'http'
|
49
|
+
user: Howitzer.sexy_setting!("#{prefix}app_base_auth_login"),
|
50
|
+
password: Howitzer.sexy_setting!("#{prefix}app_base_auth_pass"),
|
51
|
+
host: Howitzer.sexy_setting!("#{prefix}app_host"),
|
52
|
+
scheme: Howitzer.sexy_setting!("#{prefix}app_protocol") || 'http'
|
46
53
|
)
|
47
54
|
end
|
55
|
+
|
56
|
+
# @return an setting value or raise error
|
57
|
+
#
|
58
|
+
# @param name [Symbol, String] an setting name
|
59
|
+
# @raise [Howitzer::UndefinedSexySettingError] when the setting is not specified
|
60
|
+
|
61
|
+
def self.sexy_setting!(name)
|
62
|
+
return Howitzer.public_send(name) if Howitzer.respond_to?(name)
|
63
|
+
raise UndefinedSexySettingError,
|
64
|
+
"Undefined '#{name}' setting. Please add the setting to config/default.yml:\n #{name}: some_value\n"
|
65
|
+
end
|
48
66
|
end
|
49
67
|
|
50
|
-
require 'howitzer/version'
|
51
|
-
require 'howitzer/exceptions'
|
52
68
|
require 'howitzer/log'
|
53
69
|
require 'howitzer/utils'
|
54
70
|
require 'howitzer/cache'
|
data/lib/howitzer/exceptions.rb
CHANGED
data/lib/howitzer/version.rb
CHANGED
@@ -45,6 +45,7 @@ module Howitzer
|
|
45
45
|
# <b>has_no_<em>frame_name</em>_iframe?</b> - equals capybara #has_no_selector(...) method
|
46
46
|
# @param name [Symbol, String] an unique iframe name
|
47
47
|
# @param args [Array] original Capybara arguments. For details, see `Capybara::Session#within_frame`.
|
48
|
+
# @raise [NameError] if page class can not be found
|
48
49
|
# @example Using in a page class
|
49
50
|
# class FbPage < Howitzer::Web::Page
|
50
51
|
# element :like, :xpath, ".//*[text()='Like']"
|
@@ -57,8 +58,19 @@ module Howitzer
|
|
57
58
|
# end
|
58
59
|
# end
|
59
60
|
#
|
61
|
+
# module Utils
|
62
|
+
# class GroupFbPage < Howitzer::Web::Page
|
63
|
+
# end
|
64
|
+
# end
|
65
|
+
#
|
60
66
|
# class HomePage < Howitzer::Web::Page
|
61
67
|
# iframe :fb, 1
|
68
|
+
#
|
69
|
+
# # frame with explicit class declaration
|
70
|
+
# # iframe :fb, FbPage, 1
|
71
|
+
#
|
72
|
+
# # frame with namespace
|
73
|
+
# iframe :utils_group_fb
|
62
74
|
# end
|
63
75
|
#
|
64
76
|
# HomePage.on do
|
@@ -72,7 +84,8 @@ module Howitzer
|
|
72
84
|
|
73
85
|
def iframe(name, *args)
|
74
86
|
raise ArgumentError, 'iframe selector arguments must be specified' if args.blank?
|
75
|
-
klass =
|
87
|
+
klass = args.first.is_a?(Class) ? args.shift : find_matching_class(name)
|
88
|
+
raise NameError, "class can not be found for #{name} iframe" if klass.blank?
|
76
89
|
define_iframe(klass, name, args)
|
77
90
|
define_has_iframe(name, args)
|
78
91
|
define_has_no_iframe(name, args)
|
@@ -100,6 +113,11 @@ module Howitzer
|
|
100
113
|
capybara_context.has_no_selector?(*iframe_element_selector(args, params))
|
101
114
|
end
|
102
115
|
end
|
116
|
+
|
117
|
+
def find_matching_class(name)
|
118
|
+
Howitzer::Web::Page.descendants.select { |el| el.name.underscore.tr('/', '_') == "#{name}_page" }
|
119
|
+
.max_by { |el| el.name.count('::') }
|
120
|
+
end
|
103
121
|
end
|
104
122
|
end
|
105
123
|
end
|
@@ -20,15 +20,15 @@ RSpec.describe 'Generators' do
|
|
20
20
|
{ name: '/config/custom.yml', is_directory: false, size: template_file_size('config', 'custom.yml') },
|
21
21
|
{ name: '/config/default.yml', is_directory: false, size: template_file_size('config', 'default.yml') },
|
22
22
|
{ name: '/config/drivers', is_directory: true },
|
23
|
-
{ name: '/config/drivers/browserstack.rb', is_directory: false, size:
|
24
|
-
{ name: '/config/drivers/crossbrowsertesting.rb', is_directory: false, size:
|
25
|
-
{ name: '/config/drivers/headless_chrome.rb', is_directory: false, size:
|
26
|
-
{ name: '/config/drivers/phantomjs.rb', is_directory: false, size:
|
23
|
+
{ name: '/config/drivers/browserstack.rb', is_directory: false, size: 1018 },
|
24
|
+
{ name: '/config/drivers/crossbrowsertesting.rb', is_directory: false, size: 1237 },
|
25
|
+
{ name: '/config/drivers/headless_chrome.rb', is_directory: false, size: 649 },
|
26
|
+
{ name: '/config/drivers/phantomjs.rb', is_directory: false, size: 589 },
|
27
27
|
{ name: '/config/drivers/poltergeist.rb', is_directory: false, size: 362 },
|
28
|
-
{ name: '/config/drivers/sauce.rb', is_directory: false, size:
|
28
|
+
{ name: '/config/drivers/sauce.rb', is_directory: false, size: 968 },
|
29
29
|
{ name: '/config/drivers/selenium.rb', is_directory: false, size: 1097 },
|
30
|
-
{ name: '/config/drivers/selenium_grid.rb', is_directory: false, size:
|
31
|
-
{ name: '/config/drivers/testingbot.rb', is_directory: false, size:
|
30
|
+
{ name: '/config/drivers/selenium_grid.rb', is_directory: false, size: 1377 },
|
31
|
+
{ name: '/config/drivers/testingbot.rb', is_directory: false, size: 906 },
|
32
32
|
{ name: '/config/drivers/webkit.rb', is_directory: false, size: 179 }
|
33
33
|
]
|
34
34
|
end
|
@@ -27,6 +27,35 @@ RSpec.describe 'Howitzer' do
|
|
27
27
|
let(:app_base_auth_pass_setting) { nil }
|
28
28
|
it { expect(Howitzer.app_uri.site).to eq('http://redmine.strongqa.com') }
|
29
29
|
end
|
30
|
+
context 'when custom host exist' do
|
31
|
+
before do
|
32
|
+
allow(Howitzer).to receive(:test_app_base_auth_login) { app_base_auth_login_setting }
|
33
|
+
allow(Howitzer).to receive(:test_app_base_auth_pass) { app_base_auth_pass_setting }
|
34
|
+
allow(Howitzer).to receive(:test_app_protocol) { app_protocol_setting }
|
35
|
+
allow(Howitzer).to receive(:test_app_host) { app_host_setting }
|
36
|
+
end
|
37
|
+
let(:app_host_setting) { 'test.strongqa.com' }
|
38
|
+
let(:app_protocol_setting) { nil }
|
39
|
+
context 'when login and password present' do
|
40
|
+
let(:app_base_auth_login_setting) { 'user' }
|
41
|
+
let(:app_base_auth_pass_setting) { 'password' }
|
42
|
+
it { expect(Howitzer.app_uri(:test).site).to eq('http://user:password@test.strongqa.com') }
|
43
|
+
end
|
44
|
+
context 'when login and password blank' do
|
45
|
+
let(:app_base_auth_login_setting) { nil }
|
46
|
+
let(:app_base_auth_pass_setting) { nil }
|
47
|
+
it { expect(Howitzer.app_uri(:test).site).to eq('http://test.strongqa.com') }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
context 'when configuration settings are not specified for particular application' do
|
51
|
+
it do
|
52
|
+
expect { Howitzer.app_uri(:test).site }.to raise_error(
|
53
|
+
Howitzer::UndefinedSexySettingError,
|
54
|
+
"Undefined 'test_app_base_auth_login' setting. Please add the setting to config/default.yml:\n " \
|
55
|
+
"test_app_base_auth_login: some_value\n"
|
56
|
+
)
|
57
|
+
end
|
58
|
+
end
|
30
59
|
end
|
31
60
|
describe '.mailgun_idle_timeout' do
|
32
61
|
subject { Howitzer.mailgun_idle_timeout }
|
@@ -9,6 +9,26 @@ RSpec.describe Howitzer::Web::IframeDsl do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
12
|
+
let(:nested_class) do
|
13
|
+
module Foo
|
14
|
+
Class.new(Howitzer::Web::Page) do
|
15
|
+
section :navbar, :xpath, './body' do
|
16
|
+
element :like_button, '#foo_id'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
let(:double_nested_class) do
|
22
|
+
module Foo
|
23
|
+
module Bar
|
24
|
+
Class.new(Howitzer::Web::Page) do
|
25
|
+
section :navbar, :xpath, './body' do
|
26
|
+
element :like_button, '#foo_id'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
12
32
|
|
13
33
|
let(:web_page_class) do
|
14
34
|
Class.new(Howitzer::Web::Page)
|
@@ -18,6 +38,9 @@ RSpec.describe Howitzer::Web::IframeDsl do
|
|
18
38
|
allow_any_instance_of(fb_page_class).to receive(:check_validations_are_defined!)
|
19
39
|
allow_any_instance_of(web_page_class).to receive(:check_validations_are_defined!)
|
20
40
|
stub_const('FbPage', fb_page_class)
|
41
|
+
stub_const('Foo::FbPage', nested_class)
|
42
|
+
stub_const('Foo::Bar::FbHomePage', double_nested_class)
|
43
|
+
allow(Howitzer::Web::Page).to receive(:descendants) { [FbPage, Foo::FbPage, Foo::Bar::FbHomePage] }
|
21
44
|
end
|
22
45
|
|
23
46
|
describe '.iframe' do
|
@@ -56,6 +79,42 @@ RSpec.describe Howitzer::Web::IframeDsl do
|
|
56
79
|
expect { subject }.to raise_error(ArgumentError, 'iframe selector arguments must be specified')
|
57
80
|
end
|
58
81
|
end
|
82
|
+
|
83
|
+
context 'when class defined explicity' do
|
84
|
+
subject do
|
85
|
+
web_page_class.class_eval do
|
86
|
+
iframe :fb, FbPage, 1
|
87
|
+
end
|
88
|
+
web_page_class
|
89
|
+
end
|
90
|
+
it 'should find page class specified' do
|
91
|
+
expect(subject).to eql(web_page_class)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'when frame nested in module' do
|
96
|
+
subject do
|
97
|
+
web_page_class.class_eval do
|
98
|
+
iframe :foo_fb, 1
|
99
|
+
end
|
100
|
+
web_page_class
|
101
|
+
end
|
102
|
+
it 'should find page class nested in module' do
|
103
|
+
expect(subject).to eql(web_page_class)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context 'when frame nested in module nested in module' do
|
108
|
+
subject do
|
109
|
+
web_page_class.class_eval do
|
110
|
+
iframe :foo_bar_fb_home, 1
|
111
|
+
end
|
112
|
+
web_page_class
|
113
|
+
end
|
114
|
+
it 'should find class nested in modules' do
|
115
|
+
expect(subject).to eql(web_page_class)
|
116
|
+
end
|
117
|
+
end
|
59
118
|
end
|
60
119
|
|
61
120
|
include_examples :capybara_context_holder
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: howitzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Parashchenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -430,7 +430,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
430
430
|
version: '0'
|
431
431
|
requirements: []
|
432
432
|
rubyforge_project:
|
433
|
-
rubygems_version: 2.6.
|
433
|
+
rubygems_version: 2.6.8
|
434
434
|
signing_key:
|
435
435
|
specification_version: 4
|
436
436
|
summary: Ruby based framework for acceptance testing
|