awetestlib 0.1.3-x86-mingw32 → 0.1.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/awetestlib.windows.gemspec +1 -1
  2. data/bin/awetestlib +11 -4
  3. data/bin/awetestlib-helpers.rb +28 -1
  4. data/bin/awetestlib-netbeans-setup.rb +39 -0
  5. data/bin/awetestlib-rubymine-setup.rb +33 -0
  6. data/images/logo.png +0 -0
  7. data/lib/awetestlib/html_report.rb +171 -0
  8. data/lib/{regression → awetestlib}/logging.rb +10 -43
  9. data/lib/awetestlib/regression/browser.rb +1233 -0
  10. data/lib/awetestlib/regression/drag_and_drop.rb +379 -0
  11. data/lib/awetestlib/regression/find.rb +431 -0
  12. data/lib/awetestlib/regression/legacy.rb +45 -0
  13. data/lib/awetestlib/regression/page_data.rb +190 -0
  14. data/lib/awetestlib/regression/runner.rb +306 -0
  15. data/lib/awetestlib/regression/tables.rb +491 -0
  16. data/lib/awetestlib/regression/user_input.rb +1256 -0
  17. data/lib/awetestlib/regression/utilities.rb +895 -0
  18. data/lib/awetestlib/regression/validations.rb +1184 -0
  19. data/lib/awetestlib/regression/waits.rb +391 -0
  20. data/lib/awetestlib/runner.rb +16 -0
  21. data/lib/awetestlib.rb +4 -4
  22. data/lib/version.rb +2 -2
  23. data/setup_samples/sample_netbeans/demo.rb +86 -0
  24. data/setup_samples/sample_netbeans/nbproject/configs/Demo.properties +2 -0
  25. data/setup_samples/sample_netbeans/nbproject/private/config.properties +1 -0
  26. data/setup_samples/sample_netbeans/nbproject/private/configs/Demo.properties +1 -0
  27. data/setup_samples/sample_netbeans/nbproject/private/private.properties +2 -0
  28. data/setup_samples/sample_netbeans/nbproject/project.properties +5 -0
  29. data/setup_samples/sample_netbeans/nbproject/project.xml +13 -0
  30. data/setup_samples/sample_rubymine/.idea/.name +1 -0
  31. data/setup_samples/sample_rubymine/.idea/encodings.xml +5 -0
  32. data/setup_samples/sample_rubymine/.idea/misc.xml +5 -0
  33. data/setup_samples/sample_rubymine/.idea/modules.xml +9 -0
  34. data/setup_samples/sample_rubymine/.idea/sample_rubymine.iml +9 -0
  35. data/setup_samples/sample_rubymine/.idea/scopes/scope_settings.xml +5 -0
  36. data/setup_samples/sample_rubymine/.idea/vcs.xml +7 -0
  37. data/setup_samples/sample_rubymine/.idea/workspace.xml +213 -0
  38. data/setup_samples/sample_rubymine/demo.rb +86 -0
  39. metadata +44 -19
  40. data/lib/regression/browser.rb +0 -1259
  41. data/lib/regression/drag_and_drop.rb +0 -374
  42. data/lib/regression/find.rb +0 -426
  43. data/lib/regression/legacy.rb +0 -40
  44. data/lib/regression/page_data.rb +0 -185
  45. data/lib/regression/runner.rb +0 -278
  46. data/lib/regression/tables.rb +0 -486
  47. data/lib/regression/user_input.rb +0 -1255
  48. data/lib/regression/utilities.rb +0 -891
  49. data/lib/regression/validations.rb +0 -1179
  50. data/lib/regression/waits.rb +0 -387
