evil_systems 0.0.3 → 0.1.3

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: e260134685b60dd32d198ed9e16d06c951c8efca2a5e7f7839c6f2bd25a513cd
4
- data.tar.gz: e46a0563606043cadad08f2ccc9e301f3407120bf5b3c4b15275cba5096e2a78
3
+ metadata.gz: 90357ce20a94e7b4c88e4ef6ceee54011abb09b2260e626fd4bf6dccd457e25a
4
+ data.tar.gz: 83edaa0449bea20e22edafdcaf9b44c262f9d6feea6d68b85fe8b6a30a2db391
5
5
  SHA512:
6
- metadata.gz: a94ba44801ac0e86b5c519795b8de8dc8b2f55029df0e11d8228b059675f473d97dc8efec3c022b53b9763a0b5c4fbf9f21fe135a614bcfb7b0769d714434a33
7
- data.tar.gz: 81356df72c18b1669bc45b48ff61f118d32a90e48a3a6bd269daedf4c804441116fea2e67cf625982a1e5beb527ce14fd8867cb3422159422a7470ccba1c5f7b
6
+ metadata.gz: 353035e4a99107279789c22e6166bcc630479aa36515953a46b2e2767190763e663bc8071869162bedd9e42abb87e38df5750ff46c15fb4d8f0438fd880afbf4
7
+ data.tar.gz: ae4472a0e9ebb755fba01d587dbbc54d979ca893a19bc7c90f7ced39a3ee5bad82d38af5637ceb819fec70f4ce5863be70208a48d619f65236f747e8c5b80293
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
- ## 0.0.1
1
+ ## 0.1.3
2
+
3
+ - Add Slowmo option
4
+
5
+ ## 0.1.1
6
+
7
+ - Fix readme issue
8
+ - Remove mark_all_banners_as_read
9
+ - Remove selenium-webdriver
10
+
11
+ ## 0.1.0
12
+
13
+ - Allow the Cuprite driver to be configured with ENV variables for headless mode and process_timeouts.
14
+ - Increase process_timeout default to 5
15
+ - Add GH actions testing with a remote chrome instance
16
+ - Minor API cleanup
17
+
18
+ ## 0.0.3
2
19
 
3
20
  Initial release!
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  I write tests using Minitest and routinely reference [EvilMartians System
4
4
  of a Test blog post](https://evilmartians.com/chronicles/system-of-a-test-setting-up-end-to-end-rails-testing)
5
- for Minitest.) on best practices for system tests. In this blog post,
5
+ for best practices for system tests. In this blog post,
6
6
  they also have an opinionated way of setting up System Tests.
7
7
 
8
8
  `EvilSystems` offers 3 distinct advantages over the setup provided by
@@ -28,7 +28,7 @@ https://rdoc.info/github/paramagicdev/evil_systems/main
28
28
  ```ruby
29
29
  # Gemfile
30
30
  group :test do
31
- gem 'evil_system_tests'
31
+ gem 'evil_systems', '~> 0.1.0'
32
32
  end
33
33
  ```
34
34
 
@@ -37,8 +37,8 @@ Make sure the following 3 gems are in your `Gemfile` as well:
37
37
  ```ruby
38
38
  # Gemfile
39
39
  gem 'capybara'
40
- gem 'selenium-webdriver' # Still required when using Cuprite as of Rails 6.1
41
40
  gem 'cuprite' # Optional
41
+ gem 'selenium-webdriver' # Not required if using Cuprite and using Rails >= 6.1
42
42
  ```
43
43
 
44
44
  And then execute:
@@ -166,9 +166,6 @@ dom_id(*args)
166
166
  ```rb
167
167
  # Small wrapper around Capybara.using_session thats easy to call from an instance
168
168
  within_session(name_or_session, &block)
169
-
170
- # Remove all cookie banners
171
- mark_all_banners_as_read!
172
169
  ```
173
170
 
174
171
  #### Cuprite Helpers
@@ -179,7 +176,7 @@ pause
179
176
 
180
177
  # Opens a Pry or IRB repl. Will use Pry if Pry is defined, fallsback
181
178
  # to debugging with IRB
182
- debug
179
+ debug binding
183
180
  ```
184
181
 
185
182
  ### Env Variables
@@ -190,6 +187,9 @@ ENV variables used by this gem.
190
187
  ENV["APP_HOST"] # used for Capybara.app_host
191
188
  ENV["CAPYBARA_ARTIFACTS"] # used for Capybara.save_path
192
189
  ENV["CHROME_URL"] # used for setting a remote chrome instance for Cuprite
190
+ ENV["PROCESS_TIMEOUT"] # How long to wait before killing the process, default is 5 seconds
191
+ ENV["CI"] # Whether or not to run Cuprite in headless mode, defaults to true.
192
+ ENV["SLOWMO"] # Delay in seconds before sending a command (default 0). Also see https://github.com/rubycdp/ferrum#customization
193
193
  ```
194
194
 
195
195
  ## I don't want to use Cuprite.
@@ -12,13 +12,23 @@ module EvilSystems
12
12
  def self.initial_setup
13
13
  return unless defined? Capybara::Cuprite
14
14
 
15
+ begin
16
+ process_timeout = Integer(ENV.fetch("PROCESS_TIMEOUT", 5))
17
+ rescue
18
+ process_timeout = 5
19
+ end
20
+
15
21
  remote_options = RemoteChrome.options
22
+
16
23
  ::Capybara.register_driver(:cuprite) do |app|
17
24
  ::Capybara::Cuprite::Driver.new(
18
25
  app,
19
26
  **{
20
27
  window_size: [1200, 800],
21
- browser_options: {"no-sandbox" => nil},
28
+ browser_options: RemoteChrome.connected? ? {"no-sandbox" => nil} : {},
29
+ headless: ENV.fetch("CI", "true") == "true",
30
+ process_timeout: process_timeout,
31
+ slowmo: ENV.fetch("SLOWMO", 0).to_f,
22
32
  inspector: true
23
33
  }.merge(remote_options)
24
34
  )
@@ -23,12 +23,12 @@ module EvilSystems
23
23
  def self.options
24
24
  # Check whether the remote chrome is running and configure the Capybara
25
25
  # driver for it.
26
- remote_chrome ? {url: url} : {}
26
+ connected? ? {url: url} : {}
27
27
  end
28
28
 
29
29
  # Whether or not the socket could be connected
30
30
  # @return [Boolean]
31
- def self.remote_chrome
31
+ def self.connected?
32
32
  if url.nil?
33
33
  false
34
34
  else
@@ -5,10 +5,5 @@ module EvilSystems
5
5
  def within_session(name_or_session, &block)
6
6
  ::Capybara.using_session(name_or_session, &block)
7
7
  end
8
-
9
- # Remove all banners
10
- def mark_all_banners_as_read!
11
- page.driver.set_cookie "show_banners", "N"
12
- end
13
8
  end
14
9
  end
@@ -29,6 +29,9 @@ module EvilSystems
29
29
  # Make server listening on all hosts
30
30
  ::Capybara.server_host = "0.0.0.0"
31
31
 
32
+ # Silence puma
33
+ ::Capybara.server = :puma, {Silent: true}
34
+
32
35
  # Don't wait too long in `have_xyz` matchers
33
36
  ::Capybara.default_max_wait_time = 2
34
37
 
@@ -1,3 +1,3 @@
1
1
  module EvilSystems
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.3"
3
3
  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.0.3
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ParamagicDev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-05 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -95,7 +95,7 @@ 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.4
98
+ rubygems_version: 3.1.6
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Fully integrated setup based on EvilMartians system of a test