awetestlib 0.1.5-x86-mingw32 → 0.1.6-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ Awetestlib
2
+ ==========
3
+
4
+ Run automated regression and mobile tests
5
+
6
+ After completing this guide you will be able to run tests locally from command line or from an IDE
7
+
8
+ ------------
9
+
10
+ ### Prerequisites
11
+
12
+ You need to have Ruby 1.8.7 installed. You can download Ruby 1.8.7
13
+ [here](http://http://rubyinstaller.org/downloads/)
14
+
15
+ Additionally, you will need to install DevKit to compile a few dependent gems. You can download DevKit
16
+ [here](http://http://rubyinstaller.org/downloads/)
17
+
18
+ ### Install
19
+
20
+ 1. In a terminal or command prompt, install the awetestlib gem
21
+ - `gem install awetestlib --no-ri --no-rdoc`
22
+
23
+
24
+ 2. To setup the regression module, run the following command and verify the step
25
+ - `awetestlib regression_setup`
26
+
27
+ ### Usage
28
+
29
+ 1. Run the following command to see the different usages
30
+ - `awetestlib`
31
+
32
+ 2. To setup the awetestlib gem with Netbeans or Rubymine, run either of the commands
33
+ - `awetestlib rubymine_setup`
34
+
35
+ or
36
+ - `awetestlib netbeans_setup`
37
+
38
+ You can now start your scripts within the IDE. Use the Run Configuration button.
39
+
40
+ 3. If you prefer to run your tests from command line, you can use the following command
41
+ - `awetestlib <script_file> [parameters]`
42
+
43
+ For example: To run a script named demo.rb in Firefox, your command will look like.
44
+ - `awetestlib demo.rb -b FF`
45
+
46
+ The full list of parameters for the command line currently are:
47
+
48
+ Usage: awetestlib <script_file> [parameters] [options]
49
+ -b, --browser BROWSER Specify a browser (IE, FF, S, C)
50
+ -l, --library LIBRARY Specify a library to be loaded
51
+ -r, --root_path ROOT_PATH Specify the root path
52
+ -x, --excel EXCEL_FILE Specify an excel file containing variables to be loaded
53
+ -v, --version VERSION Specify a browser version
54
+
55
+
@@ -31,8 +31,9 @@ Gem::Specification.new do |s|
31
31
  s.add_dependency('selenium-webdriver')
32
32
  s.add_dependency('pry')
33
33
  s.add_dependency('rdoc', '~> 3.11')
34
+ s.add_dependency('yard')
34
35
 
35
-
36
+ s.has_rdoc = 'yard'
36
37
  s.require_paths = ["lib"]
37
38
  s.files = `git ls-files`.split("\n")
38
39
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency('nokogiri')
33
33
  s.add_dependency('i18n')
34
34
  s.add_dependency('rb-appscript')
35
+ s.add_dependency('json', '1.4.6') #for safari support
35
36
 
36
37
  s.require_paths = ["lib"] #,"ext"]
37
38
  s.files = `git ls-files`.split("\n")
@@ -330,16 +330,16 @@ tags: log, begin, error, reference, validation, pass, fail, tallies, tag
330
330
  def finish_run(ts = nil)
331
331
  timestamp = Time.now unless ts
332
332
 
333
- mark_testlevel(">> #{@myName.titleize} duration: #{sec2hms(timestamp - @start_timestamp)}", 0)
333
+ mark_testlevel(">> Duration: #{sec2hms(timestamp - @start_timestamp)}", 0)
334
334
 
335
- mark_testlevel(">> #{@myName.titleize} validations: #{@my_passed_count + @my_failed_count} "+
336
- "fail: #{@my_failed_count}]", 0) if @my_passed_count and @my_failed_count
335
+ mark_testlevel(">> Validations: #{@my_passed_count + @my_failed_count} | "+
336
+ "Fails: #{@my_failed_count}", 0) if @my_passed_count and @my_failed_count
337
337
 
338
338
  tally_error_references
339
339
 
340
340
  utc_ts = timestamp.getutc
341
341
  loc_tm = "#{timestamp.strftime("%H:%M:%S")} #{timestamp.zone}"
342
- mark_testlevel(">> End #{@myName.titleize}", 9)
342
+ debug_to_log(">> End #{@myName.titleize}")
343
343
 
344
344
  end
345
345
 
@@ -44,7 +44,11 @@ module Awetestlib
44
44
  ::PASS = '-PASS'
45
45
  ::FAIL = '-FAIL'
46
46
 
47
- attr_accessor :browser, :browser_abbrev, :version, :env,
47
+ # @return [Watir::Browser] the browser referenced by the attribute browser
48
+ attr_accessor :browser
49
+ # @return [String] abbreviation for the targeted browser (e.g., IE, FF, GC)
50
+ attr_accessor :browser_abbrev
51
+ attr_accessor :version, :env,
48
52
  :library, :script_type, :script_file,
49
53
  :log_properties, :log_queue, :log_class,
50
54
  :notify_queue, :notify_class, :notify_id,
@@ -160,6 +164,7 @@ module Awetestlib
160
164
  options.each_pair do |k, v|
161
165
  self.send("#{k}=", v)
162
166
  end
167
+ script_file = options[:script_file]
163
168
  load script_file
164
169
  setup_global_test_vars(options)
165
170
 
@@ -275,9 +280,10 @@ module Awetestlib
275
280
  end
276
281
 
277
282
  def after_run
283
+ finish_run
278
284
  @report_class.finish_report(@html_report_file)
279
285
  open_report_file
280
- finish_run
286
+ #finish_run
281
287
  @myLog.close if @myLog
282
288
  end
283
289
 
@@ -2,19 +2,44 @@ module Awetestlib
2
2
  module Regression
3
3
  module Tables
4
4
 
5
- def get_index_for_column_head(panel, table_index, strg)
5
+ def get_index_for_column_head(panel, table_index, strg, desc = '')
6
+ table = panel.tables[table_index]
7
+ get_column_index(table, strg, desc, true)
8
+ end
9
+
10
+ def get_column_index(table, strg, desc = '', header = false)
11
+ msg = "Get index of "
12
+ msg << " header" if header
13
+ msg << " column containing #{strg}. "
14
+ msg << " #{desc}" if desc.length > 0
6
15
  rgx = Regexp.new(strg)
7
- panel.tables[table_index].each do |row|
16
+ row_idx = 0
17
+ index = -1
18
+ found = false
19
+ table.each do |row|
20
+ row_idx += 1
8
21
  if row.text =~ rgx
9
- index = 1
22
+ col_idx = 1
10
23
  row.each do |cell|
11
24
  if cell.text =~ rgx
12
- return index
25
+ index = col_idx
26
+ found = true
27
+ break
13
28
  end
14
- index += 1
29
+ col_idx += 1
15
30
  end
16
31
  end
32
+ break if found or header
33
+ end
34
+ if found
35
+ passed_to_log("#{msg} at index #{index}.")
36
+ index
37
+ else
38
+ failed_to_log("#{msg}")
39
+ nil
17
40
  end
41
+ rescue
42
+ failed_to_log("Unable to #{msg} '#{$!}'")
18
43
  end
19
44
 
20
45
  def get_index_of_last_row(table, pad = 2, every = 1)