effective_test_bot 0.6.8 → 0.6.9

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: addba6a7997e4a369e13125bc2a58ee7daef0e60
4
- data.tar.gz: 29f2ed1a40d36625bfb8a010e1a5653abece76f4
3
+ metadata.gz: 241328a26eabe88003d9952df8c3f52d2c8da2b9
4
+ data.tar.gz: d9aaf690438a97cf0469381f8c17766270e7df80
5
5
  SHA512:
6
- metadata.gz: ad4ffb7d07438ce61c84212f199c0539ca027d66f1ffc4a4176e07cbe0276b5b4038b8bdf2befcccd088d551b3d0520a4e9d2afa6039136ed647c4527770426a
7
- data.tar.gz: b40772c6a5989f299db717109fa0fe35b402ba7f38dbbcc56bef3c299a6f0f107d14ab0dee887042b7b2324d514592ba6e32cc1f5311a250b7b6930ee9a25d17
6
+ metadata.gz: 04eef468622acf70afdc3c6bb2245bf2d4a442db8990a4455b09bff42e7c363a297e7962aaea61de578b634cff444c340a5e05d289a3f5af032144211fe1028a
7
+ data.tar.gz: c8dbdd69aa54b95509900019e7d01d28fd830a74202363a17d00a09237f3c2d29f027a357b31200c8b5aebc17bc632ecb878d2d43bc5047a445baa9d7c24e7fc
data/README.md CHANGED
@@ -8,13 +8,13 @@ Adds many additional assertions and quality of life helper functions.
8
8
 
9
9
  Provides a curated set of minitest and capybara focused rails testing gems and a well configured `test_helper.rb` file.
10
10
 
11
- Run `rake test:bot:environment` to validate your testing environment. Ensures that all fixtures and seeds are properly initialized. Makes sure database transactions and web sessions correctly reset between tests.
11
+ Run `rails test:bot:environment` to validate your testing environment. Ensures that all fixtures and seeds are properly initialized. Makes sure database transactions and web sessions correctly reset between tests.
12
12
 
13
13
  Adds many class and instance level 1-liners to run entire test suites and check many assertions all at once.
14
14
 
15
15
  Autosaves an animated .gif for any failing test.
16
16
 
17
- Run `rake test:bot` to automatically check every route in your application against an appropriate test suite, without writing any code. Clicks through every page, intelligently fills forms with appropriate pseudo-random input and checks for all kinds of errors and omissions.
17
+ Run `rails test:bot` to automatically check every route in your application against an appropriate test suite, without writing any code. Clicks through every page, intelligently fills forms with appropriate pseudo-random input and checks for all kinds of errors and omissions.
18
18
 
19
19
  Turn on tour mode to programatically generate an animated .gif of every workflow in your website.
20
20
 
@@ -60,7 +60,7 @@ The generator will run `minitest:install` if not already present and create an i
60
60
 
61
61
  Fixture or seed one user. At least one user -- ideally a fully priviledged admin type user -- must be created.
62
62
 
