edsl-pageobject 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/edsl/page_object/ajax_support.rb +4 -1
- data/lib/edsl/page_object/page.rb +7 -0
- data/lib/edsl/page_object/population.rb +16 -3
- data/lib/edsl/page_object/section.rb +1 -1
- data/lib/edsl/page_object/version.rb +1 -1
- data/lib/edsl/page_object/visitation.rb +3 -0
- 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: 98a7fde84b1d4f6260a0f5a2a527f448611f2bd1fe9b4c42e690015007ccca41
|
4
|
+
data.tar.gz: b5a6ab56fb8d2546e6069d57f7481e7e0dc3a593ef4b54a45ad92e337f6be9a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e833a978ec0d86e1008bffd70cec05b3405c9397bc756c712e4d1f6ac498569f6eb6dbdcff04620348c1594e8060a33bac057a17f428006a998131c7f9ebff6
|
7
|
+
data.tar.gz: 944524ffa17c0a442f630127b0fd2e401344dbb5e2b4fcc64b4bf90b90942726fcf26e74e74d967f068f68ed70c1199f78cef3a225b05b33b93d2b76b25a0710
|
@@ -89,7 +89,10 @@ module EDSL
|
|
89
89
|
def wait_for_ajax(timeout = 30, message = nil)
|
90
90
|
end_time = ::Time.now + timeout
|
91
91
|
until ::Time.now > end_time
|
92
|
-
|
92
|
+
begin
|
93
|
+
return if browser.execute_script(::EDSL::PageObject::JavascriptFrameworkFacade.pending_requests) == 0
|
94
|
+
rescue Selenium::WebDriver::Error::UnknownError, Selenium::WebDriver::Error::JavascriptError
|
95
|
+
end
|
93
96
|
sleep 0.5
|
94
97
|
end
|
95
98
|
message = "Timed out waiting for ajax requests to complete" unless message
|
@@ -53,6 +53,13 @@ module EDSL
|
|
53
53
|
def _ready?
|
54
54
|
true
|
55
55
|
end
|
56
|
+
|
57
|
+
def leave_page_using(method, expected_url = nil)
|
58
|
+
cur_url = browser.url
|
59
|
+
method.call if method.is_a?(Proc)
|
60
|
+
send(method) unless method.is_a?(Proc)
|
61
|
+
Watir::Wait.until { expected_url ? browser.url == expected_url : browser.url != cur_url }
|
62
|
+
end
|
56
63
|
end
|
57
64
|
end
|
58
65
|
end
|
@@ -2,10 +2,17 @@ require 'facets/string'
|
|
2
2
|
|
3
3
|
module EDSL
|
4
4
|
module PageObject
|
5
|
+
|
6
|
+
def self.fixture_cache
|
7
|
+
@@cache ||= {}
|
8
|
+
end
|
9
|
+
|
5
10
|
# This module serves as a mixin for element container to support populating their
|
6
11
|
# fields via a hash.
|
7
12
|
module Population
|
8
13
|
|
14
|
+
|
15
|
+
|
9
16
|
# This method allows you to specify a function to be used to fetch fixture data,
|
10
17
|
# given a key. The value passed should either be a proc, or a method name for send.
|
11
18
|
#
|
@@ -30,8 +37,10 @@ module EDSL
|
|
30
37
|
# @param key [String, Symbol] What to fetch
|
31
38
|
def fixture_fetch(key)
|
32
39
|
ff = EDSL::PageObject::Population.fixture_fetcher
|
33
|
-
|
34
|
-
send(ff, key)
|
40
|
+
data = ff.call(key) if ff.is_a?(Proc)
|
41
|
+
data = send(ff, key) unless ff.is_a?(Proc)
|
42
|
+
EDSL::PageObject.fixture_cache[key] = data
|
43
|
+
data
|
35
44
|
end
|
36
45
|
|
37
46
|
# This method will populate the various elements within a container, using a hash.
|
@@ -55,7 +64,11 @@ module EDSL
|
|
55
64
|
data = data.fetch(populate_key, data)
|
56
65
|
data = data.fetch(populate_key.to_sym, data)
|
57
66
|
data.each do |k, v|
|
58
|
-
|
67
|
+
begin
|
68
|
+
send("#{k}=", v) if respond_to?("#{k}=")
|
69
|
+
rescue Exception => ex
|
70
|
+
raise "#{ex.message} raised with setting #{k}"
|
71
|
+
end
|
59
72
|
end
|
60
73
|
end
|
61
74
|
|
@@ -30,7 +30,7 @@ module EDSL
|
|
30
30
|
EDSL.extend_dsl {
|
31
31
|
def section(name, section_class, opts)
|
32
32
|
element(name, { how: :div, assign_method: :populate_with,
|
33
|
-
wrapper_fn: lambda { |element,
|
33
|
+
wrapper_fn: lambda { |element, container| section_class.new(element, container) } }.merge(opts))
|
34
34
|
end
|
35
35
|
|
36
36
|
alias_method :page_section, :section
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'page_navigation'
|
2
|
+
|
1
3
|
module EDSL
|
2
4
|
module PageObject
|
3
5
|
module Visitable
|
@@ -36,6 +38,7 @@ module EDSL
|
|
36
38
|
|
37
39
|
# Most of this is a semi-direct copy from PageObject::PageFactory
|
38
40
|
module Visitation
|
41
|
+
include PageNavigation
|
39
42
|
#
|
40
43
|
# Create and navigate to a page object. The navigation will only work if the
|
41
44
|
# 'page_url' method was call on the page object.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edsl-pageobject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donavan Stanley
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|