effective_test_bot 0.6.1 → 0.6.2

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
  SHA1:
3
- metadata.gz: 07bf0cd7c284cd899943335e6eabe61280ff4fb1
4
- data.tar.gz: 5846e0ae040d8c3d44607e1550cdcc261a472e71
3
+ metadata.gz: 348dcab0f742b0fc3c398a29924e03373b1c8899
4
+ data.tar.gz: 3f4657ab5beea8f59ea201da177df6dbc9ff2d8c
5
5
  SHA512:
6
- metadata.gz: 24fa43aec87401f7892873e4fe5deb19bc27cc82607d35b21ef11a8f5e613f324d0c094eaae8f069f5c018c9d13195a737d21d0bb3792fab2d35c7a448421020
7
- data.tar.gz: 6d19efb1e8c8ccee2286911f9624be53bb2bdec3adf3d79e0a2aa49237936d56ddb7a9464d731058db65361d955736f0ddfb520431ca4b9bbae9fa7cd4ddbc1c
6
+ metadata.gz: 8d5fb505be70bf496edeae75bb397835db2385148a5b69cc87b903ec4af64e8c54e581afcf7c96af25e46d6e95b2c8be6dec9b7a729e937c43555c0633f9d7bc
7
+ data.tar.gz: d54670db3513736069612105476f68b93c8e0a39cfcc36751a3804bb8f152dea7bdde713caa8b81e324b67b305ffa13beff64ba7622589df54b41cf5ee643649
@@ -85,7 +85,7 @@ end
85
85
 
86
86
  # "Connection not rolling back" snippets
87
87
  # These are some snippets that the internet has collected to fix test threading issues.
88
- # They are unneeded with effective_test_bot. On my machine. But I leave them here as a reference.
88
+ # They are unneeded with effective_test_bot. On my machine. But I leave them here as a reference.
89
89
  # Try one or both if you are having issues passing rake test:bot:environment
90
90
 
91
91
  # class ActiveRecord::Base
@@ -120,7 +120,7 @@ module EffectiveTestBot
120
120
  def self.save_passed_test(name)
121
121
  EffectiveTestBot.passed_tests[name] = true
122
122
 
123
- Dir.mkdir(passed_tests_path) unless File.exists?(passed_tests_path)
123
+ Dir.mkdir(passed_tests_path) unless File.exist?(passed_tests_path)
124
124
 
125
125
  File.open(passed_tests_filename, 'w') do |file|
126
126
  passed_tests.each { |test_name, _| file.puts(test_name) }
@@ -27,8 +27,8 @@ module EffectiveTestBot
27
27
  dir = File.join(Dir.pwd, 'tmp', 'test_bot')
28
28
  file = File.join(dir, 'exception.txt')
29
29
 
30
- Dir.mkdir(dir) unless File.exists?(dir)
31
- File.delete(file) if File.exists?(file)
30
+ Dir.mkdir(dir) unless File.exist?(dir)
31
+ File.delete(file) if File.exist?(file)
32
32
 
33
33
  File.open(file, 'w') do |file|
34
34
  file.write "================== Start server exception ==================\n"
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '0.6.1'.freeze
2
+ VERSION = '0.6.2'.freeze
3
3
  end
@@ -8,7 +8,7 @@ module EffectiveTestBot
8
8
  source_root File.expand_path('../../templates', __FILE__)
9
9
 
10
10
  def install_minitest
11
- return if File.exists?('test/test_helper.rb')
11
+ return if File.exist?('test/test_helper.rb')
12
12
  puts '[effective_test_bot] installing minitest'
13
13
  run 'bundle exec rails generate minitest:install'
14
14
  end
@@ -116,7 +116,7 @@ namespace :test do
116
116
  desc 'loads test/fixtures/seeds.rb'
117
117
  task :load_fixture_seeds => :environment do
118
118
  seeds = "#{Rails.root}/test/fixtures/seeds.rb"
119
- load(seeds) if File.exists?(seeds)
119
+ load(seeds) if File.exist?(seeds)
120
120
  end
121
121
 
122
122
  # This ensures rake test:prepare is run before rake test:bot or rake test:bot:environment run
