superbara 0.1.2 → 0.2.0

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: 947c7e5b472601615305fc7932913aea9217a85e3658286bc2629dbad7d03858
4
- data.tar.gz: 393c24ebfb37ad8396524b71f1bab57d14bacde75d07822b9bf49b274a50a0d4
3
+ metadata.gz: e3f37686e928fbea4e366c1e642696f8e7869d128081cbeec9dd578a82358fe2
4
+ data.tar.gz: 8d59b138159a9bf4a2e61fa85e8a52a32716a11f6ed2694897463c2f849c81af
5
5
  SHA512:
6
- metadata.gz: ab7be7f3b6ee125c4cd4151edd4c1ed5679abb7f328171e65513e6f50385ddfca9b5a1ec5ac4f4cb3c7777ad39622e622962a63790dbffb0a2ae65fc032c63cd
7
- data.tar.gz: 6c93885ed00e6b817e3cf019cff63ea92e577729600b5e197b883ce466ff91b9bfb37b4153cc739c19fc7e0c051b8f8671eb85e30cacd0e9da82fb0067e880a7
6
+ metadata.gz: cdfec891da9478635830cc78803ebb1a7682e520067e7726481c1f55085fe14eddd0e83046e1c2b2756ff9d55cc8899897f55fbe3d9933e90a1a950c4c04aea8
7
+ data.tar.gz: 3d7c3ebb3ff0a29957cdbc087bdafcfe2b198f556583b86a0f55e99789b87c3d60df0aa5453b17d9b02cc5eef83206c45010a65ec185b24b55c9e70cd63608c6
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.5.1
data/Gemfile.lock CHANGED
@@ -1,47 +1,42 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbara (0.1.2)
5
- binding_of_caller (~> 0.7, >= 0.7.2)
6
- capybara (~> 2.16, >= 2.16.0)
7
- chromedriver-helper (~> 1.1.0, >= 1.1.0)
4
+ superbara (0.2.0)
5
+ binding_of_caller (~> 0.8, >= 0.8.0)
6
+ capybara (~> 3.0, >= 3.0.0)
7
+ chromedriver-helper (~> 1.2.0, >= 1.2.0)
8
8
  colorize (~> 0.8, >= 0.8.1)
9
- pry-byebug (~> 3.4, >= 3.4.2)
10
- rspec (~> 3.6, >= 3.6.0)
11
- selenium-webdriver (~> 3.7, >= 3.7.0)
9
+ pry-byebug (~> 3.6, >= 3.6.0)
10
+ selenium-webdriver (~> 3.11, >= 3.11.0)
12
11
 
13
12
  GEM
14
13
  remote: https://rubygems.org/
15
14
  specs:
16
15
  addressable (2.5.2)
17
16
  public_suffix (>= 2.0.2, < 4.0)
18
- archive-zip (0.7.0)
17
+ archive-zip (0.11.0)
19
18
  io-like (~> 0.3.0)
20
- binding_of_caller (0.7.3)
19
+ binding_of_caller (0.8.0)
21
20
  debug_inspector (>= 0.0.1)
22
- byebug (9.0.6)
23
- capybara (2.16.1)
21
+ byebug (10.0.2)
22
+ capybara (3.0.0)
24
23
  addressable
25
24
  mini_mime (>= 0.1.3)
26
- nokogiri (>= 1.3.3)
27
- rack (>= 1.0.0)
28
- rack-test (>= 0.5.4)
29
- xpath (~> 2.0)
30
- childprocess (0.8.0)
25
+ nokogiri (~> 1.8)
26
+ rack (>= 1.6.0)
27
+ rack-test (>= 0.6.3)
28
+ xpath (~> 3.0)
29
+ childprocess (0.9.0)
31
30
  ffi (~> 1.0, >= 1.0.11)
32
- chromedriver-helper (1.1.0)
33
- archive-zip (~> 0.7.0)
34
- nokogiri (~> 1.6)
31
+ chromedriver-helper (1.2.0)
32
+ archive-zip (~> 0.10)
33
+ nokogiri (~> 1.8)
35
34
  coderay (1.1.2)
