testable 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Nyman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-03 00:00:00.000000000 Z
11
+ date: 2019-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.13'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.13'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rubocop
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,42 @@ dependencies:
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '6.0'
103
+ version: '6.4'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '6.4'
111
+ - !ruby/object:Gem::Dependency
112
+ name: capybara
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.0'
90
118
  type: :runtime
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
- version: '6.0'
124
+ version: '3.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: webdrivers
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '4.0'
97
139
  description: Provides a semantic DSL to construct fluent interfaces for test execution
98
140
  logic.
99
141
  email:
@@ -106,22 +148,31 @@ files:
106
148
  - ".hound.yml"
107
149
  - ".rspec"
108
150
  - ".rubocop.yml"
151
+ - ".travis.yml"
109
152
  - CODE_OF_CONDUCT.md
110
153
  - Gemfile
111
- - LICENSE.txt
154
+ - LICENSE.md
112
155
  - README.md
113
156
  - Rakefile
114
157
  - bin/console
115
158
  - bin/setup
116
- - circle.yml
159
+ - examples/testable-info.rb
160
+ - examples/testable-watir-context.rb
161
+ - examples/testable-watir-datasetter.rb
162
+ - examples/testable-watir-events.rb
163
+ - examples/testable-watir-ready.rb
164
+ - examples/testable-watir-test.rb
165
+ - examples/testable-watir.rb
117
166
  - lib/testable.rb
118
- - lib/testable/data_setter.rb
119
- - lib/testable/dom_update.rb
167
+ - lib/testable/attribute.rb
168
+ - lib/testable/context.rb
120
169
  - lib/testable/element.rb
121
170
  - lib/testable/errors.rb
171
+ - lib/testable/extensions/data_setter.rb
122
172
  - lib/testable/extensions/dom_observer.js
123
- - lib/testable/factory.rb
124
- - lib/testable/interface.rb
173
+ - lib/testable/extensions/dom_observer.rb
174
+ - lib/testable/locator.rb
175
+ - lib/testable/page.rb
125
176
  - lib/testable/ready.rb
126
177
  - lib/testable/situation.rb
127
178
  - lib/testable/version.rb
@@ -129,9 +180,12 @@ files:
129
180
  homepage: https://github.com/jeffnyman/testable
130
181
  licenses:
131
182
  - MIT
132
- metadata: {}
183
+ metadata:
184
+ homepage_uri: https://github.com/jeffnyman/testable
185
+ source_code_uri: https://github.com/jeffnyman/testable
186
+ changelog_uri: https://github.com/jeffnyman/testable/blob/master/CHANGELOG.md
133
187
  post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n
134
- \ Testable 0.3.0 has been installed.\n(::) (::) (::) (::) (::) (::) (::) (::) (::)
188
+ \ Testable 0.4.0 has been installed.\n(::) (::) (::) (::) (::) (::) (::) (::) (::)
135
189
  (::) (::) (::)\n "
136
190
  rdoc_options: []
137
191
  require_paths:
@@ -147,10 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
201
  - !ruby/object:Gem::Version
148
202
  version: '0'
149
203
  requirements: []
150
- rubyforge_project:
151
- rubygems_version: 2.5.1
204
+ rubygems_version: 3.0.4
152
205
  signing_key:
153
206
  specification_version: 4
154
- summary: Provides a semantic DSL to construct fluent interfaces for test execution
155
- logic.
207
+ summary: Web and API Automation, using Capybara and Watir
156
208
  test_files: []
