awetestlib 0.1.30-x86-mingw32 → 1.2.4-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +101 -41
  3. data/awetestlib.gemspec +36 -47
  4. data/awetestlib_osx.gemspec +24 -18
  5. data/awetestlib_windows.gemspec +46 -0
  6. data/bin/awetestlib +130 -111
  7. data/bin/awetestlib-driver-setup.rb +0 -2
  8. data/bin/awetestlib-helpers.rb +43 -30
  9. data/lib/awetestlib.rb +196 -20
  10. data/lib/awetestlib/command_line.rb +44 -0
  11. data/lib/awetestlib/html_report.rb +57 -50
  12. data/lib/awetestlib/logging.rb +242 -171
  13. data/lib/awetestlib/regression/awetest_dsl.rb +4240 -0
  14. data/lib/awetestlib/regression/browser.rb +514 -397
  15. data/lib/awetestlib/regression/date_and_time.rb +280 -0
  16. data/lib/awetestlib/regression/drag_and_drop.rb +24 -0
  17. data/lib/awetestlib/regression/find.rb +70 -43
  18. data/lib/awetestlib/regression/legacy.rb +1 -1
  19. data/lib/awetestlib/regression/mobile.rb +293 -0
  20. data/lib/awetestlib/regression/reporting.rb +298 -0
  21. data/lib/awetestlib/regression/runner.rb +156 -200
  22. data/lib/awetestlib/regression/tables.rb +117 -7
  23. data/lib/awetestlib/regression/test_data.rb +354 -0
  24. data/lib/awetestlib/regression/user_input.rb +179 -93
  25. data/lib/awetestlib/regression/utilities.rb +755 -286
  26. data/lib/awetestlib/regression/validations.rb +325 -115
  27. data/lib/awetestlib/regression/waits.rb +60 -133
  28. data/lib/awetestlib/runner.rb +5 -2
  29. data/lib/version.rb +11 -2
  30. data/setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb +109 -49
  31. data/setup_samples/sample_mobile_app/features/support/env.rb +1 -1
  32. data/test/google_search2.rb +7 -6
  33. data/test/popup_child_0.rb +13 -0
  34. data/test/popup_child_1.rb +33 -0
  35. data/test/watir_no_require.rb +13 -0
  36. data/test/watir_with_require.rb +16 -0
  37. data/test/zoho_exercise.rb +8 -8
  38. metadata +216 -303
  39. data/AwetestLib Instructions.rtf +0 -0
  40. data/awetestlib.windows.gemspec +0 -42
  41. data/lib/patches/README +0 -2
  42. data/lib/patches/firewatir.rb +0 -106
  43. data/lib/patches/watir.rb +0 -175
Binary file
@@ -1,42 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require "lib/version"
3
-
4
- Gem::Specification.new do |s|
5
-
6
- s.name = %q{awetestlib}
7
- s.version = Awetestlib::VERSION
8
- s.date = Awetestlib::VERSION_DATE
9
- s.platform = Gem::Platform::CURRENT
10
-
11
- #s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.authors = ["Anthony Woo", "Patrick Neve"]
13
- s.email = %q{patrick@3qilabs.com}
14
- s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
15
- s.homepage = %q{http://3qilabs.com}
16
- s.description = %q{Awetest DSL for automated testing of browser-based applications.}
17
-
18
- s.add_dependency('watir-webdriver')
19
- s.add_dependency('watir', '1.8.1')
20
- s.add_dependency('commonwatir', '1.8.1')
21
- s.add_dependency('firewatir', '1.8.1')
22
- s.add_dependency('activesupport', '~> 3.0.0')
23
- s.add_dependency('i18n')
24
- s.add_dependency('andand')
25
- s.add_dependency('watirloo')
26
- s.add_dependency('win32-process', '0.6.6')
27
- s.add_dependency('win32screenshot')
28
- s.add_dependency('spreadsheet', '0.6.8')
29
- s.add_dependency('google-spreadsheet-ruby', '0.1.6')
30
- s.add_dependency('roo', '1.10.1')
31
- s.add_dependency('selenium-webdriver')
32
- s.add_dependency('pry')
33
- s.add_dependency('rdoc', '~> 3.11')
34
- s.add_dependency('cucumber')
35
- s.add_dependency('calabash-android', '0.4.3')
36
- s.add_dependency('sys-uname')
37
- s.require_paths = ["lib"]
38
- s.files = `git ls-files`.split("\n")
39
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
40
-
41
- end
42
-
data/lib/patches/README DELETED
@@ -1,2 +0,0 @@
1
- We put here small monkey patches to the gems we use.
2
- This is the easier path when we sometimes just need to override or add a few methods in a gem; we don't really need to fork it.
@@ -1,106 +0,0 @@
1
- module FireWatir
2
- class Firefox
3
-
4
- def close
5
-
6
- if js_eval("getWindows().length").to_i == 1
7
- js_eval("getWindows()[0].close()")
8
-
9
- if current_os == :macosx
10
- %x{ osascript -e 'tell application "Firefox" to quit' }
11
- end
12
-
13
- # wait for the app to close properly
14
- @t.join if @t
15
- else
16
- # Check if window exists, because there may be the case that it has been closed by click event on some element.
17
- # For e.g: Close Button, Close this Window link etc.
18
- window_number = find_window(:url, @window_url)
19
-
20
- # If matching window found. Close the window.
21
- if window_number.try(:>, 0)
22
- js_eval "getWindows()[#{window_number}].close()"
23
- end
24
-
25
- end
26
- end
27
-
28
-
29
-
30
- # Waits for the page to get loaded.
31
- def wait(last_url = nil)
32
- #puts "In wait function "
33
- isLoadingDocument = ""
34
- start = Time.now
35
-
36
- while isLoadingDocument != "false"
37
- # MONKEYPATCH - START
38
- isLoadingDocument = js_eval("#{browser_var}=#{window_var}.getBrowser(); #{browser_var}.webProgress.isLoadingDocument;") rescue return
39
- # MONKEYPATCH - END
40
- #puts "Is browser still loading page: #{isLoadingDocument}"
41
-
42
- # Raise an exception if the page fails to load
43
- if (Time.now - start) > 300
44
- raise "Page Load Timeout"
45
- end
46
- end
47
- # If the redirect is to a download attachment that does not reload this page, this
48
- # method will loop forever. Therefore, we need to ensure that if this method is called
49
- # twice with the same URL, we simply accept that we're done.
50
- url = js_eval("#{browser_var}.contentDocument.URL")
51
-
52
- if(url != last_url)
53
- # Check for Javascript redirect. As we are connected to Firefox via JSSh. JSSh
54
- # doesn't detect any javascript redirects so check it here.
55
- # If page redirects to itself that this code will enter in infinite loop.
56
- # So we currently don't wait for such a page.
57
- # wait variable in JSSh tells if we should wait more for the page to get loaded
58
- # or continue. -1 means page is not redirected. Anyother positive values means wait.
59
- jssh_command = "var wait = -1; var meta = null; meta = #{browser_var}.contentDocument.getElementsByTagName('meta');
60
- if(meta != null)
61
- {
62
- var doc_url = #{browser_var}.contentDocument.URL;
63
- for(var i=0; i< meta.length;++i)
64
- {
65
- var content = meta[i].content;
66
- var regex = new RegExp(\"^refresh$\", \"i\");
67
- if(regex.test(meta[i].httpEquiv))
68
- {
69
- var arrContent = content.split(';');
70
- var redirect_url = null;
71
- if(arrContent.length > 0)
72
- {
73
- if(arrContent.length > 1)
74
- redirect_url = arrContent[1];
75
-
76
- if(redirect_url != null)
77
- {
78
- regex = new RegExp(\"^.*\" + redirect_url + \"$\");
79
- if(!regex.test(doc_url))
80
- {
81
- wait = arrContent[0];
82
- }
83
- }
84
- break;
85
- }
86
- }
87
- }
88
- }
89
- wait;"
90
- wait_time = js_eval(jssh_command).to_i
91
- begin
92
- if(wait_time != -1)
93
- sleep(wait_time)
94
- # Call wait again. In case there are multiple redirects.
95
- js_eval "#{browser_var} = #{window_var}.getBrowser()"
96
- wait(url)
97
- end
98
- rescue
99
- end
100
- end
101
- set_browser_document()
102
- run_error_checks()
103
- return self
104
- end
105
- end
106
- end
data/lib/patches/watir.rb DELETED
@@ -1,175 +0,0 @@
1
- module Watir
2
-
3
- class IE
4
-
5
- ###################################
6
- def browser_screen_offset(browser)
7
- parent = page_container.document.parentWindow
8
- [parent.screenLeft.to_i,
9
- parent.screenTop.to_i]
10
- end
11
-
12
- end
13
-
14
- class Element
15
- # for watir element returns array of arrays where each element is a [name, value] as long as value is other than null or blank
16
- def get_attributes
17
- attrs = []
18
- self.document.attributes.each do |atr|
19
- k= []
20
- next if (atr.value == 'null') || (atr.value == '')
21
- k << atr.name << atr.value
22
- attrs << k
23
- end
24
- attrs.sort
25
- end
26
-
27
- ###################################
28
- def attribute_values
29
- hash = Hash.new
30
- ['id', # 'offsetParent', 'style', 'currentstyle',
31
- 'offsetHeight', 'offsetWidth', 'offsetLeft', 'offsetTop',
32
- 'clientHeight', 'clientWidth', 'clientLeft', 'clientTop',
33
- 'scrollHeight', 'scrollWidth', 'scrollLeft', 'scrollTop',
34
- 'className', 'resizable',
35
- 'visible', 'sourceIndex'].each do |attr|
36
- value = attribute_value(attr)
37
- myClass = value.class
38
- if myClass =~ /WIN32OLE/i or value.is_a?(WIN32OLE)
39
- meths = Hash.new
40
- value.ole_methods.each do |m|
41
- meths[m.name] = m.helpstring
42
- end
43
- hash[attr] = meths.sort
44
- else
45
- hash[attr] = value
46
- end
47
- end
48
- hash
49
- end
50
-
51
- ###################################
52
- def fetch_attributes
53
- assert_exists
54
- assert_enabled
55
- obj = ole_object
56
- hash = Hash.new
57
- methods = obj.ole_methods
58
- methods.each do |m|
59
- hash[m.name] = "visible: #{m.visible?}: #{m.helpstring}: #{m.invoke_kind}: #{m.params}: #{m.return_type}: #{m.return_type_detail}"
60
- end
61
- hash.sort.to_yaml
62
- end
63
-
64
- ###################################
65
- def bottom_edge
66
- assert_exists
67
- assert_enabled
68
- ole_object.getBoundingClientRect.bottom.to_i
69
- end
70
-
71
- ###################################
72
- def top_edge
73
- assert_exists
74
- assert_enabled
75
- ole_object.getBoundingClientRect.top.to_i
76
- end
77
-
78
- ###################################
79
- def top_edge_absolute
80
- top_edge + page_container.document.parentWindow.screenTop.to_i
81
- end
82
-
83
- ###################################
84
- def left_edge
85
- assert_exists
86
- assert_enabled
87
- ole_object.getBoundingClientRect.left.to_i
88
- end
89
-
90
- ###################################
91
- def right_edge
92
- assert_exists
93
- assert_enabled
94
- ole_object.getBoundingClientRect.right.to_i
95
- end
96
-
97
- ###################################
98
- def left_edge_absolute
99
- left_edge + page_container.document.parentWindow.screenLeft.to_i
100
- end
101
-
102
- ###################################
103
- def dimensions
104
- assert_exists
105
- assert_enabled
106
- x = ole_object.getBoundingClientRect.right.to_i - left_edge
107
- y = ole_object.getBoundingClientRect.bottom.to_i - top_edge
108
- [x, y]
109
- end
110
-
111
- ###################################
112
- def screen_offset
113
- [left_edge_absolute, top_edge_absolute]
114
- end
115
-
116
- ###################################
117
- def client_offset
118
- [left_edge, top_edge]
119
- end
120
-
121
- ###################################
122
- def client_center
123
- client_offset + dimensions.map { |dim| dim/2 }
124
- # x, y = client_offset
125
- # w, h = dimensions
126
- # cx = x + ( w / 2 ).to_i
127
- # cy = y + ( h / 2 ).to_i
128
- # [cx, cy]
129
- end
130
-
131
- ###################################
132
- def screen_center
133
- x, y = screen_offset
134
- w, h = dimensions
135
- cx = x + (w / 2).to_i
136
- cy = y + (h / 2).to_i
137
- [cx, cy]
138
- end
139
-
140
- ###################################
141
- def client_lower_right
142
- x, y = client_offset
143
- w, h = dimensions
144
- lrx = x + w
145
- lry = y + h
146
- [lrx, lry]
147
- end
148
-
149
- ###################################
150
- def screen_lower_right
151
- x, y = screen_offset
152
- w, h = dimensions
153
- lrx = x + w
154
- lry = y + h
155
- [lrx, lry]
156
- end
157
-
158
- ###################################
159
- def bounding_rectangle_offsets
160
- l, t = client_offset
161
- r = ole_object.getBoundingClientRect.right.to_i
162
- b = ole_object.getBoundingClientRect.bottom.to_i
163
- [t, b, l, r]
164
- end
165
-
166
-
167
- end
168
-
169
- #class NonControlElement
170
- # class Ol < NonControlElement
171
- # TAG = 'OL'
172
- # end
173
- #end
174
-
175
- end