testable 0.3.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +37 -25
- data/.hound.yml +31 -12
- data/.rubocop.yml +4 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +3 -1
- data/{LICENSE.txt → LICENSE.md} +2 -2
- data/README.md +36 -17
- data/Rakefile +52 -11
- data/bin/console +2 -2
- data/bin/setup +0 -0
- data/examples/testable-capybara-context.rb +64 -0
- data/examples/testable-capybara-rspec.rb +70 -0
- data/examples/testable-capybara.rb +46 -0
- data/examples/testable-info.rb +65 -0
- data/examples/testable-watir-context.rb +67 -0
- data/examples/testable-watir-datasetter.rb +52 -0
- data/examples/testable-watir-events.rb +44 -0
- data/examples/testable-watir-ready.rb +34 -0
- data/examples/testable-watir-test.rb +80 -0
- data/examples/testable-watir.rb +118 -0
- data/lib/testable.rb +142 -10
- data/lib/testable/attribute.rb +38 -0
- data/lib/testable/capybara/dsl.rb +82 -0
- data/lib/testable/capybara/node.rb +30 -0
- data/lib/testable/capybara/page.rb +29 -0
- data/lib/testable/context.rb +73 -0
- data/lib/testable/deprecator.rb +40 -0
- data/lib/testable/element.rb +162 -31
- data/lib/testable/errors.rb +6 -2
- data/lib/testable/extensions/core_ruby.rb +13 -0
- data/lib/testable/extensions/data_setter.rb +144 -0
- data/lib/testable/extensions/dom_observer.js +58 -4
- data/lib/testable/extensions/dom_observer.rb +73 -0
- data/lib/testable/locator.rb +63 -0
- data/lib/testable/logger.rb +16 -0
- data/lib/testable/page.rb +216 -0
- data/lib/testable/ready.rb +49 -7
- data/lib/testable/situation.rb +9 -28
- data/lib/testable/version.rb +7 -6
- data/testable.gemspec +19 -9
- metadata +90 -23
- data/circle.yml +0 -3
- data/lib/testable/data_setter.rb +0 -51
- data/lib/testable/dom_update.rb +0 -19
- data/lib/testable/factory.rb +0 -27
- data/lib/testable/interface.rb +0 -114
data/lib/testable/interface.rb
DELETED
@@ -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
|