data/circle.yml DELETED
@@ -1,3 +0,0 @@
1
- checkout:
2
- post:
3
- - mkdir -p spec/reports
@@ -1,51 +0,0 @@
1
- class Object
2
- def chain(method_chain, arg = nil)
3
- return self if method_chain.empty?
4
- method_chain.split('.').inject(self) do |o, m|
5
- if arg.nil?
6
- o.send(m.intern)
7
- else
8
- o.send(m.intern, arg)
9
- end
10
- end
11
- end
12
- end
13
-
14
- module Testable
15
- module DataSetter
16
- def using(data)
17
- data.each do |key, value|
18
- use_data_with(key, value) if object_enabled_for(key)
19
- end
20
- end
21
-
22
- alias using_data using
23
- alias use_data using
24
- alias using_values using
25
- alias use_values using
26
-
27
- private
28
-
29
- def use_data_with(key, value)
30
- element = send(key.to_s)
31
- set_and_select(key, element, value)
32
- check_and_uncheck(key, element, value)
33
- end
34
-
35
- def set_and_select(key, element, value)
36
- chain("#{key}.set", value) if element.class == Watir::TextField
37
- chain("#{key}.set") if element.class == Watir::Radio
38
- chain("#{key}.select", value) if element.class == Watir::Select
39
- end
40
-
41
- def check_and_uncheck(key, element, value)
42
- return chain("#{key}.check") if element.class == Watir::CheckBox && value
43
- chain("#{key}.uncheck") if element.class == Watir::CheckBox
44
- end
45
-
46
- def object_enabled_for(key)
47
- web_element = send(key.to_s)
48
- web_element.enabled? && web_element.visible?
49
- end
50
- end
51
- end
@@ -1,19 +0,0 @@
1
- module Watir
2
- class Element
3
- OBSERVER_FILE = "/extensions/dom_observer.js".freeze
4
- DOM_OBSERVER = File.read("#{File.dirname(__FILE__)}#{OBSERVER_FILE}").freeze
5
-
6
- def dom_updated?(delay: 1.1)
7
- driver.manage.timeouts.script_timeout = delay + 1
8
- driver.execute_async_script(DOM_OBSERVER, wd, delay)
9
- ensure
10
- driver.manage.timeouts.script_timeout = 1
11
- end
12
-
13
- alias dom_updated dom_updated?
14
- alias dom_is_updated dom_updated?
15
- alias dom_is_changed dom_updated?
16
- alias when_dom_updated dom_updated?
17
- alias when_dom_changed dom_updated?
18
- end
19
- end
@@ -1,27 +0,0 @@
1
- module Testable
2
- module Factory
3
- # Creates a definition context for actions. If an existing context
4
- # exists, that context will be re-used.
5
- def on(definition, visit = false, &block)
6
- unless @context.is_a?(definition)
7
- @context = definition.new(@browser) if @browser
8
- @context = definition.new unless @browser
9
- @context.visit if visit
10
- end
11
-
12
- yield @context if block
13
- @context
14
- end
15
-
16
- alias on_page on
17
- alias while_on on
18
-
19
- # Creates a definition context for actions and establishes the
20
- # context for execution.
21
- def on_view(definition, &block)
22
- on(definition, true, &block)
23
- end
24
-
25
- alias on_visit on_view
26
- end
27
- end
@@ -1,114 +0,0 @@
1
- require "testable/situation"
2
-
3
- module Testable
4
- module Interface
5
- module Page
6
- module Attribute
7
- include Situation
8
- def url_is(url = nil)
9
- url_is_empty if url.nil? || url.empty?
10
- @url = url
11
- end
12
-
13
- def url_matches(pattern = nil)
14
- url_match_is_empty if pattern.nil?
15
- url_match_is_empty if pattern.is_a?(String) && pattern.empty?
16
- @url_match = pattern
17
- end
18
-
19
- def title_is(title)
20
- title_is_empty if title.nil? || title.empty?
21
- @title = title
22
- end
23
-
24
- def url_attribute
25
- @url
26
- end
27
-
28
- def url_match_attribute
29
- @url_match || url_attribute
30
- end
31
-
32
- def title_attribute
33
- @title
34
- end
35
- end
36
-
37
- def visit(url = nil)
38
- no_url_provided if url.nil? && url_attribute.nil?
39
- @browser.goto(url) unless url.nil?
40
- @browser.goto(url_attribute) if url.nil?
41
- self
42
- end
43
-
44
- alias view visit
45
- alias navigate_to visit
46
- alias goto visit
47
- alias perform visit
48
-
49
- def url
50
- @browser.url
51
- end
52
-
53
- alias page_url url
54
- alias current_url url
55
-
56
- def title
57
- @browser.title
58
- end
59
-
60
- alias page_title title
61
-
62
- def markup
63
- browser.html
64
- end
65
-
66
- alias html markup
67
-
68
- def text
69
- browser.text
70
- end
71
-
72
- alias page_text text
73
-
74
- def resize(width, height)
75
- browser.window.resize_to(width, height)
76
- end
77
-
78
- alias resize_to resize
79
-
80
- def secure?
81
- !url.match(/^https/).nil?
82
- end
83
-
84
- def url_match_attribute
85
- value = self.class.url_match_attribute
86
- return if value.nil?
87
- value = Regexp.new(value) unless value.is_a?(Regexp)
88
- value
89
- end
90
-
91
- def has_correct_url?
92
- if url_attribute.nil? && url_match_attribute.nil?
93
- no_url_match_is_possible
94
- end
95
- !(url =~ url_match_attribute).nil?
96
- end
97
-
98
- alias displayed? has_correct_url?
99
-
100
- def has_correct_title?
101
- no_title_is_provided if title_attribute.nil?
102
- !title.match(title_attribute).nil?
103
- end
104
-
105
- def url_attribute
106
- self.class.url_attribute
107
- end
108
-
109
- def title_attribute
110
- self.class.title_attribute
111
- end
112
- end
113
- end
114
- end