@@ -125,11 +125,13 @@ namespace :test do
125
125
  Rake::TestTask.new('effective_test_bot' => 'test:prepare') do |t|
126
126
  t.libs << 'test'
127
127
  t.test_files = FileList["#{File.dirname(__FILE__)}/../../test/test_bot/integration/application_test.rb"]
128
+ t.warning = false
128
129
  end
129
130
 
130
131
  Rake::TestTask.new('effective_test_bot_environment' => 'test:prepare') do |t|
131
132
  t.libs << 'test'
132
133
  t.test_files = FileList["#{File.dirname(__FILE__)}/../../test/test_bot/integration/environment_test.rb"]
134
+ t.warning = false
133
135
  end
134
136
  end
135
137
 
@@ -94,7 +94,7 @@ module EffectiveTestBotAssertions
94
94
  def assert_no_exceptions(message = "(no_exceptions) Unexpected rails server exception:\n:exception:")
95
95
  # this file is created by EffectiveTestBot::Middleware when an exception is encountered in the rails app
96
96
  file = File.join(Dir.pwd, 'tmp', 'test_bot', 'exception.txt')
97
- return unless File.exists?(file)
97
+ return unless File.exist?(file)
98
98
 
99
99
  exception = File.read(file)
100
100
  File.delete(file)
@@ -4,10 +4,18 @@ module EffectiveTestBotMinitestHelper
4
4
  # end
5
5
 
6
6
  # This gets called after every test. Minitest hook for plugin developers
7
- def after_teardown
7
+ def before_teardown
8
+ super
9
+
8
10
  if EffectiveTestBot.screenshots? && (@test_bot_screenshot_id || 0) > 0
9
- save_test_bot_failure_gif if !passed? && EffectiveTestBot.autosave_animated_gif_on_failure?
10
- save_test_bot_tour_gif if passed? && EffectiveTestBot.tour_mode?
11
+ if !passed? && EffectiveTestBot.autosave_animated_gif_on_failure?
12
+ save_test_bot_screenshot
13
+ save_test_bot_failure_gif
14
+ end
15
+
16
+ if passed? && EffectiveTestBot.tour_mode?
17
+ save_test_bot_tour_gif
18
+ end
11
19
  end
12
20
 
13
21
  if passed? && !EffectiveTestBot.passed_tests[current_test_name]
@@ -16,7 +16,7 @@ module EffectiveTestBotScreenshotsHelper
16
16
  end
17
17
 
18
18
  def save_test_bot_failure_gif
19
- Dir.mkdir(current_test_failure_path) unless File.exists?(current_test_failure_path)
19
+ Dir.mkdir(current_test_failure_path) unless File.exist?(current_test_failure_path)
20
20
  full_path = (current_test_failure_path + '/' + current_test_failure_filename)
21
21
 
22
22
  save_test_bot_gif(full_path)
@@ -24,7 +24,7 @@ module EffectiveTestBotScreenshotsHelper
24
24
  end
25
25
 
26
26
  def save_test_bot_tour_gif
27
- Dir.mkdir(current_test_tour_path) unless File.exists?(current_test_tour_path)
27
+ Dir.mkdir(current_test_tour_path) unless File.exist?(current_test_tour_path)
28
28
  full_path = (current_test_tour_path + '/' + current_test_tour_filename)
29
29
 
30
30
  save_test_bot_gif(full_path)
@@ -48,27 +48,36 @@ module TestBot
48
48
  assert_signed_out
49
49
  end
50
50
 
51
- test '08: capybara can execute javascript' do
51
+ test '08: capybara database connection is shared' do
52
+ user = User.new(email: 'unique@testbot.com', password: '!Password123', password_confirmation: '!Password123')
53
+ user.username = 'unique-username' if user.respond_to?(:username)
54
+ user.login = 'unique-login' if user.respond_to?(:login)
55
+ user.save(validate: false)
56
+
57
+ without_screenshots { sign_in_manually(user, '!Password123') }
58
+ assert_signed_in("expected successful devise manual sign in with user created in this test.\nTry using one of the ActiveRecord shared_connection snippets in test/test_helper.rb")
59
+ end
60
+
61
+ test '09: capybara can execute javascript' do
52
62
  visit root_path
