howitzer 2.2.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -1
  3. data/LICENSE +1 -1
  4. data/README.md +16 -17
  5. data/generators/base_generator.rb +4 -6
  6. data/generators/config/config_generator.rb +2 -4
  7. data/generators/config/templates/boot.rb +1 -1
  8. data/generators/config/templates/capybara.rb +3 -5
  9. data/generators/config/templates/default.yml +19 -20
  10. data/generators/config/templates/drivers/browserstack.rb +31 -4
  11. data/generators/config/templates/drivers/crossbrowsertesting.rb +9 -11
  12. data/generators/config/templates/drivers/headless_chrome.rb +1 -1
  13. data/generators/config/templates/drivers/headless_firefox.rb +1 -1
  14. data/generators/config/templates/drivers/lambdatest.rb +30 -0
  15. data/generators/config/templates/drivers/sauce.rb +30 -2
  16. data/generators/config/templates/drivers/selenium.rb +1 -1
  17. data/generators/config/templates/drivers/selenium_grid.rb +3 -3
  18. data/generators/config/templates/drivers/testingbot.rb +29 -2
  19. data/generators/cucumber/templates/env.rb +1 -1
  20. data/generators/cucumber/templates/hooks.rb +9 -3
  21. data/generators/cucumber/templates/transformers.rb +1 -1
  22. data/generators/prerequisites/templates/factory_bot.rb +1 -1
  23. data/generators/root/templates/Gemfile.erb +4 -14
  24. data/generators/rspec/templates/spec_helper.rb +5 -5
  25. data/generators/turnip/templates/spec_helper.rb +5 -5
  26. data/generators/web/templates/example_page.rb +1 -1
  27. data/lib/howitzer/cache.rb +1 -1
  28. data/lib/howitzer/capybara_helpers.rb +46 -9
  29. data/lib/howitzer/email.rb +2 -2
  30. data/lib/howitzer/exceptions.rb +21 -21
  31. data/lib/howitzer/gmail_api/client.rb +13 -4
  32. data/lib/howitzer/log.rb +6 -6
  33. data/lib/howitzer/mail_adapters/mailgun.rb +1 -1
  34. data/lib/howitzer/mail_adapters/mailtrap.rb +3 -3
  35. data/lib/howitzer/mail_adapters/onesecmail.rb +80 -0
  36. data/lib/howitzer/mail_adapters/testmail.rb +102 -0
  37. data/lib/howitzer/mailgun_api/client.rb +3 -2
  38. data/lib/howitzer/mailgun_api/response.rb +1 -2
  39. data/lib/howitzer/mailtrap_api/client.rb +19 -1
  40. data/lib/howitzer/meta/actions.rb +13 -16
  41. data/lib/howitzer/meta/element.rb +12 -10
  42. data/lib/howitzer/onesecmail_api/client.rb +44 -0
  43. data/lib/howitzer/onesecmail_api.rb +7 -0
  44. data/lib/howitzer/testmail_api/client.rb +44 -0
  45. data/lib/howitzer/testmail_api.rb +7 -0
  46. data/lib/howitzer/utils/string_extensions.rb +6 -2
  47. data/lib/howitzer/version.rb +1 -1
  48. data/lib/howitzer/web/base_section.rb +1 -1
  49. data/lib/howitzer/web/capybara_methods_proxy.rb +11 -5
  50. data/lib/howitzer/web/element_dsl.rb +104 -45
  51. data/lib/howitzer/web/iframe_dsl.rb +2 -2
  52. data/lib/howitzer/web/page.rb +4 -14
  53. data/lib/howitzer/web/page_dsl.rb +15 -6
  54. data/lib/howitzer/web/page_validator.rb +25 -26
  55. data/lib/howitzer/web/section.rb +5 -2
  56. data/lib/howitzer/web/section_dsl.rb +64 -30
  57. data/lib/howitzer.rb +2 -2
  58. metadata +29 -165
  59. data/.coveralls.yml +0 -1
  60. data/.gitignore +0 -14
  61. data/.rspec +0 -3
  62. data/.rubocop.yml +0 -60
  63. data/.ruby-gemset +0 -1
  64. data/.travis.yml +0 -8
  65. data/Gemfile +0 -14
  66. data/ISSUE_TEMPLATE.md +0 -16
  67. data/MAINTENANCE.md +0 -32
  68. data/Rakefile +0 -38
  69. data/features/cli_help.feature +0 -31
  70. data/features/cli_new.feature +0 -393
  71. data/features/cli_unknown.feature +0 -17
  72. data/features/cli_update.feature +0 -223
  73. data/features/cli_version.feature +0 -14
  74. data/features/step_definitions/common_steps.rb +0 -34
  75. data/features/support/env.rb +0 -1
  76. data/generators/config/templates/drivers/appium.rb +0 -25
  77. data/generators/config/templates/drivers/poltergeist.rb +0 -11
  78. data/generators/config/templates/drivers/webkit.rb +0 -6
  79. data/generators/root/templates/.gitignore +0 -21
  80. data/generators/root/templates/.rubocop.yml.erb +0 -56
  81. data/generators/turnip/templates/.rspec +0 -1
  82. data/howitzer.gemspec +0 -39
  83. data/lib/howitzer/mail_adapters/debugmail.rb +0 -0
  84. data/spec/config/custom.yml +0 -9
  85. data/spec/spec_helper.rb +0 -73
  86. data/spec/support/generator_helper.rb +0 -21
  87. data/spec/support/logger_helper.rb +0 -13
  88. data/spec/support/shared_examples/capybara_context_holder.rb +0 -33
  89. data/spec/support/shared_examples/capybara_methods_proxy.rb +0 -94
  90. data/spec/support/shared_examples/dynamic_section_methods.rb +0 -35
  91. data/spec/support/shared_examples/element_dsl.rb +0 -242
  92. data/spec/support/shared_examples/meta_highlight_xpath.rb +0 -41
  93. data/spec/unit/generators/base_generator_spec.rb +0 -283
  94. data/spec/unit/generators/config_generator_spec.rb +0 -61
  95. data/spec/unit/generators/cucumber_generator_spec.rb +0 -62
  96. data/spec/unit/generators/emails_generator_spec.rb +0 -35
  97. data/spec/unit/generators/prerequisites_generator_spec.rb +0 -53
  98. data/spec/unit/generators/root_generator_spec.rb +0 -86
  99. data/spec/unit/generators/rspec_generator_spec.rb +0 -36
  100. data/spec/unit/generators/tasks_generator_spec.rb +0 -31
  101. data/spec/unit/generators/templates/cucumber_spec.rb +0 -97
  102. data/spec/unit/generators/templates/rspec_spec.rb +0 -88
  103. data/spec/unit/generators/templates/turnip_spec.rb +0 -98
  104. data/spec/unit/generators/turnip_generator_spec.rb +0 -52
  105. data/spec/unit/generators/web_generator_spec.rb +0 -52
  106. data/spec/unit/lib/cache_spec.rb +0 -85
  107. data/spec/unit/lib/capybara_helpers_spec.rb +0 -730
  108. data/spec/unit/lib/email_spec.rb +0 -186
  109. data/spec/unit/lib/gmail_api/client_spec.rb +0 -26
  110. data/spec/unit/lib/howitzer_spec.rb +0 -92
  111. data/spec/unit/lib/init_spec.rb +0 -2
  112. data/spec/unit/lib/log_spec.rb +0 -122
  113. data/spec/unit/lib/mail_adapters/abstract_spec.rb +0 -62
  114. data/spec/unit/lib/mail_adapters/gmail_spec.rb +0 -128
  115. data/spec/unit/lib/mail_adapters/mailgun_spec.rb +0 -158
  116. data/spec/unit/lib/mail_adapters/mailtrap_spec.rb +0 -130
  117. data/spec/unit/lib/mailgun_api/client_spec.rb +0 -80
  118. data/spec/unit/lib/mailgun_api/connector_spec.rb +0 -54
  119. data/spec/unit/lib/mailgun_api/response_spec.rb +0 -28
  120. data/spec/unit/lib/mailtrap_api/client_spec.rb +0 -67
  121. data/spec/unit/lib/meta/element_spec.rb +0 -59
  122. data/spec/unit/lib/meta/entry_spec.rb +0 -77
  123. data/spec/unit/lib/meta/iframe_spec.rb +0 -66
  124. data/spec/unit/lib/meta/section_spec.rb +0 -43
  125. data/spec/unit/lib/utils/string_extensions_spec.rb +0 -77
  126. data/spec/unit/lib/web/base_section_spec.rb +0 -43
  127. data/spec/unit/lib/web/element_dsl_spec.rb +0 -31
  128. data/spec/unit/lib/web/iframe_dsl_spec.rb +0 -203
  129. data/spec/unit/lib/web/page_dsl_spec.rb +0 -74
  130. data/spec/unit/lib/web/page_spec.rb +0 -385
  131. data/spec/unit/lib/web/page_validator_spec.rb +0 -276
  132. data/spec/unit/lib/web/section_dsl_spec.rb +0 -165
  133. data/spec/unit/lib/web/section_spec.rb +0 -70
  134. data/spec/unit/version_spec.rb +0 -8