@@ -1,278 +0,0 @@
1
- require 'regression/browser'
2
- require 'regression/find'
3
- require 'regression/user_input'
4
- require 'regression/waits'
5
- require 'regression/tables'
6
- require 'regression/page_data'
7
- require 'regression/drag_and_drop'
8
- require 'regression/utilities'
9
- require 'regression/logging'
10
- require 'regression/validations'
11
-
12
- #require 'rbconfig'
13
- require 'ostruct'
14
- require 'active_support'
15
- require 'active_support/inflector'
16
-
17
- module Awetestlib
18
-
19
- class Runner
20
-
21
- # order matters here
22
- include Logging
23
- include Browser
24
- include Find
25
- include UserInput
26
- include Waits
27
- include Tables
28
- include PageData
29
- include DragAndDrop
30
- include Utilities
31
- include Validations
32
-
33
- ::DEBUG = 0
34
- ::INFO = 1
35
- ::WARN = 2
36
- ::ERROR = 3
37
- ::FATAL = 4
38
- ::UNKNOWN = 5
39
-
40
- ::TOP_LEVEL = 7
41
- ::SECOND_LEVEL = ::TOP_LEVEL - 1
42
-
43
- ::WAIT = 20
44
- ::PASS = '-PASS'
45
- ::FAIL = '-FAIL'
46
-
47
- puts ENV["OS"]
48
-
49
- attr_accessor :browser, :browser_abbrev, :version, :env,
50
- :library, :script_type, :script_file,
51
- :log_properties, :log_queue, :log_class,
52
- :notify_queue, :notify_class, :notify_id,
53
- :screencap_path, :xls_path, :script_path, :user_token, :root_path,
54
- :debug_on_fail,
55
- :environment, :environment_name, :environment_url, :environment_nodename,
56
- :cycle, :browser_sequence,
57
- :output_to_log, :log_path_subdir, :report_all_test_refs,
58
- :timeout
59
-
60
- #def self.build(options)
61
- # #build_class = "Awetestlib::#{script_module_for options[:script_type]}::Runner".constantize
62
- # build_class = "Awetestlib::Runner".constantize
63
- # #options = options.merge(:script_file => options[:script_file])
64
- # #if build_class.respond_to?(:runner_class)
65
- # # build_class.runner_class(options)
66
- # #else
67
- # build_class.new(options)
68
- # #end
69
- #end
70
-
71
- # TODO: Encapsulate in some kind of config
72
- ###################################
73
- def setup_global_test_vars(options)
74
- @my_failed_count = 0
75
- @my_passed_count = 0
76
- @my_error_references = Hash.new
77
- @my_error_hits = Hash.new
78
-
79
- @report_all_refs = options[:report_all_test_refs]
80
-
81
- if options[:environment]
82
- @myAppEnv = OpenStruct.new(
83
- :name => options[:environment]['name'],
84
- :url => options[:environment]['url'],
85
- :nodename => options[:environment]['nodename']
86
- )
87
- @runenv = options[:environment]['nodename'] || options[:environment]['name']
88
- @myURL = options[:environment]['url']
89
- else
90
- @runenv = options[:environment_name]
91
- end
92
-
93
- @targetBrowser = browser_to_use(options[:browser], options[:version])
94
- @targetVersion = @targetBrowser.version
95
- @browserAbbrev = @targetBrowser.abbrev
96
- @myRoot = options[:root_path]
97
- @myName = File.basename(options[:script_file]).sub(/\.rb$/, '')
98
-
99
- if options[:output_to_log]
100
- log_path = "#{@myRoot}/"
101
- log_path << "#{options[:log_path_subdir]}/" if options[:log_path_subdir]
102
- log_spec = File.join log_path, "#{@myName}_#{Time.now.strftime("%Y%m%d%H%M%S")}.log"
103
- @myLog = init_logger(log_spec, @myName)
104
- #@start_timestamp = Time.now
105
- #start_to_log(@start_timestamp)
106
- end
107
-
108
- if options[:xls_path]
109
- @xls_path = options[:xls_path]
110
- end
111
-
112
- #TODO need to find way to calculate these on the fly
113
- # window top border 30
114
- # IE toolbars 86
115
- @vertical_hack_ie = 117
116
- # FF toolbars 114
117
- @vertical_hack_ff = 144
118
- # window left border 4
119
- @horizontal_hack_ie = 5
120
- @horizontal_hack_ff = 4
121
- #
122
- # @x_tolerance = 12
123
- # @y_tolerance = 12
124
- require_gems
125
- end
126
-
127
- #def self.runner_class(options)
128
- # script_file = options[:script_file]
129
- # load script_file # force a load
130
- #
131
- # runner_module = self.module_for script_file
132
- # klass_name = "#{runner_module.to_s}::Runner"
133
- #
134
- # # Define a Runner class in the test script's module inheriting from AwetestLegacy::Runner
135
- # runner_module.module_eval do
136
- # eval <<-RUBY
137
- # class #{klass_name} < Awetestlib::Runner
138
- # def initialize(options)
139
- # #super(options)
140
- # setup_global_test_vars(options)
141
- # end
142
- # end
143
- # RUBY
144
- # end
145
- #
146
- # runner = runner_module::Runner.new(options)
147
- #
148
- # if options[:library]
149
- # lib_file = options[:library]
150
- # load lib_file
151
- # lib_module = self.module_for lib_file
152
- # runner.extend(lib_module)
153
- # end
154
- #
155
- # # Add in the methods defined in the script's module
156
- # runner.extend(runner_module)
157
- # runner
158
- #end
159
-
160
- def initialize(options)
161
- options.each_pair do |k, v|
162
- self.send("#{k}=", v)
163
- end
164
- setup_global_test_vars(options)
165
-
166
- # load and extend with library module if it exists
167
- if options[:library]
168
- lib_file = options[:library]
169
- load lib_file # force a fresh load
170
- lib_module = module_for lib_file
171
- self.extend(lib_module)
172
- end
173
-
174
- # load and extend with script
175
- script_file = options[:script_file]
176
- load script_file # force a fresh load
177
- runner_module = module_for script_file
178
- self.extend(runner_module)
179
-
180
- end
181
-
182
- def browser_to_use(browser, browser_version = nil)
183
- platform = ''
184
- platform = 'Windows' if !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) || (RUBY_PLATFORM =~ /mswin|mingw/))
185
- platform = 'OSX' if RUBY_PLATFORM =~ /darwin/
186
-
187
- browser_abbrev =
188
- Awetestlib::BROWSER_ALTERNATES[platform][browser] ?
189
- Awetestlib::BROWSER_ALTERNATES[platform][browser] : browser
190
- if not browser_version
191
- case browser_abbrev
192
- when 'IE'
193
- browser_version = 8
194
- when 'FF'
195
- browser_version = 11
196
- when 'C', 'GC'
197
- browser_version = 10
198
- when 'S'
199
- browser_version = 10
200
- end
201
- end
202
- return OpenStruct.new(
203
- :name => (Awetestlib::BROWSER_MAP[browser_abbrev]),
204
- :abbrev => browser_abbrev,
205
- :version => browser_version
206
- )
207
- end
208
-
209
- def require_gems
210
-
211
- case @targetBrowser.abbrev
212
-
213
- when 'IE'
214
- if version.to_f >= 9.0
215
- require 'watir-webdriver'
216
- else
217
- require 'watir/ie'
218
- require 'watir'
219
- require 'watir/process'
220
- require 'watirloo'
221
- require 'patches/watir'
222
- Watir::IE.visible = true
223
- end
224
- when 'FF'
225
- if @targetBrowser.version.to_f < 4.0
226
- require 'firewatir'
227
- require 'patches/firewatir'
228
- else
229
- require 'watir-webdriver'
230
- end
231
-
232
- when 'S'
233
- require 'safariwatir'
234
-
235
- when 'C', 'GC'
236
- require 'watir-webdriver'
237
-
238
- # when 'CL'
239
- # require 'celerity'
240
- # require 'watir-webdriver'
241
-
242
- end
243
-
244
- if USING_WINDOWS
245
- require 'watir/win32ole'
246
- @ai = ::WIN32OLE.new('AutoItX3.Control')
247
- require 'pry'
248
- else
249
- # TODO: Need alternative for Mac?
250
- @ai = ''
251
- end
252
-
253
- end
254
-
255
- def module_for(script_file)
256
- File.read(script_file).match(/^module\s+(\w+)/)[1].constantize
257
- end
258
-
259
- def before_run
260
- start_run
261
- end
262
-
263
- def start
264
- before_run
265
- run
266
- rescue Exception => e
267
- failed_to_log(e.to_s)
268
- ensure
269
- after_run
270
- end
271
-
272
- def after_run
273
- finish_run
274
- @myLog.close if @myLog
275
- end
276
-
277
- end
278
- end