integration-tests-rails 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3020cc3bc2a7fdcda72ea6b7fd12bb5786b4f26b1be3ff1c8533ff6a3046de3a
4
- data.tar.gz: 3603ab4f58a7b508879fda0c91901142f22c39df3894013a54e4e88e8809b396
3
+ metadata.gz: 53944743e03bea5bc70d05907ebaf666e5da367c41844a9df967427c41c42860
4
+ data.tar.gz: d144aef9b18271dbb7921bce4e2718072aa9f685b727ebb7907aa13d75c29694
5
5
  SHA512:
6
- metadata.gz: '032484b408cd1cfc672d6e0dfa379b1e3d01866546a750cb98d7d45d3e098941c79f77621f5431e41a2008ed1a45e0b299f38a18fe78a1a39496c2d5a00ddba7'
7
- data.tar.gz: 8612c1eb1ac54ba15c2f63f236b85d07e93783f57d0fbbcdd39e2ddc6dd8521d9402bd15d53e600210f44009a7f923103a97153e6b88dbeb4a6aeee5eb745978
6
+ metadata.gz: 0fc048144a72cbef17015e994d933efdedec5f7ccbc573470514eb722fac65a1df6166bde2b87a24cdacd3cb8d11bfee6aa8cc36ecd5143ff5da72219b14da06
7
+ data.tar.gz: ee70f5ac6184b97c2c8e637313fe6fc1d6ecd6ee6c4219e9e9bacc1712d5c2b3a2b108bcb33792d29ba4d7413e9a6e3ec0d5c2fe42ac3b6b64f768a7c29c0b8d
data/README.md CHANGED
@@ -62,6 +62,7 @@ The `IntegrationTestsRails.setup` method accepts an optional block for further c
62
62
 
63
63
  ```ruby
64
64
  IntegrationTestsRails.setup do |config|
65
+ config.auto_retry = false # Whether to automatically wrap all examples inside retry_on_fail block.
65
66
  config.chrome_url = nil # Used for remote Chrome instances. Needs remote to be true.
66
67
  config.js_coverage = true # Whether to enable JavaScript coverage using Istanbul.
67
68
  config.max_server_retries = 1000 # Before running the tests, Cuprite starts a server to communicate with Chrome. This sets the maximum number of retries to connect to that server.
@@ -253,6 +254,20 @@ retry_on_fail(retry_attempts: 3, retry_sleep_duration: 1, capture_exceptions: [S
253
254
  end
254
255
  ```
255
256
 
257
+ ### Auto Retry
258
+
259
+ If you want to automatically retry all examples in a test suite without having to wrap them in `retry_on_fail`, you can set the `auto_retry` configuration option to `true`. This will automatically wrap all examples in a `retry_on_fail` block with the configured number of retries, exceptions to capture and sleep duration between retries.
260
+
261
+ It is possible to pass custom arguments with `auto_retry` enabled through example metadata:
262
+
263
+ ```ruby
264
+ it 'is a flaky test', auto_retry: { retry_attempts: 3, retry_sleep_duration: 2, capture_exceptions: [StandardError] } do
265
+ expect(page).to have_css('div#popover', visible: :visible, wait: 8)
266
+ end
267
+ ```
268
+
269
+ If no metadata is passed, it will use the default configuration values.
270
+
256
271
  ## JavaScript Coverage Reports
257
272
 
258
273
  After the tests (successful, failed or cancelled), coverage reports will be generated in `coverage/javascript` by default. This can be disabled in the configuration by setting `js_coverage` to `false`. Be sure to uninstall Istanbul packages through the rake task `rake integration_tests_rails:istanbul:uninstall` if you do not need this feature.
@@ -43,6 +43,15 @@ module IntegrationTestsRails
43
43
  IntegrationTestsRails::Capybara::Util.ensure_server_ready(self)
44
44
  end
45
45
 
46
+ config.around(:each, type: :feature) do |example|
47
+ if IntegrationTestsRails.configuration.auto_retry
48
+ kwargs = example.metadata.fetch(:auto_retry, {})
49
+ retry_on_fail(**kwargs) { example.run }
50
+ else
51
+ example.run
52
+ end
53
+ end
54
+
46
55
  if IntegrationTestsRails.configuration.experimental_features
47
56
  config.include(Helper, type: :feature, unit: true)
48
57
  end
@@ -38,11 +38,12 @@ module IntegrationTestsRails
38
38
  HTML
39
39
 
40
40
  attr_accessor :source_dir, :output_dir, :backup_dir, :coverage_path, :wait_time, :remote, :chrome_url, :window_size,
41
- :tests_page_html, :max_server_retries, :verbose, :js_coverage,
41
+ :tests_page_html, :max_server_retries, :verbose, :js_coverage, :auto_retry,
42
42
  :timeout, :server_host, :server_port, :puma_threads, :experimental_features,
43
43
  :retry_attempts, :retry_sleep_duration, :retry_capture_exceptions
44
44
 
45
- def initialize
45
+ def initialize # rubocop:disable Metrics/MethodLength
46
+ @auto_retry = false
46
47
  @backup_dir = 'tmp/js_backup'
47
48
  @chrome_url = nil
48
49
  @coverage_path = 'coverage/nyc'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IntegrationTestsRails
4
- VERSION = '1.1.4'
4
+ VERSION = '1.1.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: integration-tests-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tien