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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53944743e03bea5bc70d05907ebaf666e5da367c41844a9df967427c41c42860
|
|
4
|
+
data.tar.gz: d144aef9b18271dbb7921bce4e2718072aa9f685b727ebb7907aa13d75c29694
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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'
|