magic_test 0.0.3 → 0.0.4

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: 055c3c03ddef0cb663a7ed2056b08c550285ff34b467e18225d971fa7f9fc8df
4
- data.tar.gz: dad366cfa42271a6ab70654e10ef33395e5f2e3db6362f802fd811e897a82e19
3
+ metadata.gz: 8e4c59a0e6c290ee746ade6639fc584381ba394c5a94b80e3ff77d7e4b82f8cf
4
+ data.tar.gz: 9b414506b6286e4f8d0a3edbf115464e9ac10c7177a90088a64d170907297389
5
5
  SHA512:
6
- metadata.gz: d95bf68163b3b91ee927958ba914e380f55e28324ae2546aaa6cd036c1bfe3d0295768f82a4f489ca2c14e8b57749e0292c7481dfdfde2e0e55fbbb835d8ddb5
7
- data.tar.gz: ed563a867e518ceae203881b718d7637a3730d751bda506786e7b4549a95417202ba9d3ed3bf8a7c8472d72207a457017e73a513b478a032cebadb29166a09ea
6
+ metadata.gz: 3532b52fcc881558bb6f51fd51e870d5c1d0429919adf91a31a4c3ca59eec67a3358686e2d88ec6c196fbb2fdc95ffb73e22ef32745416954bc662e57ef7932f
7
+ data.tar.gz: 802b48e9ec6fd7b7dcabb403355b097d84f793a780d392a6ea26eba66daa1216374b9ec792ea556fd09e8f5ce2818c3d8cd04c9db00240ac8a13c5f20d5c17b5
data/README.md CHANGED
@@ -1,8 +1,20 @@
1
1
  # Magic Test
2
2
 
3
- Magic Test allows you to write Rails system tests interactively through a combination of trial-and-error in a debugger session and also just simple clicking around in the application being tested, all without the slowness of constantly restarting the testing environment.
3
+ Magic Test allows you to write Rails system tests interactively through a combination of trial-and-error in a debugger session and also just simple clicking around in the application being tested, all without the slowness of constantly restarting the testing environment. You can [see some videos of it in action](https://twitter.com/andrewculver/status/1366062684802846721)!
4
4
 
5
- > Magic Test is still in early development, and that includes the documentation. Any questions you have that aren't already address in the documentation should be [opened as issues](https://github.com/bullet-train-co/magic_test/issues/new) so they can be appropriately addressed in the documentation.
5
+ > Magic Test is still in early development, and that includes the documentation. Any questions you have that aren't already address in the documentation should be [opened as issues](https://github.com/bullet-train-co/magic_test/issues/new) so they can be appropriately addressed in the documentation.
6
+
7
+ Magic Test was created by [Andrew Culver](http://twitter.com/andrewculver) and [Adam Pallozzi](https://twitter.com/adampallozzi).
8
+
9
+ ## Sponsored By
10
+
11
+ <a href="https://bullettrain.co" target="_blank">
12
+ <img src="https://github.com/CanCanCommunity/cancancan/raw/develop/logo/bullet_train.png" alt="Bullet Train" width="400"/>
13
+ </a>
14
+ <br/>
15
+ <br/>
16
+
17
+ > Would you like to support Magic Test development and have your logo featured here? [Reach out!](http://twitter.com/andrewculver)
6
18
 
7
19
  ## Installation
8
20
 
@@ -59,7 +71,7 @@ If you have the screen real estate, we recommend organizing the three windows so
59
71
 
60
72
  ### Writing Tests Manually in the Debugger Console
61
73
 
62
- You’re now free to type Capybara commands in the debugger and see their results in the Chrome browser. If you type something and you’re with the result, type `ok` and hit enter to have the last line of code you wrote added to the test.
74
+ You’re now free to issue Capybara commands in the debugger and see their results in the Chrome browser. If you type something and you’re happy with the result, type `ok` and hit enter to have the last line or block of code you wrote added to the test.
63
75
 
64
76
  When you’re done writing the test interactively, you can press <kbd>Control</kbd> + <kbd>D</kbd> to finish running the test.
65
77
 
@@ -85,6 +97,9 @@ The interactive actions you make in your app are not automatically written to yo
85
97
 
86
98
  When generating test code, we check to ensure a given label or element identifier won’t result in multiple or ambiguous matches the next time a test runs. If that situation arises, we’ll try to generate the appropriate `within` blocks and selectors to ensure the target button or field is disambiguated.
87
99
 
100
+ ## Acknowledgements
101
+ We'd like to thank [Florian Plank](https://twitter.com/polarblau), the author of [Capycorder](https://github.com/polarblau/capycorder). His earlier attempt at the same concept (implemented via a Chrome extension) was ahead of its time and provided us with great inspiration and lessons learned when solving this problem from another angle.
102
+
88
103
  ## Contributing
89
104
 
90
105
  Bug reports and pull requests are welcome on GitHub at https://github.com/bullet-train-co/magic_test. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -1,4 +1,6 @@
1
1
  require 'magic_test/support'
2
+ require 'pry'
3
+ require 'pry-stack_explorer'
2
4
 
3
5
  module MagicTest
4
6
  class Engine < Rails::Engine
@@ -11,6 +13,8 @@ module MagicTest
11
13
  if defined? ActionDispatch::IntegrationTest
12
14
  ActionDispatch::IntegrationTest.include MagicTest::Support
13
15
  end
16
+
17
+
14
18
  end
15
19
  end
16
20
  end
@@ -3,7 +3,10 @@ module MagicTest
3
3
  def assert_selected_exists
4
4
  selected_text = page.evaluate_script("window.selectedText()")
5
5
  return if selected_text.blank?
6
- filepath, line = caller.select { |s| s.include?("/test/") }.reject { |s| s.include?("helper") }.first.split(':')
6
+
7
+ # TODO this feels like it's going to end up burning people who have other support files in `test` or `spec` that don't include `helper` in the name.
8
+ filepath, line = caller.select { |s| s.include?("/test/") || s.include?("/spec/") }.reject { |s| s.include?("helper") }.first.split(':')
9
+
7
10
  contents = File.open(filepath).read.lines
8
11
  chunks = contents.each_slice(line.to_i - 1 + @test_lines_written).to_a
9
12
  indentation = chunks[1].first.match(/^(\s*)/)[0]
@@ -81,7 +84,12 @@ module MagicTest
81
84
  end
82
85
 
83
86
  def empty_cache
84
- page.evaluate_script("sessionStorage.setItem('testingOutput', JSON.stringify([]))")
87
+ begin
88
+ page.evaluate_script("sessionStorage.setItem('testingOutput', JSON.stringify([]))")
89
+ rescue Capybara::NotSupportedByDriverError => e
90
+ # TODO we need to add more robust instructions for this.
91
+ raise "You need to configure this test (or your test suite) to run in a real browser (Chrome, Firefox, etc.) in order for Magic Test to work. It also needs to run in non-headless mode if `ENV['MAGIC_TEST'].present?`"
92
+ end
85
93
  end
86
94
 
87
95
  def magic_test
@@ -1,3 +1,3 @@
1
1
  module MagicTest
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magic_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-02-28 00:00:00.000000000 Z
12
+ date: 2021-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler