effective_test_bot 1.1.18 → 1.1.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 534aa48a763f848d9407f27fe1187a1c272a740be497ef0178a2bc34535a4ecb
4
- data.tar.gz: 7c4133d51d0fc2a97536ac401c62cfdeec9fccdfff1c40d10ddd734c1563864e
3
+ metadata.gz: 7c5680e555e47bbf34f48eb0b94cde7030ea3620b89086ce240ef1ca26f2c104
4
+ data.tar.gz: 512d0f243668ccca14b34382cdf1f3f678a90a21ef35dfc5469351a7d4c76787
5
5
  SHA512:
6
- metadata.gz: ea9b3e06789011460020d1984e992295981a35a0617ba5110fb84d7b4206ae4427937a2ae7f58224d41defc578f9e2e21f6ff175ca3a8ae775a8e2a17334c02b
7
- data.tar.gz: 34e0a6fcd8aa7836191820c3951ad97d7dffdbd4b9ca6977c243289f06a241dff01c1c72b24434c8479f43aa3ac55ad71ee60707d51cdc2aaf58c1a4ac5cd5aa
6
+ metadata.gz: eb95d66b4f2f04facf6e8c077ee21457dbece6cd811270483e41172af4bab60c7129c17b46a4bea2572dbbdf4b81142d913569d4598044b098aeaad3841d4601
7
+ data.tar.gz: 2724eed26fc9907c1153aa3b0f5a74100a63c554275d968d47e7ece8c2b1b5522255a11492aac9b899e5c14232b73eb4d614bdb57a702f1155cad716932bcf4c
@@ -2,10 +2,17 @@ module EffectiveTestBot
2
2
  class Engine < ::Rails::Engine
3
3
  engine_name 'effective_test_bot'
4
4
 
5
- config.autoload_paths += Dir["#{config.root}/test/test_botable/", "#{config.root}/test/concerns/", "#{config.root}/test/support/"]
6
- # config.autoload_paths += Dir["#{config.root}/test/test_botable/**/"]
7
- # config.autoload_paths += Dir["#{config.root}/test/concerns/**/"]
8
- # config.autoload_paths += Dir["#{config.root}/test/support/**/"]
5
+ config.autoload_paths += Dir[
6
+ "#{config.root}/test/test_botable/",
7
+ "#{config.root}/test/concerns/",
8
+ "#{config.root}/test/support/"
9
+ ]
10
+
11
+ config.eager_load_paths += Dir[
12
+ "#{config.root}/test/test_botable/",
13
+ "#{config.root}/test/concerns/",
14
+ "#{config.root}/test/support/"
15
+ ]
9
16
 
10
17
  # Set up our default configuration options.
11
18
  initializer 'effective_test_bot.defaults', before: :load_config_initializers do |app|
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.1.18'.freeze
2
+ VERSION = '1.1.23'.freeze
3
3
  end
@@ -218,7 +218,15 @@ module EffectiveTestBotAssertions
218
218
  # assert_email :new_user_sign_up
219
219
  # assert_email :new_user_sign_up, to: 'newuser@example.com'
220
220
  # assert_email from: 'admin@example.com'
221
- def assert_email(action = nil, to: nil, from: nil, subject: nil, body: nil, message: nil)
221
+ def assert_email(action = nil, to: nil, from: nil, subject: nil, body: nil, message: nil, &block)
222
+ if block_given?
223
+ before = ActionMailer::Base.deliveries.length
224
+ yield
225
+ after = ActionMailer::Base.deliveries.length
226
+
227
+ assert (after - before == 1), "(assert_email) Expected one email to have been delivered"
228
+ end
229
+
222
230
  if (action || to || from || subject || body).nil?
223
231
  assert ActionMailer::Base.deliveries.present?, message || "(assert_email) Expected email to have been delivered"
224
232
  return
@@ -19,7 +19,8 @@ module EffectiveTestBotFormFiller
19
19
  active_tab = all("li.active > a[data-toggle='tab']", wait: false).first
20
20
 
21
21
  tab_content = if active_tab && active_tab['href'].present?
22
- find('div' + active_tab['href']).find(:xpath, '..')
22
+ tab_href = '#' + active_tab['href'].split('#').last
23
+ find('div' + tab_href).find(:xpath, '..')
23
24
  end
24
25
 
25
26
  excluding_fields_with_parent(tab_content) { fill_form_fields(fills) }
@@ -44,6 +44,21 @@ module EffectiveTestBotFormHelper
44
44
  true
45
45
  end
46
46
 
47
+ # Fills in the Stripe Elements form
48
+ def fill_stripe(card_number: '4242 4242 4242 4242', mm: '01')
49
+ stripe_iframe = find("iframe[src^='https://js.stripe.com/v3']")
50
+ assert stripe_iframe.present?, 'unable to find stripe iframe'
51
+
52
+ within_frame(stripe_iframe) do
53
+ card_number.to_s.chars.each { |key| find_field('Card number').send_keys(key) }
54
+ fill_in('MM / YY', with: mm.to_s + (Time.zone.now.year + 2).to_s.last(2))
55
+ fill_in('CVC', with: '123')
56
+ fill_in('ZIP', with: '90210')
57
+ end
58
+
59
+ true
60
+ end
61
+
47
62
  # submit_stripe(content: 'Thank you!'), or
48
63
  #
49
64
  # submit_stripe
@@ -24,7 +24,7 @@ module WizardTest
24
24
  # to click the last submit button on the page
25
25
  last = (paths[index-1] == page.current_path)
26
26
 
27
- fills = (defined?(:fills) && respond_to?(:fills)) ? fills : {}
27
+ fills = (defined?(:fills) && respond_to?(:fills)) ? self.fills : {}
28
28
 
29
29
  if defined?(within_form) && respond_to?(:within_form)
30
30
  within(within_form) { fill_form(fills); submit_form(last: last); }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_test_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.18
4
+ version: 1.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-03 00:00:00.000000000 Z
11
+ date: 2020-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -175,7 +175,7 @@ homepage: https://github.com/code-and-effect/effective_test_bot
175
175
  licenses:
176
176
  - MIT
177
177
  metadata: {}
178
- post_install_message:
178
+ post_install_message:
179
179
  rdoc_options: []
180
180
  require_paths:
181
181
  - lib
@@ -190,8 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []
193
- rubygems_version: 3.0.3
194
- signing_key:
193
+ rubygems_version: 3.1.2
194
+ signing_key:
195
195
  specification_version: 4
196
196
  summary: A shared library of rails model & system tests that should pass in every
197
197
  Rails application.