63
- (there are future plans to make this better. Right now `rake test:bot` just runs everything as one user. There really isn't support for 'this user should not be able to' yet.)
63
+ (there are future plans to make this better. Right now `rails test:bot` just runs everything as one user. There really isn't support for 'this user should not be able to' yet.)
64
64
 
65
65
  To create the initial user, please add it to either `test/fixtures/users.yml`, the `db/seeds.db` file or the effective_test_bot specific `test/fixtures/seeds.rb` file.
66
66
 
@@ -68,13 +68,13 @@ As per the included `test/test_helper.rb`, the following tasks run when minitest
68
68
 
69
69
  ```
70
70
  # Rails default task, load fixtures from test/fixtures/*.yml (including users.yml if it exists)
71
- rake db:fixtures:load
71
+ rails db:fixtures:load
72
72
 
73
73
  # Rails default task, loads db/seeds.rb
74
- rake db:seed
74
+ rails db:seed
75
75
 
76
76
  # Added by effective_test_bot. loads test/fixtures/seeds.rb. 'cause screw yaml.
77
- rake test:load_fixture_seeds
77
+ rails test:load_fixture_seeds
78
78
  ```
79
79
 
80
80
  Your initial user may be created by any of the above 3 tasks.
@@ -82,7 +82,7 @@ Your initial user may be created by any of the above 3 tasks.
82
82
  Finally, to test that your testing environment is set up correctly run and work through any issues with:
83
83
 
84
84
  ```
85
- rake test:bot:environment
85
+ rails test:bot:environment
86
86
  ```
87
87
 
88
88
  You now have effective_test_bot configured and you're ready to go.
@@ -97,7 +97,7 @@ Effective TestBot provides 4 areas of support in writing [minitest](https://gith
97
97
 
98
98
  3.) Produce animated .gifs of test runs. Enable autosave_animated_gif_on_failure to help debug a tricky test, or run in tour mode and record walkthroughs of features.
99
99
 
100
- 4.) Apply full stack automated testing. Just run `rake test:bot` to scan every route in your application and without writing any code check every controller action with an appropriate test suite.
100
+ 4.) Apply full stack automated testing. Just run `rails test:bot` to scan every route in your application and without writing any code check every controller action with an appropriate test suite.
101
101
 
102
102
  ## Minitest Assertions
103
103
 
@@ -486,7 +486,7 @@ User sessions need to properly reset and database transactions must be correctly
486
486
 
487
487
  Included with this gem is the `rails generate effective_test_bot:install` that does its best to provide a known-good set of configuration files that initialize all required testing gems. However, every developer's machine is different, and there are just too many points of failure. Everyone's `test/test_helper.rb` will be slightly different.
488
488
 
489
- Run `rake test:bot:environment` to check that capybara is doing the right thing, everything is reset properly between test runs, an initial user record exists, all seeded and fixtured data is valid, devise works and rails' jquery-ujs is present.
489
+ Run `rails test:bot:environment` to check that capybara is doing the right thing, everything is reset properly between test runs, an initial user record exists, all seeded and fixtured data is valid, devise works and rails' jquery-ujs is present.
490
490
 
491
491
  If all environment tests pass, you will have a great experience with automated testing.
492
492
 
@@ -494,7 +494,7 @@ If all environment tests pass, you will have a great experience with automated t
494
494
 
495
495
  One of the main goals of `effective_test_bot` is to increase the speed at which tests can be written in any ruby on rails application. Well, there's no faster way of writing tests than by not writing them at all.
496
496
 
497
- Run `rake test:bot` to scan every route defined in `routes.rb` and run an appropriate test suite.
497
+ Run `rails test:bot` to scan every route defined in `routes.rb` and run an appropriate test suite.
498
498
 
499
499
  You can configure test bot to skip individual tests or assertions, tweak screenshot behaviour and toggle tour mode via the `config/initializers/effective_test_bot.rb` file. As well, there are a few command line options available.
500
500
 
@@ -502,13 +502,13 @@ These are some quick ways to customize test bot's behaviour:
502
502
 
503
503
  ```
504
504
  # Scan every route in the application as per config/initializers/effective_test_bot.rb
505
- rake test:bot
505
+ rails test:bot
506
506
 
507
507
  # Test a specific controller (any routes matching posts)
508
- rake test:bot TEST=posts
508
+ rails test:bot TEST=posts
509
509
 
510
510
  # Test a specific controller and action
511
- rake test:bot TEST=posts#index
511
+ rails test:bot TEST=posts#index
512
512
  ```
513
513
 
514
514
  ## Animated gifs and screenshots
@@ -535,44 +535,44 @@ You can run test bot in tour mode by setting `config.tour_mode = true` in the `c
535
535
 
536
536
  ```
537
537
  # Run test:bot in tour mode, saving an animated .gif for all successful tests
538
- rake test:bot:tour
539
- rake test:bot TOUR=true
538
+ rails test:bot:tour
539
+ rails test:bot TOUR=true
540
540
 
541
541
  # Also prints the animated .gif file path to stdout
542
- rake test:bot:tourv
543
- rake test:bot TOUR=verbose
542
+ rails test:bot:tourv
543
+ rails test:bot TOUR=verbose
544
544
 
545
545
  # Makes a whole bunch of extra screenshots when filling out forms
546
- rake test:bot TOUR=extreme
546
+ rails test:bot TOUR=extreme
547
547
 
548
548
  # Runs in tour mode and tests only a specific controller or action
549
- rake test:bot:tour TEST=posts
550
- rake test:bot:tour TEST=posts#index
549
+ rails test:bot:tour TEST=posts
550
+ rails test:bot:tour TEST=posts#index
551
551
  ```
552
552
 
553
553
  To print out the file location of all tour files, run the following:
554
554
 
555
555
  ```
556
556
  # Prints out all animated .gif file locations
557
- rake test:bot:tours
557
+ rails test:bot:tours
558
558
 
559
559
  # Prints out any animated .gif files locations with a file name matching posts
560
- rake test:bot:tours TEST=posts
560
+ rails test:bot:tours TEST=posts
561
561
  ```
562
562
 
563
563
  To delete all tour and autosave on failure animated .gifs, run the following:
564
564
 
565
565
  ```
566
566
  # Deletes all tour and failure animated .gifs
567
- rake test:bot:purge
567
+ rails test:bot:purge
568
568
  ```
569
569
 
570
- As well, to enable tour mode when running the standard `rake test`:
570
+ As well, to enable tour mode when running the standard `rails test`:
571
571
 
572
572
  ```
573
573
  # Runs all regular minitest tests with tour mode enabled
574
- rake test:tour
575
- rake test:tourv
574
+ rails test:tour
575
+ rails test:tourv
576
576
  ```
577
577
 
578
578
  ### Fail fast
@@ -582,7 +582,7 @@ Set `config.fail_fast = true` to exit immediately if there is a test failure.
582
582
  Or, override the config setting by running the following:
583
583
 
584
584
  ```
585
- rake test:bot FAILFAST=true
585
+ rails test:bot FAILFAST=true
586
586
  ```
587
587
 
588
588
  This functionality is provided thanks to [minitest-fail-fast](https://github.com/teoljungberg/minitest-fail-fast/)
@@ -592,13 +592,13 @@ This functionality is provided thanks to [minitest-fail-fast](https://github.com
592
592
  Skip any previously passed tests by running the following:
593
593
 
594
594
  ```
595
- rake test:bot:fails
595
+ rails test:bot:fails
596
596
  ```
597
597
 
598
598
  or
599
599
 
600
600
  ```
