evil_systems 0.2.0 → 1.1.1

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
  SHA256:
3
- metadata.gz: 7ac55c0ee239d85c3181765a4421073e7905f65df50cbb20d64899e37ceac37c
4
- data.tar.gz: f7e111b1a140dc381ff78df22612c06b18c917c06e37272739e91f4d5e7664d0
3
+ metadata.gz: fcd8255ee6da8d4812db17750546c978c8e0f92b229bd0b45c13957d2989486c
4
+ data.tar.gz: 064ff76b3335e1c40efd6d0275cc2dadb035efcc22a5a39738e212aedca2d749
5
5
  SHA512:
6
- metadata.gz: 3bbc2b9279723ae17377f5b3dd51ddbefd98411b2f9ce600fe3aacd8cc2ee6c0f0f68fe5c755e180e82e981f2bd9d9bc55b1e7ae20c28c29adcb30cd3332c9c2
7
- data.tar.gz: 296f841ef1e8fbe93c126e4f5cd4dc4af2890724fb0068ff9baf7984c57185a90048476090784263291dfdfe16a0658fd54a84ae435ea3b27987098f49aa2d5c
6
+ metadata.gz: 0547eb8e5139cdfe8b5a53950acc9139e189107648d43812966b5ff3bfb29744be77a1ff58f75edef1f311b91fc7f33cf64c495a8ee0f6a00c1d60ad787adabb
7
+ data.tar.gz: 054116d93c6937e64bd6608b7bc5b3ac3358d3042c3bc1da29984a666bfa49ba2e9ab94e23f00a3bcfa46c2f022b2e4eb7fb946a5e4308a296054a4f49768deb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
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
+
1
17
  ## 0.2.0
2
18
 
3
19
  - Disable animations by default @julianrubisch <https://github.com/ParamagicDev/evil_systems/commit/cf72d1189c8bd8b72f130909f209f543a52aaf50>
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module EvilSystems
2
- VERSION = "0.2.0"
2
+ VERSION = "1.1.1"
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, driver_options: {})
15
15
  Settings.initial_setup
16
- RegisterCuprite.initial_setup
16
+ RegisterCuprite.initial_setup(driver_options: driver_options)
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.2.0
4
+ version: 1.1.1
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-26 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: []