36
35
  colorize (0.8.1)
37
36
  debug_inspector (0.0.3)
38
37
  diff-lcs (1.3)
39
- ffi (1.9.18)
38
+ ffi (1.9.23)
40
39
  io-like (0.3.0)
41
- listen (3.1.5)
42
- rb-fsevent (~> 0.9, >= 0.9.4)
43
- rb-inotify (~> 0.9, >= 0.9.7)
44
- ruby_dep (~> 1.2)
45
40
  method_source (0.9.0)
46
41
  mini_mime (1.0.0)
47
42
  mini_portile2 (2.3.0)
@@ -50,39 +45,33 @@ GEM
50
45
  pry (0.11.3)
51
46
  coderay (~> 1.1.0)
52
47
  method_source (~> 0.9.0)
53
- pry-byebug (3.4.3)
54
- byebug (>= 9.0, < 9.1)
48
+ pry-byebug (3.6.0)
49
+ byebug (~> 10.0)
55
50
  pry (~> 0.10)
56
51
  public_suffix (3.0.2)
57
52
  rack (2.0.4)
58
- rack-test (0.8.3)
53
+ rack-test (1.0.0)
59
54
  rack (>= 1.0, < 3)
60
55
  rake (10.5.0)
61
- rb-fsevent (0.10.2)
62
- rb-inotify (0.9.10)
63
- ffi (>= 0.5.0, < 2)
64
- rerun (0.11.0)
65
- listen (~> 3.0)
66
- rspec (3.6.0)
67
- rspec-core (~> 3.6.0)
68
- rspec-expectations (~> 3.6.0)
69
- rspec-mocks (~> 3.6.0)
70
- rspec-core (3.6.0)
71
- rspec-support (~> 3.6.0)
72
- rspec-expectations (3.6.0)
56
+ rspec (3.7.0)
57
+ rspec-core (~> 3.7.0)
58
+ rspec-expectations (~> 3.7.0)
59
+ rspec-mocks (~> 3.7.0)
60
+ rspec-core (3.7.1)
61
+ rspec-support (~> 3.7.0)
62
+ rspec-expectations (3.7.0)
73
63
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.6.0)
75
- rspec-mocks (3.6.0)
64
+ rspec-support (~> 3.7.0)
65
+ rspec-mocks (3.7.0)
76
66
  diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.6.0)
78
- rspec-support (3.6.0)
79
- ruby_dep (1.5.0)
67
+ rspec-support (~> 3.7.0)
68
+ rspec-support (3.7.1)
80
69
  rubyzip (1.2.1)
81
- selenium-webdriver (3.7.0)
70
+ selenium-webdriver (3.11.0)
82
71
  childprocess (~> 0.5)
83
- rubyzip (~> 1.0)
84
- xpath (2.1.0)
85
- nokogiri (~> 1.3)
72
+ rubyzip (~> 1.2)
73
+ xpath (3.0.0)
74
+ nokogiri (~> 1.8)
86
75
 
87
76
  PLATFORMS
88
77
  ruby
@@ -90,7 +79,7 @@ PLATFORMS
90
79
  DEPENDENCIES
91
80
  bundler (~> 1.15, >= 1.15.0)
92
81
  rake (~> 10.0, >= 10.0.0)
93
- rerun (~> 0.11, >= 0.11.0)
82
+ rspec (~> 3.7, >= 3.7.0)
94
83
  superbara!
95
84
 
96
85
  BUNDLED WITH
data/bin/console CHANGED
@@ -1,13 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "superbara"
5
-
6
- include Superbara::DSL
7
- include Capybara::DSL
8
-
9
- Capybara::Session.new :chrome_remote
4
+ require_relative "../lib/superbara"
5
+ require_relative "../lib/superbara/dsl"
10
6
 
11
7
  visit "http://www.example.com"
8
+ h1 = find "h1"
9
+ h1.highlight
12
10
 
13
11
  Pry.start
data/bin/release CHANGED
@@ -1,3 +1,7 @@
1
1
  #!/usr/bin/env sh
2
+ set -e
3
+
4
+ rake
5
+ echo q | SUPERBARA_FRONTEND=noninteractive exe/superbara start e2e
2
6
 
3
7
  gem build superbara.gemspec
data/e2e/main.rb ADDED
@@ -0,0 +1,3 @@
1
+ visit "http://www.example.com"
2
+ h1 = find "h1"
3
+ h1.highlight
@@ -0,0 +1,13 @@
1
+ module Capybara
2
+ module Node
3
+ class Element
4
+ def highlight
5
+ for color in ["DeepPink", "GreenYellow", "Aqua", "Red", "Yellow"]
6
+ Superbara::Helpers.highlight_element(self, {color: color})
7
+ sleep 0.1
8
+ end
9
+ "did you see it?"
10
+ end
11
+ end
12
+ end
13
+ end
data/lib/superbara/dsl.rb CHANGED
@@ -1,9 +1,105 @@
1
1
  module Superbara; module DSL
2
+ def self.included(includer)
3
+ puts "Superbara::DSL included in #{includer.inspect}"
4
+ end
5
+
2
6
  def wait(seconds, &block)
3
- Superbara.wait(seconds, &block)
7
+ def wait_formatted_output(status, took_delta)
8
+ word, color = if status
9
+ ["ok", :green]
10
+ else
11
+ ["FAIL", :red]
12
+ end
13
+
14
+ puts "#{word.colorize(color)} (took #{(took_delta)}s)"
15
+ end
16
+ seconds = seconds.to_f
17
+
18
+ print "--> waiting max #{seconds}s "
19
+ started_at = Time.now
20
+
21
+ previous_capybara_default_max_wait_time = Capybara.default_max_wait_time
22
+ block_value = nil
23
+ exception = nil
24
+ timed_out = false
25
+ begin
26
+ Capybara.default_max_wait_time = seconds
27
+ Timeout::timeout (seconds+0.1) do
28
+ block_value = block.call
29
+ end
30
+ rescue Timeout::Error => ex
31
+ timed_out = true
32
+ rescue Exception => ex
33
+ exception = ex
34
+ end
35
+
36
+ took_delta = (Time.now - started_at).floor(2)
37
+ Capybara.default_max_wait_time = previous_capybara_default_max_wait_time
38
+
39
+ if exception || timed_out
40
+ wait_formatted_output false, took_delta
41
+
42
+ additional_started_at = Time.now
43
+ additional_block_value = nil
44
+ additional_exception = nil
45
+ puts " testing if waiting for 2 seconds more would help.."
46
+ begin
47
+ Capybara.default_max_wait_time = 2
48
+ additional_block_value = block.call
49
+ rescue Exception => ex
50
+ additional_exception = ex
51
+ end
52
+ additional_took_delta = (Time.now - additional_started_at).floor(2)
53
+ suggested_wait_value = (seconds + additional_took_delta).floor(2)
54
+
55
+ if additional_exception || additional_block_value.nil?
56
+ puts " ..did not help."
57
+ else
58
+ puts " ..setting wait to >#{suggested_wait_value} would help here?"
59
+ end
60
+
61
+ if exception
62
+ raise exception
63
+ else
64
+ raise "capybara timed out"
65
+ end
66
+ end
67
+
68
+ if block_value == false
69
+ wait_formatted_output false, took_delta
70
+ raise "wait condition was falsy"
71
+ end
72
+
73
+ if block_value == nil
74
+ wait_formatted_output false, took_delta
75
+ raise "wait condition was nil"
76
+ end
77
+
78
+ self.wait_formatted_output true, took_delta
79
+ return block_value
4
80
  end
5
81
 
6
- def debug(exception_occurred: false)
7
- Superbara.debug(exception_occurred: exception_occurred)
82
+ def debug(exception_occurred:false)
83
+ return if ENV['SUPERBARA_FRONTEND'] == "noninteractive"
84
+ debug_help = """
85
+ c - continue to the next debug breakpoint
86
+ s - step to the next line
87
+ r - retry running
88
+ h - help on commands available
89
+ q - exit to shell"""
90
+
91
+ debug_header_prefix = "== DEBUG "
92
+ debug_header_suffix = "=" * (IO.console.winsize.last - debug_header_prefix.size)
93
+
94
+ puts """
95
+ #{debug_header_prefix}#{debug_header_suffix}
96
+ #{debug_help}
97
+ """.colorize(:light_green)
98
+
99
+ $supress_pry_whereami = true if exception_occurred
100
+ Pry.start(binding.of_caller(1))
8
101
  end
9
102
  end; end
103
+
104
+ include Superbara::DSL
105
+ include Capybara::DSL
@@ -27,7 +27,6 @@ window.setTimeout(function() {
27
27
  js << """
28
28
  }, #{remove_highlight})
29
29
  """
30
-
31
30
  Capybara.current_session.current_window.session.execute_script js
32
31
  end
33
32
 
@@ -1,3 +1,3 @@
1
1
  module Superbara
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/superbara.rb CHANGED
@@ -5,16 +5,15 @@ require "capybara"
5
5
  require "capybara/dsl"
6
6
  require "selenium-webdriver"
7
7
 
8
+ require_relative "capybara_monkey"
8
9
  require_relative "pry_monkey"
9
10
 
10
11
  require_relative "superbara/version"
11
12
  require_relative "superbara/helpers"
13
+
12
14
  require_relative "superbara/drivers/chrome"
13
15
  require_relative "superbara/drivers/chrome_headless"
14
16
 
15
- require_relative "superbara/functions/debug.rb"
16
- require_relative "superbara/functions/wait.rb"
17
-
18
17
  trap "SIGINT" do
19
18
  puts "
20
19
  control+c pressed, closing the browser..."
@@ -29,6 +28,9 @@ control+c pressed, closing the browser..."
29
28
  exit 99
30
29
  end
31
30
 
31
+ require "chromedriver/helper"
32
+ Chromedriver.set_version "2.37"
33
+
32
34
  Capybara.default_driver = :chrome
33
35
  Capybara.default_max_wait_time = 1
34
36
 
data/lib/supershell CHANGED
@@ -70,7 +70,7 @@ case $1 in
70
70
  if [ -f $2 ]; then
71
71
  test_file=$2
72
72
  else
73
- test_file="${2}/${2}_spec.rb"
73
+ test_file="${2}/main.rb"
74
74
  fi
75
75
 
76
76
  if [ ! -f "$test_file" ]; then
@@ -85,23 +85,17 @@ case $1 in
85
85
  exit 0
86
86
  ;;
87
87
  "init")
88
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
89
+
88
90
  test_name=$(basename $2)
89
- spec_file="${test_name}_spec.rb"
91
+ spec_file="main.rb"
90
92
  target_file="${2}/${spec_file}"
91
93
 
92
94
  if [ -f "$target_file" ]; then
93
95
  Error "$target_file already exists"
94
96
  fi
95
97
  mkdir -p $2
96
- echo '''RSpec.describe \"${test_name}\" do
97
- it "loads" do
98
- visit "http://www.example.com"
99
- more_link = find "a", text: /ore information/
100
- debug
101
- more_link.click
102
- debug
103
- end
104
- end''' >> "$target_file"
98
+ cat $DIR/../support/templates/test.rb > "$target_file"
105
99
 
106
100
  echo " --> created $target_file
107
101
 
@@ -128,11 +122,11 @@ esac
128
122
 
129
123
  while true; do
130
124
  set +e
131
- rspec --require superbara/rspec $@
132
- rspec_exit_code=$?
125
+ ruby -r./lib/superbara -r./lib/superbara/dsl "$1/"*.rb
126
+ exit_code=$?
133
127
  set -e
134
128
 
135
- case "$rspec_exit_code" in
129
+ case "$exit_code" in
136
130
  0)
137
131
  if [ "$mode" = "single" ]; then
138
132
  exit 0
@@ -151,7 +145,7 @@ while true; do
151
145
  exit 0
152
146
  ;;
153
147
  *)
154
- echo "err: unknown rspec exit code $rspec_exit_code"
148
+ echo "err: unknown exit code $exit_code"
155
149
  exit 1
156
150
  ;;
157
151
  esac
data/superbara.gemspec CHANGED
@@ -22,14 +22,13 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
25
- spec.add_dependency 'pry-byebug', '~> 3.4', '>= 3.4.2'
26
- spec.add_dependency 'binding_of_caller', '~> 0.7', '>=0.7.2'
27
- spec.add_dependency 'capybara', '~> 2.16', '>= 2.16.0'
28
- spec.add_dependency 'selenium-webdriver', '~> 3.7', '>= 3.7.0'
29
- spec.add_dependency 'rspec', '~> 3.6', '>= 3.6.0'
30
- spec.add_dependency 'chromedriver-helper', '~> 1.1.0', '>= 1.1.0'
25
+ spec.add_dependency 'pry-byebug', '~> 3.6', '>= 3.6.0'
26
+ spec.add_dependency 'binding_of_caller', '~> 0.8', '>=0.8.0'
27
+ spec.add_dependency 'capybara', '~> 3.0', '>= 3.0.0'
28
+ spec.add_dependency 'selenium-webdriver', '~> 3.11', '>= 3.11.0'
29
+ spec.add_dependency 'chromedriver-helper', '~> 1.2.0', '>= 1.2.0'
31
30
 
32
- spec.add_development_dependency 'rerun', '~> 0.11', '>= 0.11.0'
33
31
  spec.add_development_dependency 'bundler', '~> 1.15', '>= 1.15.0'
34
32
  spec.add_development_dependency 'rake', '~> 10.0', '>= 10.0.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.7', '>= 3.7.0'
35
34
  end
@@ -0,0 +1,6 @@
1
+ visit "http://www.example.com"
2
+
3
+ more_link = find "a", text: /ore information/
4
+ debug
5
+ more_link.click
6
+ debug
data/www/1.html ADDED
@@ -0,0 +1,2 @@
1
+ <a href="2.html">2</a>
2
+ <a href="3.html">3s</a>
data/www/2.html ADDED
@@ -0,0 +1 @@
1
+ <a href="3.html">3</a>
data/www/3.html ADDED
@@ -0,0 +1,2 @@
1
+ <a href="index.html">
2
+ index</a>
data/www/index.html CHANGED
@@ -1,3 +1,4 @@
1
1
  <h1>Superbara</h1>
2
2
  <hr>
3
3
  <a href="another.html">Another page</a>
4
+ <a href="1.html">1.html</a>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superbara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matti Paksula
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-03 00:00:00.000000000 Z
11
+ date: 2018-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -36,180 +36,160 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '3.4'
39
+ version: '3.6'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 3.4.2
42
+ version: 3.6.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '3.4'
49
+ version: '3.6'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 3.4.2
52
+ version: 3.6.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: binding_of_caller
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '0.7'
59
+ version: '0.8'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 0.7.2
62
+ version: 0.8.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0.7'
69
+ version: '0.8'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 0.7.2
72
+ version: 0.8.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: capybara
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '2.16'
79
+ version: '3.0'
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 2.16.0
82
+ version: 3.0.0
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.16'
89
+ version: '3.0'
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: 2.16.0
92
+ version: 3.0.0
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: selenium-webdriver
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: '3.7'
99
+ version: '3.11'
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 3.7.0
102
+ version: 3.11.0
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '3.7'
109
+ version: '3.11'
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 3.7.0
113
- - !ruby/object:Gem::Dependency
114
- name: rspec
115
- requirement: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - "~>"
118
- - !ruby/object:Gem::Version
119
- version: '3.6'
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: 3.6.0
123
- type: :runtime
124
- prerelease: false
125
- version_requirements: !ruby/object:Gem::Requirement
126
- requirements:
127
- - - "~>"
128
- - !ruby/object:Gem::Version
129
- version: '3.6'
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: 3.6.0
112
+ version: 3.11.0
133
113
  - !ruby/object:Gem::Dependency
134
114
  name: chromedriver-helper
135
115
  requirement: !ruby/object:Gem::Requirement
136
116
  requirements:
137
117
  - - "~>"
138
118
  - !ruby/object:Gem::Version
139
- version: 1.1.0
119
+ version: 1.2.0
140
120
  - - ">="
141
121
  - !ruby/object:Gem::Version
142
- version: 1.1.0
122
+ version: 1.2.0
143
123
  type: :runtime
144
124
  prerelease: false
145
125
  version_requirements: !ruby/object:Gem::Requirement
146
126
  requirements:
147
127
  - - "~>"
148
128
  - !ruby/object:Gem::Version
149
- version: 1.1.0
129
+ version: 1.2.0
150
130
  - - ">="
151
131
  - !ruby/object:Gem::Version
152
- version: 1.1.0
132
+ version: 1.2.0
153
133
  - !ruby/object:Gem::Dependency
154
- name: rerun
134
+ name: bundler
155
135
  requirement: !ruby/object:Gem::Requirement
156
136
  requirements:
157
137
  - - "~>"
158
138
  - !ruby/object:Gem::Version
159
- version: '0.11'
139
+ version: '1.15'
160
140
  - - ">="
161
141
  - !ruby/object:Gem::Version
162
- version: 0.11.0
142
+ version: 1.15.0
163
143
  type: :development
164
144
  prerelease: false
165
145
  version_requirements: !ruby/object:Gem::Requirement
166
146
  requirements:
167
147
  - - "~>"
168
148
  - !ruby/object:Gem::Version
169
- version: '0.11'
149
+ version: '1.15'
170
150
  - - ">="
171
151
  - !ruby/object:Gem::Version
172
- version: 0.11.0
152
+ version: 1.15.0
173
153
  - !ruby/object:Gem::Dependency
174
- name: bundler
154
+ name: rake
175
155
  requirement: !ruby/object:Gem::Requirement
176
156
  requirements:
177
157
  - - "~>"
178
158
  - !ruby/object:Gem::Version
179
- version: '1.15'
159
+ version: '10.0'
180
160
  - - ">="
181
161
  - !ruby/object:Gem::Version
182
- version: 1.15.0
162
+ version: 10.0.0
183
163
  type: :development
184
164
  prerelease: false
185
165
  version_requirements: !ruby/object:Gem::Requirement
186
166
  requirements:
187
167
  - - "~>"
188
168
  - !ruby/object:Gem::Version
189
- version: '1.15'
169
+ version: '10.0'
190
170
  - - ">="
191
171
  - !ruby/object:Gem::Version
192
- version: 1.15.0
172
+ version: 10.0.0
193
173
  - !ruby/object:Gem::Dependency
194
- name: rake
174
+ name: rspec
195
175
  requirement: !ruby/object:Gem::Requirement
196
176
  requirements:
197
177
  - - "~>"
198
178
  - !ruby/object:Gem::Version
199
- version: '10.0'
179
+ version: '3.7'
200
180
  - - ">="
201
181
  - !ruby/object:Gem::Version
202
- version: 10.0.0
182
+ version: 3.7.0
203
183
  type: :development
204
184
  prerelease: false
205
185
  version_requirements: !ruby/object:Gem::Requirement
206
186
  requirements:
207
187
  - - "~>"
208
188
  - !ruby/object:Gem::Version
209
- version: '10.0'
189
+ version: '3.7'
210
190
  - - ">="
211
191
  - !ruby/object:Gem::Version
212
- version: 10.0.0
192
+ version: 3.7.0
213
193
  description: Better way to build Capybara tests
214
194
  email:
215
195
  - matti.paksula@iki.fi
@@ -229,19 +209,23 @@ files:
229
209
  - bin/autotest
230
210
  - bin/console
231
211
  - bin/release
212
+ - e2e/main.rb
232
213
  - exe/superbara
214
+ - lib/capybara_monkey.rb
233
215
  - lib/pry_monkey.rb
234
216
  - lib/superbara.rb
235
217
  - lib/superbara/drivers/chrome.rb
236
218
  - lib/superbara/drivers/chrome_headless.rb
237
219
  - lib/superbara/dsl.rb
238
- - lib/superbara/functions/debug.rb
239
- - lib/superbara/functions/wait.rb
240
220
  - lib/superbara/helpers.rb
241
221
  - lib/superbara/rspec.rb
242
222
  - lib/superbara/version.rb
243
223
  - lib/supershell
244
224
  - superbara.gemspec
225
+ - support/templates/test.rb
226
+ - www/1.html
227
+ - www/2.html
228
+ - www/3.html
245
229
  - www/another.html
246
230
  - www/index.html
247
231
  homepage: https://www.github.com/matti/superbara
@@ -264,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
248
  version: '0'
265
249
  requirements: []
266
250
  rubyforge_project:
267
- rubygems_version: 2.7.3
251
+ rubygems_version: 2.7.6
268
252
  signing_key:
269
253
  specification_version: 4
270
254
  summary: Super Capybara
@@ -1,22 +0,0 @@
1
- module Superbara
2
- def self.debug(exception_occurred:false)
3
- return if ENV['SUPERBARA_FRONTEND'] == "noninteractive"
4
- debug_help = """
5
- c - continue to the next debug breakpoint
6
- s - step to the next line
7
- r - retry running
8
- h - help on commands available
9
- q - exit to shell"""
10
-
11
- debug_header_prefix = "== DEBUG "
12
- debug_header_suffix = "=" * (IO.console.winsize.last - debug_header_prefix.size)
13
-
14
- puts """
15
- #{debug_header_prefix}#{debug_header_suffix}
16
- #{debug_help}
17
- """.colorize(:light_green)
18
-
19
- $supress_pry_whereami = true if exception_occurred
20
- Pry.start(binding.of_caller(1))
21
- end
22
- end
@@ -1,78 +0,0 @@
1
- module Superbara
2
- def self.wait(seconds, &block)
3
- seconds = seconds.to_f
4
-
5
- print "--> waiting max #{seconds}s "
6
- started_at = Time.now
7
-
8
- previous_capybara_default_max_wait_time = Capybara.default_max_wait_time
9
- block_value = nil
10
- exception = nil
11
- timed_out = false
12
- begin
13
- Capybara.default_max_wait_time = seconds
14
- Timeout::timeout (seconds+0.1) do
15
- block_value = block.call
16
- end
17
- rescue Timeout::Error => ex
18
- timed_out = true
19
- rescue Exception => ex
20
- exception = ex
21
- end
22
-
23
- took_delta = (Time.now - started_at).floor(2)
24
- Capybara.default_max_wait_time = previous_capybara_default_max_wait_time
25
-
26
- if exception || timed_out
27
- self.wait_formatted_output false, took_delta
28
-
29
- additional_started_at = Time.now
30
- additional_block_value = nil
31
- additional_exception = nil
32
- puts " testing if waiting for 2 seconds more would help.."
33
- begin
34
- Capybara.default_max_wait_time = 2
35
- additional_block_value = block.call
36
- rescue Exception => ex
37
- additional_exception = ex
38
- end
39
- additional_took_delta = (Time.now - additional_started_at).floor(2)
40
- suggested_wait_value = (seconds + additional_took_delta).floor(2)
41
-
42
- if additional_exception || additional_block_value.nil?
43
- puts " ..did not help."
44
- else
45
- puts " ..setting wait to >#{suggested_wait_value} would help here?"
46
- end
47
-
48
- if exception
49
- raise exception
50
- else
51
- raise "capybara timed out"
52
- end
53
- end
54
-
55
- if block_value == false
56
- self.wait_formatted_output false, took_delta
57
- raise "wait condition was falsy"
58
- end
59
-
60
- if block_value == nil
61
- self.wait_formatted_output false, took_delta
62
- raise "wait condition was nil"
63
- end
64
-
65
- self.wait_formatted_output true, took_delta
66
- return block_value
67
- end
68
-
69
- def self.wait_formatted_output(status, took_delta)
70
- word, color = if status
71
- ["ok", :green]
72
- else
73
- ["FAIL", :red]
74
- end
75
-
76
- puts "#{word.colorize(color)} (took #{(took_delta)}s)"
77
- end
78
- end