testable 0.3.0 → 0.8.0

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