53
63
  assert_capybara_can_execute_javascript
54
64
  end
55
65
 
56
- test '09: jquery is present' do
66
+ test '10: jquery is present' do
57
67
  visit root_path
58
68
  assert_jquery_present
59
69
  end
60
70
 
61
- test '10: rails jquery_ujs is present' do
71
+ test '11: rails jquery_ujs is present' do
62
72
  visit root_path
63
73
  assert_jquery_ujs_present
64
74
  end
65
75
 
66
- test '11: action_mailer.default_url_options are present' do
76
+ test '12: action_mailer.default_url_options are present' do
67
77
  assert(
68
78
  (Rails.application.config.action_mailer.default_url_options[:host] rescue nil).present?,
69
79
  "expected action_mailer.default_url_options[:host] to be present.\nAdd config.action_mailer.default_url_options = { host: 'example.com' } to config/environments/test.rb"
70
80
  )
71
-
72
81
  end
73
82
  end
74
83
  end
@@ -10,7 +10,6 @@ module BaseTest
10
10
  assert_no_exceptions unless test_bot_skip?(:exceptions)
11
11
  assert_page_status unless test_bot_skip?(:page_status)
12
12
  assert_no_js_errors unless test_bot_skip?(:no_js_errors)
13
- assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
14
13
  assert_page_title unless (test_bot_skip?(:page_title) || all('head').blank? || was_download?)
15
14
  end
16
15
 
@@ -90,6 +90,7 @@ module CrudTest
90
90
  after = { count: resource_class.count, path: page.current_path }
91
91
 
92
92
  assert_page_normal
93
+ assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
93
94
 
94
95
  # In a rails controller, if I redirect to resources_path it may not assign the instance variable
95
96
  # Wheras if I redirect to edit_resource_path I must ensure that the instance variable is set
@@ -179,6 +180,7 @@ module CrudTest
179
180
  after = { count: resource_class.count, updated_at: (resource.updated_at rescue nil) }
180
181
 
181
182
  assert_page_normal
183
+ assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
182
184
 
183
185
  # In a rails controller, if i redirect to resources_path it may not assign the instance variable
184
186
  # Wheras if I redirect to edit_resource_path I must ensure that the instance variable is set
@@ -15,6 +15,7 @@ module DeviseTest
15
15
  end
16
16
 
17
17
  assert_page_normal
18
+ assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
18
19
 
19
20
  assert_signed_in('Expected @current_user to be present after sign up')
20
21
  assert User.where(email: email).first.present?, "Expected user to be present after submitting sign up form at #{new_user_registration_path}"
@@ -37,6 +38,7 @@ module DeviseTest
37
38
  end
38
39
 
39
40
  assert_page_normal
41
+ assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
40
42
 
41
43
  assert_signed_in
42
44
  assert_page_content(I18n.t('devise.sessions.signed_in')) unless test_bot_skip?(:page_content)
@@ -12,6 +12,8 @@ module MemberTest
12
12
  visit(path)
13
13
 
14
14
  assert_page_normal
15
+ assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
16
+
15
17
  assert_assigns(resource_name) unless (was_redirect?(path) || test_bot_skip?(:assigns))
16
18
  end
17
19
 
@@ -14,6 +14,7 @@ module PageTest
14
14
  end
15
15
 
16
16
  assert_page_normal
17
+ assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
17
18
  end
18
19
 
19
20
  end
@@ -9,6 +9,7 @@ module RedirectTest
9
9
 
10
10
  assert_redirect(from, to)
11
11
  assert_page_normal
12
+ assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
12
13
 
13
14
  #page.save_screenshot("#{from.parameterize}.png")
14
15
  end
@@ -25,7 +25,7 @@ module WizardTest
25
25
  submit_form
26
26
  end
27
27
 
28
- assert_no_assigns_errors
28
+ assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
29
29
 
30
30
  if to.present?
31
31
  # Keep going till we hit a certain to_path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_test_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect