capybara_spa 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/lib/capybara_spa.rb +4 -0
- data/lib/capybara_spa/capybara_dsl_ext.rb +14 -9
- data/lib/capybara_spa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51d25cae7ab75d66e5440b5c030015abc9d1ecdd87e97fbe75cef68831f281a5
|
4
|
+
data.tar.gz: 9c0a896822259b9179b27118a07483156d5e4f185ced4292f5fbac99427bc5bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c33f624ba50bbd390392e8964b7091ee920142bef13eebb8cdea8d9ebbc64b16c480fab1337c184c216f537ca52547d87a59523bbd22103e332841721fab3e
|
7
|
+
data.tar.gz: a87ee063812891af220e8a7888838ce20852f04e4833ccf731ba9dd09d5cf258e08f68843f2674e91a6500a5ef7ab3275d094c9bf1908bdeb36ccdaf7ff76197
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
capybara_spa (0.
|
4
|
+
capybara_spa (0.6.0)
|
5
5
|
capybara (~> 3.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
io-like (~> 0.3.0)
|
14
14
|
bump (0.6.0)
|
15
15
|
byebug (10.0.2)
|
16
|
-
capybara (3.
|
16
|
+
capybara (3.8.1)
|
17
17
|
addressable
|
18
18
|
mini_mime (>= 0.1.3)
|
19
19
|
nokogiri (~> 1.8)
|
@@ -32,7 +32,7 @@ GEM
|
|
32
32
|
io-like (0.3.0)
|
33
33
|
json (2.1.0)
|
34
34
|
method_source (0.9.0)
|
35
|
-
mini_mime (1.0.
|
35
|
+
mini_mime (1.0.1)
|
36
36
|
mini_portile2 (2.3.0)
|
37
37
|
nokogiri (1.8.2)
|
38
38
|
mini_portile2 (~> 2.3.0)
|
@@ -42,7 +42,7 @@ GEM
|
|
42
42
|
pry-byebug (3.6.0)
|
43
43
|
byebug (~> 10.0)
|
44
44
|
pry (~> 0.10)
|
45
|
-
public_suffix (3.0.
|
45
|
+
public_suffix (3.0.3)
|
46
46
|
rack (2.0.5)
|
47
47
|
rack-test (1.1.0)
|
48
48
|
rack (>= 1.0, < 3)
|
data/lib/capybara_spa.rb
CHANGED
@@ -7,6 +7,10 @@ module CapybaraSpa
|
|
7
7
|
# +log_file+ where to log the output of angular-http-server. Defaults to /dev/null \
|
8
8
|
# This can be set thru the SPA_LOG_FILE environment variable.
|
9
9
|
attr_accessor :log_file
|
10
|
+
|
11
|
+
# +single_page_app_found+ stores whether or not the single page app has been found. \
|
12
|
+
# It will be a falsy value if not found and true when found.
|
13
|
+
attr_accessor :single_page_app_found
|
10
14
|
end
|
11
15
|
|
12
16
|
self.app_tag = ENV.fetch('SPA_APP_TAG', 'app-root')
|
@@ -3,31 +3,36 @@ require 'capybara/dsl'
|
|
3
3
|
module Capybara
|
4
4
|
module DSL
|
5
5
|
def page
|
6
|
-
|
6
|
+
wait_until_single_page_app_is_found unless @ignoring_single_page_app
|
7
7
|
Capybara.current_session
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
return if
|
10
|
+
def wait_until_single_page_app_is_found
|
11
|
+
return if CapybaraSpa.single_page_app_found
|
12
12
|
|
13
|
-
|
13
|
+
single_page_app_found = false
|
14
14
|
|
15
15
|
loop do
|
16
16
|
Capybara.current_session.visit('/')
|
17
17
|
app_tag = CapybaraSpa.app_tag
|
18
|
-
|
18
|
+
single_page_app_found = Capybara.current_session.evaluate_script <<-JAVASCRIPT
|
19
19
|
document.getElementsByTagName('#{app_tag}').length === 1
|
20
20
|
JAVASCRIPT
|
21
|
-
|
21
|
+
CapybaraSpa.single_page_app_found = single_page_app_found
|
22
|
+
break if CapybaraSpa.single_page_app_found
|
22
23
|
sleep 0.25
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
26
|
-
def ignoring_angular
|
27
|
-
|
27
|
+
def ignoring_angular(&block)
|
28
|
+
ignoring_single_page_app(&block)
|
29
|
+
end
|
30
|
+
|
31
|
+
def ignoring_single_page_app(&block)
|
32
|
+
@ignoring_single_page_app = true
|
28
33
|
yield
|
29
34
|
ensure
|
30
|
-
@
|
35
|
+
@ignoring_single_page_app = false
|
31
36
|
end
|
32
37
|
end
|
33
38
|
end
|
data/lib/capybara_spa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara_spa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Dennis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|