evil_systems 0.1.3 → 1.1.0

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: 90357ce20a94e7b4c88e4ef6ceee54011abb09b2260e626fd4bf6dccd457e25a
4
- data.tar.gz: 83edaa0449bea20e22edafdcaf9b44c262f9d6feea6d68b85fe8b6a30a2db391
3
+ metadata.gz: f25403b04dfc7644ae7936f3bb5a91412f21c5f789507a39dedf8d12a6ef0ccb
4
+ data.tar.gz: 721ef96247a864c4873bf3293f57eefcc02049bc2e67b87dab0e0116f16b5b92
5
5
  SHA512:
6
- metadata.gz: 353035e4a99107279789c22e6166bcc630479aa36515953a46b2e2767190763e663bc8071869162bedd9e42abb87e38df5750ff46c15fb4d8f0438fd880afbf4
7
- data.tar.gz: ae4472a0e9ebb755fba01d587dbbc54d979ca893a19bc7c90f7ced39a3ee5bad82d38af5637ceb819fec70f4ce5863be70208a48d619f65236f747e8c5b80293
6
+ metadata.gz: 65ff0d4dc4c7d7985ea032e8d2171b01f0cd1d1262d381d203813de53e801a885de6eba12e79ff25960faf2743bdc4aebe0bd4bd84e85e1dbf45e8983d94e18c
7
+ data.tar.gz: e35bffb30e2bdcda404114496c15e6b25c3989ee122cbd3b9e08236249249b4385c0fd699d483cfdd9305f3310b34a9bcbcb6b41b3da19f22a00c30684275953
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 1.1.0
2
+
3
+ - Feature: add `driver_options` to `initial_setup`
4
+
5
+ ## 1.0.0
6
+
7
+ - 🚨 BREAKING CHANGE - Renamed `:cuprite` driver to
8
+ `:evil_cuprite` to avoid naming collision in Rails 7.
9
+ <https://github.com/ParamagicDev/evil_systems/pull/7>
10
+
11
+ - Added `wait_for_network_idle!`
12
+ - Added `:skip_task` to avoid rake tasks all together.
13
+ <https://github.com/evil_systems/pull/8>
14
+
15
+ - Updated test suite to Rails 7
16
+
17
+ ## 0.2.0
18
+
19
+ - Disable animations by default @julianrubisch <https://github.com/ParamagicDev/evil_systems/commit/cf72d1189c8bd8b72f130909f209f543a52aaf50>
20
+
1
21
  ## 0.1.3
2
22
 
3
23
  - Add Slowmo option
data/README.md CHANGED
@@ -25,28 +25,24 @@ https://rdoc.info/github/paramagicdev/evil_systems/main
25
25
 
26
26
  ## Installation
27
27
 
28
- ```ruby
29
- # Gemfile
30
- group :test do
31
- gem 'evil_systems', '~> 0.1.0'
32
- end
28
+ ```bash
29
+ bundle add evil_systems --group=test
33
30
  ```
34
31
 
35
32
  Make sure the following 3 gems are in your `Gemfile` as well:
36
33
 
37
34
  ```ruby
38
35
  # Gemfile
39
- gem 'capybara'
40
- gem 'cuprite' # Optional
41
- gem 'selenium-webdriver' # Not required if using Cuprite and using Rails >= 6.1
42
- ```
43
-
44
- And then execute:
45
36
 
46
- ```bash
47
- bundle
37
+ group :test do
38
+ gem 'capybara'
39
+ gem 'cuprite' # Optional
40
+ gem 'selenium-webdriver' # Not required if using Cuprite and using Rails >= 6.1
41
+ end
48
42
  ```
49
43
 
44
+ > Note: `bundle add` by default appends the gem to the bottom of your `Gemfile`, which means not in the `test` group of gems. If the `capybara` gem is in the `test` group, but `evil_systems` is not, you will not be able to load your application in production. Be sure that `evil_systems` is placed in the same group as `capybara` (we recommend the `test` group).
45
+
50
46
  ## Setup
51
47
 
52
48
  ### Minitest
@@ -67,9 +63,11 @@ require 'capybara/cuprite'
67
63
  require 'evil_systems'
68
64
 
69
65
  EvilSystems.initial_setup
66
+ # To pass in driver_options to cuprite you can do the following:
67
+ # EvilSystems.initial_setup(driver_options: { process_timeout: 20 })
70
68
 
71
69
  class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
72
- driven_by :cuprite
70
+ driven_by :evil_cuprite
73
71
 
74
72
  include EvilSystems::Helpers
75
73
  end
@@ -83,10 +81,10 @@ end
83
81
 
84
82
  ## Usage
85
83
 
86
- `EvilSystems.initial_setup` takes two keyword arguments, `:task`, and
87
- `silent`.
84
+ `EvilSystems.initial_setup` takes three keyword arguments, `:task`, and
85
+ `silent`, `skip_task`.
88
86
 
89
- Both arguments have to do with precompiling assets.
87
+ They all have to do with precompiling assets.
90
88
 
91
89
  `:silent` by default is set to `true` and will only tell you when assets
92
90
  are compiling, and how long the compilation took.
@@ -94,6 +92,8 @@ are compiling, and how long the compilation took.
94
92
  `:task` defaults to `assets:precompile`, System of a test uses
95
93
  `webpacker:compile`.
96
94
 
95
+ `:skip_task` when `true` says you dont want to run any Rake tasks. Default is `false`
96
+
97
97
  Example:
98
98
 
99
99
  ```rb
@@ -102,11 +102,11 @@ EvilSystems.initial_setup(task: "webpacker:compile", silent: false)
102
102
 
103
103
  ### Settings
104
104
 
105
- - [x] - Automatically registers a `:cuprite` driver if `Capybara::Cuprite`
105
+ - [x] - Automatically registers a `:evil_cuprite` driver if `Capybara::Cuprite`
106
106
  is defined.
107
107
 
108
108
  - [x] - Automatically sets Capybara's default and javascript driver to
109
- `:cuprite`
109
+ `:evil_cuprite`
110
110
 
111
111
  - [x] - Automatically sets `Capybara.app_host`
112
112
 
@@ -177,6 +177,9 @@ pause
177
177
  # Opens a Pry or IRB repl. Will use Pry if Pry is defined, fallsback
178
178
  # to debugging with IRB
179
179
  debug binding
180
+
181
+ # waits to make sure theres no active connections.
182
+ wait_for_network_idle!
180
183
  ```
181
184
 
182
185
  ### Env Variables
@@ -190,6 +193,7 @@ ENV["CHROME_URL"] # used for setting a remote chrome instance for Cuprite
190
193
  ENV["PROCESS_TIMEOUT"] # How long to wait before killing the process, default is 5 seconds
191
194
  ENV["CI"] # Whether or not to run Cuprite in headless mode, defaults to true.
192
195
  ENV["SLOWMO"] # Delay in seconds before sending a command (default 0). Also see https://github.com/rubycdp/ferrum#customization
196
+ ENV["DISABLE_ANIMATION"] # Configure whether Capybara should render animations, default is true
193
197
  ```
194
198
 
195
199
  ## I don't want to use Cuprite.
@@ -18,5 +18,11 @@ module EvilSystems
18
18
 
19
19
  page.driver.pause
20
20
  end
21
+
22
+ # Convenience method to access the drivers `wait_for_network_idle`
23
+ # @see https://github.com/rubycdp/cuprite/blob/47d8949f30dea3d97dba70d8643abce861e0d652/README.md#network-traffic
24
+ def wait_for_network_idle!
25
+ page.driver.wait_for_network_idle
26
+ end
21
27
  end
22
28
  end
@@ -6,10 +6,10 @@ module EvilSystems
6
6
  # See https://github.com/rubycdp/cuprite
7
7
  module RegisterCuprite
8
8
  # Registers the Cuprite driver. Can be used via:
9
- # driven_by :cuprite, using: :chrome, screen_size: [1400, 1400]
9
+ # driven_by :evil_cuprite, using: :chrome, screen_size: [1400, 1400]
10
10
  # The initial setup prior to the class ApplicationSystemTestCase, runs before the entire test suite.
11
11
  # @return [void]
12
- def self.initial_setup
12
+ def self.initial_setup(driver_options: {})
13
13
  return unless defined? Capybara::Cuprite
14
14
 
15
15
  begin
@@ -20,7 +20,7 @@ module EvilSystems
20
20
 
21
21
  remote_options = RemoteChrome.options
22
22
 
23
- ::Capybara.register_driver(:cuprite) do |app|
23
+ ::Capybara.register_driver(:evil_cuprite) do |app|
24
24
  ::Capybara::Cuprite::Driver.new(
25
25
  app,
26
26
  **{
@@ -30,11 +30,11 @@ module EvilSystems
30
30
  process_timeout: process_timeout,
31
31
  slowmo: ENV.fetch("SLOWMO", 0).to_f,
32
32
  inspector: true
33
- }.merge(remote_options)
33
+ }.merge(remote_options).merge(driver_options)
34
34
  )
35
35
  end
36
36
  end
37
37
  end
38
38
  end
39
39
 
40
- Capybara.default_driver = Capybara.javascript_driver = :cuprite
40
+ Capybara.default_driver = Capybara.javascript_driver = :evil_cuprite
@@ -40,6 +40,9 @@ module EvilSystems
40
40
 
41
41
  # Where to store artifacts (e.g. screenshots, downloaded files, etc.)
42
42
  ::Capybara.save_path = ENV.fetch("CAPYBARA_ARTIFACTS", "./tmp/capybara")
43
+
44
+ # Disable animations in Capybara by default
45
+ ::Capybara.disable_animation = ENV.fetch("DISABLE_ANIMATION", "true") == "true"
43
46
  end
44
47
 
45
48
  private_class_method def self.prepend_session_to_capybara
@@ -1,3 +1,3 @@
1
1
  module EvilSystems
2
- VERSION = "0.1.3"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/evil_systems.rb CHANGED
@@ -11,9 +11,12 @@ module EvilSystems
11
11
  # @see Settings#initial_setup
12
12
  # @see RegisterCuprite#initial_setup
13
13
  # @see PrecompileAssets#initial_setup
14
- def self.initial_setup(task: "assets:precompile", silent: true)
14
+ def self.initial_setup(task: "assets:precompile", silent: true, skip_task: false)
15
15
  Settings.initial_setup
16
16
  RegisterCuprite.initial_setup
17
+
18
+ return if skip_task
19
+
17
20
  PrecompileAssets.initial_setup(task: task, silent: silent)
18
21
  end
19
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evil_systems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ParamagicDev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-15 00:00:00.000000000 Z
11
+ date: 2022-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.0
55
- description:
55
+ description:
56
56
  email:
57
57
  - konnor5456@gmail.com
58
58
  executables: []
@@ -80,7 +80,7 @@ metadata:
80
80
  homepage_uri: https://github.com/paramagicdev/evil_systems
81
81
  source_code_uri: https://github.com/paramagicdev/evil_systems
82
82
  changelog_uri: https://github.com/paramagicdev/evil_systems/CHANGELOG.md
83
- post_install_message:
83
+ post_install_message:
84
84
  rdoc_options: []
85
85
  require_paths:
86
86
  - lib
@@ -95,8 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  requirements: []
98
- rubygems_version: 3.1.6
99
- signing_key:
98
+ rubygems_version: 3.2.3
99
+ signing_key:
100
100
  specification_version: 4
101
101
  summary: Fully integrated setup based on EvilMartians system of a test
102
102
  test_files: []