@@ -1,94 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.shared_examples :capybara_methods_proxy do
4
- let(:session) { double(:session) }
5
- before do
6
- allow(Capybara).to receive(:current_session) { session }
7
- allow(Howitzer).to receive(:driver) { driver_name }
8
- allow(session).to receive(:current_url) { 'google.com' }
9
- end
10
-
11
- describe '#driver' do
12
- it 'should proxy #driver method' do
13
- expect(session).to receive(:driver).once
14
- reciever.driver
15
- end
16
- end
17
-
18
- describe '#text' do
19
- it 'should proxy #text method' do
20
- expect(session).to receive(:text).once
21
- reciever.text
22
- end
23
- end
24
-
25
- context 'when capybara session method' do
26
- it 'should proxy method' do
27
- expect(session).to receive(:visit).once
28
- reciever.visit
29
- end
30
- end
31
-
32
- context 'when capybara modal method' do
33
- it 'should proxy method' do
34
- expect(session).to receive(:dismiss_prompt).with(:some_text).once
35
- reciever.dismiss_prompt(:some_text)
36
- end
37
- end
38
-
39
- describe '#click_alert_box' do
40
- subject { reciever.click_alert_box(flag_value) }
41
- context 'when flag true and correct driver specified' do
42
- let(:flag_value) { true }
43
- let(:page) { double }
44
- let(:alert) { double }
45
- let(:driver) { double }
46
- let(:browser) { double }
47
- let(:switch_to) { double }
48
- let(:driver_name) { 'selenium' }
49
- it do
50
- expect(session).to receive(:driver).ordered.and_return(driver)
51
- expect(driver).to receive(:browser).ordered.and_return(browser)
52
- expect(browser).to receive(:switch_to).ordered.and_return(switch_to)
53
- expect(switch_to).to receive(:alert).ordered.and_return(alert)
54
- expect(alert).to receive(:accept).once
55
- subject
56
- end
57
- end
58
- context 'when flag false and correct driver specified' do
59
- let(:flag_value) { false }
60
- let(:page) { double }
61
- let(:alert) { double }
62
- let(:driver) { double }
63
- let(:browser) { double }
64
- let(:switch_to) { double }
65
- let(:driver_name) { 'selenium' }
66
- it do
67
- expect(session).to receive(:driver).ordered.and_return(driver)
68
- expect(driver).to receive(:browser).ordered.and_return(browser)
69
- expect(browser).to receive(:switch_to).ordered.and_return(switch_to)
70
- expect(switch_to).to receive(:alert).ordered.and_return(alert)
71
- expect(alert).to receive(:dismiss).once
72
- subject
73
- end
74
- end
75
- context 'when flag true and wrong driver specified' do
76
- let(:flag_value) { true }
77
- let(:page) { double }
78
- let(:driver_name) { 'ff' }
79
- it do
80
- expect(session).to receive(:evaluate_script).with('window.confirm = function() { return true; }')
81
- subject
82
- end
83
- end
84
- context 'when flag false and wrong driver specified' do
85
- let(:driver_name) { 'ff' }
86
- let(:flag_value) { false }
87
- let(:page) { double }
88
- it do
89
- expect(session).to receive(:evaluate_script).with('window.confirm = function() { return false; }')
90
- subject
91
- end
92
- end
93
- end
94
- end
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
- RSpec.shared_examples :dynamic_section_methods do
3
- let(:web_page_object) { web_page_class.new }
4
-
5
- describe '#name_section' do
6
- let(:capybara_element) { double }
7
- subject { web_page_object.send("#{section_name}_section") }
8
- before { expect(session).to receive(:find).with(*finder_args).once.and_return(capybara_element) }
9
- it { is_expected.to be_a(section_class) }
10
- end
11
- describe '#name_sections' do
12
- subject { web_page_object.send("#{section_name}_sections") }
13
- let(:capybara_element1) { double }
14
- let(:capybara_element2) { double }
15
- before do
16
- expect(session).to receive(:all).with(*finder_args).once.and_return([capybara_element1, capybara_element2])
17
- end
18
- it 'should return collection of sections' do
19
- res = subject
20
- expect(res.size).to eq(2)
21
- expect(res.first).to be_a(section_class)
22
- expect(res.last).to be_a(section_class)
23
- end
24
- end
25
- describe '#has_name_section?' do
26
- subject { web_page_object.send("has_#{section_name}_section?") }
27
- before { expect(session).to receive(:has_selector?).with(*finder_args).once.and_return(true) }
28
- it { is_expected.to eq(true) }
29
- end
30
- describe '#has_no_name_element?' do
31
- subject { web_page_object.send("has_no_#{section_name}_section?") }
32
- before { expect(session).to receive(:has_no_selector?).with(*finder_args).once.and_return(true) }
33
- it { is_expected.to eq(true) }
34
- end
35
- end
@@ -1,242 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.shared_examples :element_dsl do
4
- describe '.element' do
5
- context 'when regular capybara params' do
6
- before do
7
- klass.class_eval do
8
- element :foo, :xpath, '//a'
9
- end
10
- end
11
- it 'should create private :foo_element instance method' do
12
- expect(klass_object.private_methods(false)).to include(:foo_element)
13
- end
14
- it 'should create private :foo_elements instance method' do
15
- expect(klass_object.private_methods(false)).to include(:foo_elements)
16
- end
17
- it 'should create private :wait_for_foo_element instance method' do
18
- expect(klass_object.private_methods(false)).to include(:wait_for_foo_element)
19
- end
20
- it 'should create public :has_foo_element? instance method' do
21
- expect(klass_object.public_methods(false)).to include(:has_foo_element?)
22
- end
23
- it 'should create public :has_no_foo_element? instance method' do
24
- expect(klass_object.public_methods(false)).to include(:has_no_foo_element?)
25
- end
26
- it 'should be protected class method' do
27
- expect { klass.element :bar }.to raise_error(NoMethodError)
28
- expect(klass.protected_methods(true)).to include(:element)
29
- end
30
- end
31
- context 'when 1 param is proc' do
32
- before do
33
- klass.class_eval do
34
- element :foo, :xpath, ->(title) { "//a[.='#{title}']" }
35
- end
36
- end
37
- it 'should create private :foo_element instance method' do
38
- expect(klass_object.private_methods(false)).to include(:foo_element)
39
- end
40
- it 'should create private :foo_elements instance method' do
41
- expect(klass_object.private_methods(false)).to include(:foo_elements)
42
- end
43
- it 'should create private :wait_for_foo_element instance method' do
44
- expect(klass_object.private_methods(false)).to include(:wait_for_foo_element)
45
- end
46
- it 'should create public :has_foo_element? instance method' do
47
- expect(klass_object.public_methods(false)).to include(:has_foo_element?)
48
- end
49
- it 'should create public :has_no_foo_element? instance method' do
50
- expect(klass_object.public_methods(false)).to include(:has_no_foo_element?)
51
- end
52
- it 'should be protected class method' do
53
- expect { klass.element :bar }.to raise_error(NoMethodError)
54
- expect(klass.protected_methods(true)).to include(:element)
55
- end
56
- end
57
- context 'when 2 params are proc' do
58
- subject do
59
- klass.class_eval do
60
- element :foo, -> { puts 1 }, ->(title) { "//a[.='#{title}']" }
61
- end
62
- end
63
- it 'should generate error' do
64
- expect { subject.element :bar }.to raise_error(
65
- Howitzer::BadElementParamsError,
66
- 'Using more than 1 proc in arguments is forbidden'
67
- )
68
- end
69
- end
70
- end
71
-
72
- describe 'dynamic_methods' do
73
- let(:web_page_object) { web_page_class.new }
74
- let(:kontext) { double(:kontext) }
75
- before do
76
- allow(Capybara).to receive(:current_session) { kontext }
77
- klass.class_eval do
78
- element :foo, :xpath,
79
- ->(title, name) { "//a[.='#{title}']/*[@name='#{name}']" }, text: 'original', match: :first
80
- element :bar, '.someclass', text: 'origin', match: :first
81
- element :top_panel, '.top', text: 'origin', match: :first
82
- end
83
- end
84
-
85
- describe '#name_element' do
86
- context 'when simple selector' do
87
- subject { klass_object.send(:bar_element, text: 'new', wait: 10) }
88
- after { subject }
89
- it do
90
- expect(klass_object.capybara_context).to receive(:find)
91
- .with('.someclass', wait: 10, text: 'new', match: :first)
92
- end
93
- end
94
- context 'when lambda selector' do
95
- subject { klass_object.send(:foo_element, 'Hello', 'super', text: 'new', wait: 10) }
96
- after { subject }
97
- it do
98
- expect(klass_object.capybara_context).to receive(:find)
99
- .with(:xpath, "//a[.='Hello']/*[@name='super']", wait: 10, text: 'new', match: :first)
100
- end
101
-
102
- context 'when several execution with different data' do
103
- it 'does not cache previous data' do
104
- expect(klass_object.capybara_context).to receive(:find)
105
- .with(:xpath, "//a[.='Hello']/*[@name='super']", wait: 10, text: 'new', match: :first).at_least(:once)
106
- klass_object.send(:foo_element, 'Hello', 'super', text: 'new', wait: 10)
107
-
108
- expect(klass_object.capybara_context).to receive(:find)
109
- .with(:xpath, "//a[.='Bye']/*[@name='puper']", wait: 15, text: 'new', match: :first).at_least(:once)
110
- klass_object.send(:foo_element, 'Bye', 'puper', text: 'new', wait: 15)
111
- end
112
- end
113
- end
114
- end
115
- describe '#name_elements' do
116
- after { subject }
117
- context 'when simple selector' do
118
- subject { klass_object.send(:bar_elements, text: 'new', wait: 10) }
119
- it do
120
- expect(klass_object.capybara_context).to receive(:all)
121
- .with('.someclass', wait: 10, text: 'new', match: :first)
122
- end
123
- end
124
- context 'when lambda selector' do
125
- subject { klass_object.send(:foo_elements, 'Hello', 'super', text: 'new', wait: 10) }
126
- it do
127
- expect(
128
- klass_object.capybara_context
129
- ).to receive(:all).with(:xpath, "//a[.='Hello']/*[@name='super']", wait: 10, text: 'new', match: :first)
130
- end
131
- end
132
- end
133
- describe '#wait_for_name_element' do
134
- context 'when simple selector' do
135
- subject { klass_object.send(:wait_for_bar_element, text: 'new', wait: 10) }
136
- it do
137
- expect(klass_object.capybara_context).to receive(:find)
138
- .with('.someclass', wait: 10, text: 'new', match: :first)
139
- is_expected.to eq(nil)
140
- end
141
- end
142
- context 'when lambda selector' do
143
- subject { klass_object.send(:wait_for_foo_element, 'Hello', 'super', text: 'new', wait: 10) }
144
- it do
145
- expect(
146
- klass_object.capybara_context
147
- ).to receive(:find).with(:xpath, "//a[.='Hello']/*[@name='super']", wait: 10, text: 'new', match: :first)
148
- is_expected.to eq(nil)
149
- end
150
- end
151
- end
152
- describe '#within_name_element' do
153
- let(:within_scope) { double }
154
- after { subject }
155
- context 'not nested' do
156
- context 'when simple selector' do
157
- subject do
158
- klass_object.instance_eval do
159
- within_bar_element(wait: 5, text: 'new') do
160
- foo_element('Hello', 'super', wait: 10, text: 'new')
161
- end
162
- end
163
- end
164
- it do
165
- expect(klass_object.capybara_context).to receive(:find)
166
- .with('.someclass', wait: 5, text: 'new', match: :first) { within_scope }
167
- expect(within_scope).to receive(:find)
168
- .with(:xpath, "//a[.='Hello']/*[@name='super']", wait: 10, text: 'new', match: :first)
169
- end
170
- end
171
- context 'when lambda selector' do
172
- subject do
173
- klass_object.instance_eval do
174
- within_foo_element('Hello', 'super', wait: 10, text: 'new') do
175
- bar_element(wait: 10, text: 'new')
176
- end
177
- end
178
- end
179
- it do
180
- expect(klass_object.capybara_context).to receive(:find)
181
- .with(:xpath, "//a[.='Hello']/*[@name='super']", wait: 10, text: 'new', match: :first) { within_scope }
182
- expect(within_scope).to receive(:find).with('.someclass', wait: 10, text: 'new', match: :first)
183
- end
184
- end
185
- end
186
- context 'nested' do
187
- let(:nested_within_scope) { double }
188
- subject do
189
- klass_object.instance_eval do
190
- within_top_panel_element(wait: 10, text: 'new') do
191
- within_bar_element(wait: 10, text: 'new') do
192
- foo_element('Hello', 'super', wait: 10, text: 'new')
193
- end
194
- end
195
- end
196
- end
197
- it do
198
- expect(klass_object.capybara_context).to receive(:find)
199
- .with('.top', wait: 10, text: 'new', match: :first) { within_scope }
200
- expect(within_scope).to receive(:find)
201
- .with('.someclass', wait: 10, text: 'new', match: :first) { nested_within_scope }
202
- expect(nested_within_scope).to receive(:find)
203
- .with(:xpath, "//a[.='Hello']/*[@name='super']", wait: 10, text: 'new', match: :first)
204
- end
205
- end
206
- end
207
- describe '#has_name_element?' do
208
- after { subject }
209
- context 'when simple selector' do
210
- subject { klass_object.send(:has_bar_element?, wait: 10, text: 'new') }
211
- it do
212
- expect(klass_object.capybara_context).to receive(:has_selector?)
213
- .with('.someclass', wait: 10, text: 'new', match: :first)
214
- end
215
- end
216
- context 'when lambda selector' do
217
- subject { klass_object.send(:has_foo_element?, 'Hello', 'super', wait: 10, text: 'new') }
218
- it do
219
- expect(klass_object.capybara_context).to receive(:has_selector?)
220
- .with(:xpath, "//a[.='Hello']/*[@name='super']", wait: 10, text: 'new', match: :first)
221
- end
222
- end
223
- end
224
- describe '#has_no_name_element?' do
225
- after { subject }
226
- context 'when simple selector' do
227
- subject { klass_object.send(:has_no_bar_element?, wait: 10, text: 'new') }
228
- it do
229
- expect(klass_object.capybara_context).to receive(:has_no_selector?)
230
- .with('.someclass', wait: 10, text: 'new', match: :first)
231
- end
232
- end
233
- context 'when lambda selector' do
234
- subject { klass_object.send(:has_no_foo_element?, 'Hello', 'super', wait: 10, text: 'new', match: :first) }
235
- it do
236
- expect(klass_object.capybara_context).to receive(:has_no_selector?)
237
- .with(:xpath, "//a[.='Hello']/*[@name='super']", wait: 10, text: 'new', match: :first)
238
- end
239
- end
240
- end
241
- end
242
- end
@@ -1,41 +0,0 @@
1
- RSpec.shared_examples :meta_highlight_xpath do
2
- let(:element) { described_class.new(name, context) }
3
- describe '#xpath' do
4
- let(:capybara_element) { double }
5
- context 'when element is found' do
6
- before { allow(element).to receive(:capybara_element) { capybara_element } }
7
- it do
8
- expect(capybara_element).to receive(:path)
9
- element.xpath
10
- end
11
- end
12
- context 'when element is blank' do
13
- before { allow(element).to receive(:capybara_element) {} }
14
- it do
15
- expect(capybara_element).not_to receive(:path)
16
- element.xpath
17
- end
18
- end
19
- end
20
-
21
- describe '#highlight' do
22
- context 'when xpath blank' do
23
- before { allow(element).to receive(:xpath) { nil } }
24
- it do
25
- expect(Howitzer::Log).to receive(:debug).with("Element #{name} not found on the page")
26
- expect(context).not_to receive(:execute_script)
27
- element.highlight
28
- end
29
- end
30
- context 'when xpath is present' do
31
- before { allow(element).to receive(:xpath) { '//a' } }
32
- it do
33
- expect(context).to receive(:execute_script).with(
34
- "document.evaluate('//a', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,"\
35
- ' null).singleNodeValue.style.border = "thick solid red"'
36
- )
37
- element.highlight
38
- end
39
- end
40
- end
41
- end