601
- rake test:bot FAILS=true
601
+ rails test:bot FAILS=true
602
602
  ```
603
603
 
604
604
  ## License
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '0.6.8'.freeze
2
+ VERSION = '0.6.9'.freeze
3
3
  end
@@ -24,8 +24,8 @@ module EffectiveTestBot
24
24
  def thank_you
25
25
  puts "Thanks for using EffectiveTestBot"
26
26
  puts "Make sure you create a user in your db/seeds.rb, test/fixtures/users.yml, or test/fixtures/seeds.rb"
27
- puts "Run `rake test:bot:environment` once to ensure the testing environment is correctly configured"
28
- puts "Test your app with 'rake test:bot'"
27
+ puts "Run `rails test:bot:environment` once to ensure the testing environment is correctly configured"
28
+ puts "Test your app with 'rails test:bot'"
29
29
  end
30
30
  end
31
31
  end
@@ -69,32 +69,32 @@ module EffectiveTestBotFormFiller
69
69
  next if skip_form_field?(field)
70
70
  skip_field_screenshot = false
71
71
 
72
+ value = value_for_field(field, fills)
73
+
72
74
  case [field.tag_name, field['type']].compact.join('_')
73
75
  when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_checkbox', 'input_radio', 'input_url', 'input_color'
74
- field.set(value_for_field(field, fills))
75
-
76
+ field.set(value)
76
77
  close_effective_date_time_picker(field) if field['class'].to_s.include?('effective_date')
77
78
  when 'textarea'
78
- value = value_for_field(field, fills)
79
79
  ckeditor_text_area?(field) ? fill_ckeditor_text_area(field, value) : field.set(value)
80
80
  when 'select'
81
- value = value_for_field(field, fills)
82
-
83
81
  if EffectiveTestBot.tour_mode_extreme? && field['class'].to_s.include?('select2') # select2
84
82
  page.execute_script("try { $('select##{field['id']}').select2('open'); } catch(e) {};")
85
83
  save_test_bot_screenshot
86
84
  end
87
85
 
88
- field.select(value, match: :first) unless value == :unselect
86
+ if field.all('option:enabled').length > 0 && value != :unselect
87
+ field.select(value, match: :first, disabled: false)
88
+ end
89
89
 
90
90
  if EffectiveTestBot.tour_mode_extreme? && field['class'].to_s.include?('select2')
91
91
  page.execute_script("try { $('select##{field['id']}').select2('close'); } catch(e) {};")
92
92
  end
93
93
  when 'input_file'
94
94
  if field['class'].to_s.include?('asset-box-uploader-fileinput')
95
- upload_effective_asset(field, value_for_field(field, fills))
95
+ upload_effective_asset(field, value)
96
96
  else
97
- field.set(value_for_field(field, fills))
97
+ field.set(value)
98
98
  end
99
99
  when 'input_submit', 'input_search', 'input_button'
100
100
  skip_field_screenshot = true
@@ -250,6 +250,9 @@ module EffectiveTestBotFormFiller
250
250
  when 'textarea'
251
251
  Faker::Lorem.paragraph
252
252
 
253
+ when 'input_submit', 'input_search', 'input_button'
254
+ nil
255
+
253
256
  else
254
257
  raise "fill_value unsupported field type: #{field['type']}"
255
258
  end
@@ -425,8 +428,13 @@ module EffectiveTestBotFormFiller
425
428
  def skip_form_field?(field)
426
429
  field.reload # Handle a field changing visibility/disabled state from previous form field manipulations
427
430
 
428
- (field.visible? == false && !ckeditor_text_area?(field)) ||
431
+ field_id = field['id'].to_s
432
+
433
+ field_id.start_with?('datatable_') ||
434
+ field_id.start_with?('filters_scope_') ||
435
+ field_id.start_with?('filters_') && field['name'].blank? ||
429
436
  field.disabled? ||
437
+ (!field.visible? && !ckeditor_text_area?(field)) ||
430
438
  ['true', true, 1].include?(field['data-test-bot-skip']) ||
431
439
  (@test_bot_excluded_fields_xpath.present? && field.path.include?(@test_bot_excluded_fields_xpath))
432
440
  end
@@ -12,6 +12,7 @@ module EffectiveTestBotScreenshotsHelper
12
12
 
13
13
  def save_test_bot_screenshot
14
14
  return unless EffectiveTestBot.screenshots?
15
+ return unless page.current_path.present?
15
16
  page.save_screenshot("#{current_test_temp_path}/#{current_test_screenshot_id}.png")
16
17
  end
17
18
 
@@ -10,8 +10,6 @@ module RedirectTest
10
10
  assert_redirect(from, to)
11
11
  assert_page_normal
12
12
  assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
13
-
14
- #page.save_screenshot("#{from.parameterize}.png")
15
13
  end
16
14
 
17
15
  end
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: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-18 00:00:00.000000000 Z
11
+ date: 2017-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails