anhpham 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
 - data/bin/anhpham +30 -0
 - data/bin/generate.rb +20 -0
 - data/bin/helper.rb +51 -0
 - data/features/TestData/testdata.yml +4 -0
 - data/features/TestSuite/Login/login.feature +6 -0
 - data/features/step_definitions/lib_steps/login_steps.rb +3 -0
 - data/features/step_definitions/repositories/ob_login.rb +3 -0
 - data/features/support/env.rb +102 -0
 - data/features/support/hooks.rb +57 -0
 - data/features/support/project_env.rb +51 -0
 - data/lib/anhpham/assertion_steps.rb +96 -0
 - data/lib/anhpham/email_steps.rb +91 -0
 - data/lib/anhpham/javascript_handling_steps.rb +34 -0
 - data/lib/anhpham/lib_file_steps.rb +45 -0
 - data/lib/anhpham/lib_schema_data_steps.rb +110 -0
 - data/lib/anhpham/lib_web_steps.rb +184 -0
 - data/lib/anhpham/lib_webservice_steps.rb +44 -0
 - data/lib/anhpham/methods/IFD_Assertion_methods.rb +206 -0
 - data/lib/anhpham/methods/IFD_Connection.rb +28 -0
 - data/lib/anhpham/methods/IFD_email_methods.rb +16 -0
 - data/lib/anhpham/methods/IFD_webservice.rb +17 -0
 - data/lib/anhpham/methods/core.rb +342 -0
 - data/lib/anhpham/methods/database_methods.rb +25 -0
 - data/lib/anhpham/methods/db_utils.rb +37 -0
 - data/lib/anhpham/methods/error_handling_methods.rb +87 -0
 - data/lib/anhpham/methods/javascript_handling_methods.rb +46 -0
 - data/lib/anhpham/methods/lib_var.rb +59 -0
 - data/lib/anhpham/methods/misc_methods.rb +33 -0
 - data/lib/anhpham/methods/required_files.rb +33 -0
 - data/lib/anhpham/methods/util.rb +168 -0
 - data/lib/anhpham/methods/web_methods.rb +291 -0
 - data/lib/anhpham/methods/web_service_methods.rb +63 -0
 - data/lib/anhpham/version.rb +3 -0
 - data/lib/anhpham.rb +1 -0
 - metadata +153 -0
 
| 
         @@ -0,0 +1,168 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Util
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            #-----------------------------------------------------
         
     | 
| 
      
 4 
     | 
    
         
            +
            # support define and bind variable dynamically
         
     | 
| 
      
 5 
     | 
    
         
            +
            #-----------------------------------------------------
         
     | 
| 
      
 6 
     | 
    
         
            +
              $dyn_vars = nil
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            # set value to a variable
         
     | 
| 
      
 9 
     | 
    
         
            +
              def self.set_var(var_name, var_value)
         
     | 
| 
      
 10 
     | 
    
         
            +
                if $dyn_vars == nil
         
     | 
| 
      
 11 
     | 
    
         
            +
                  $dyn_vars = binding
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
                strEval = var_name + "=" + var_value
         
     | 
| 
      
 14 
     | 
    
         
            +
                eval strEval, $dyn_vars
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            # bind string with $dyn_vars context
         
     | 
| 
      
 18 
     | 
    
         
            +
              def self.bind_with_dyn_vars(str)
         
     | 
| 
      
 19 
     | 
    
         
            +
                if $dyn_vars == nil
         
     | 
| 
      
 20 
     | 
    
         
            +
                  $dyn_vars = binding
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                strEval = '"' + str +'"'
         
     | 
| 
      
 24 
     | 
    
         
            +
                return eval strEval, $dyn_vars
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            # bind json with $dyn_vars context
         
     | 
| 
      
 28 
     | 
    
         
            +
              def self.bind_json_with_dyn_vars(data_json)
         
     | 
| 
      
 29 
     | 
    
         
            +
                if data_json.kind_of? Hash
         
     | 
| 
      
 30 
     | 
    
         
            +
                  data_json.each_pair { |k,v|
         
     | 
| 
      
 31 
     | 
    
         
            +
                    data_json[k] = Util.bind_json_with_dyn_vars(v)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  }
         
     | 
| 
      
 33 
     | 
    
         
            +
                  for i in 0..data_json.keys.size - 1
         
     | 
| 
      
 34 
     | 
    
         
            +
                    if data_json.keys[i] != Util.bind_with_dyn_vars(data_json.keys[i])
         
     | 
| 
      
 35 
     | 
    
         
            +
                      k = Util.bind_with_dyn_vars(data_json.keys[i])
         
     | 
| 
      
 36 
     | 
    
         
            +
                      v = data_json[data_json.keys[i]]
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                      data_json.delete(data_json.keys[i])
         
     | 
| 
      
 39 
     | 
    
         
            +
                      data_json[k] = v
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
                  return data_json
         
     | 
| 
      
 43 
     | 
    
         
            +
                elsif data_json.kind_of? Array
         
     | 
| 
      
 44 
     | 
    
         
            +
                  for i in 0..data_json.size - 1
         
     | 
| 
      
 45 
     | 
    
         
            +
                    data_json[i] = Util.bind_json_with_dyn_vars(data_json[i])
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
                  return data_json
         
     | 
| 
      
 48 
     | 
    
         
            +
                elsif data_json.kind_of? String
         
     | 
| 
      
 49 
     | 
    
         
            +
                  return Util.bind_with_dyn_vars(data_json)
         
     | 
| 
      
 50 
     | 
    
         
            +
                else
         
     | 
| 
      
 51 
     | 
    
         
            +
                  raise "*** ERROR: unexpected error at cirrus_utils. Util.bind_json_with_dyn_vars function."
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
              def self.read_table_data_from_steps_with_header(table_data)
         
     | 
| 
      
 56 
     | 
    
         
            +
                # The table include header so the loop starting from 1 instead of 0
         
     | 
| 
      
 57 
     | 
    
         
            +
                json_array = Array.new
         
     | 
| 
      
 58 
     | 
    
         
            +
                for i in 1..table_data.size - 1
         
     | 
| 
      
 59 
     | 
    
         
            +
                  json_temp = Hash.new
         
     | 
| 
      
 60 
     | 
    
         
            +
                  for j in 0..table_data[0].size - 1
         
     | 
| 
      
 61 
     | 
    
         
            +
                    json_temp[table_data[0][j]] = table_data[i][j]
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
                  json_array << json_temp
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                # get dyn_vars if any
         
     | 
| 
      
 67 
     | 
    
         
            +
                json_array = Util.bind_json_with_dyn_vars(json_array)
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                # replace [[TODAY]] with current time
         
     | 
| 
      
 70 
     | 
    
         
            +
                json_array = Util.replace_json_with_date_holders(json_array)
         
     | 
| 
      
 71 
     | 
    
         
            +
                json_array
         
     | 
| 
      
 72 
     | 
    
         
            +
              end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
              def self.replace_json_with_date_holders(json_string)
         
     | 
| 
      
 75 
     | 
    
         
            +
                # replace [[TODAY]] = current date
         
     | 
| 
      
 76 
     | 
    
         
            +
                # replace [[NULL]] = nil
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                if json_string.kind_of? Hash
         
     | 
| 
      
 79 
     | 
    
         
            +
                  #puts "Hash: #{json_string}"
         
     | 
| 
      
 80 
     | 
    
         
            +
                  json_string.each_pair {|k, v|
         
     | 
| 
      
 81 
     | 
    
         
            +
                    json_string[k] = replace_json_with_date_holders(v)
         
     | 
| 
      
 82 
     | 
    
         
            +
                  }
         
     | 
| 
      
 83 
     | 
    
         
            +
                  return json_string
         
     | 
| 
      
 84 
     | 
    
         
            +
                elsif json_string.kind_of? Array
         
     | 
| 
      
 85 
     | 
    
         
            +
                  #puts "Array: #{json_string}"
         
     | 
| 
      
 86 
     | 
    
         
            +
                  for i in 0..json_string.size - 1
         
     | 
| 
      
 87 
     | 
    
         
            +
                    json_string[i] = replace_json_with_date_holders(json_string[i])
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
      
 89 
     | 
    
         
            +
                  return json_string
         
     | 
| 
      
 90 
     | 
    
         
            +
                elsif json_string.kind_of? String
         
     | 
| 
      
 91 
     | 
    
         
            +
                  #puts "String: #{json_string}"
         
     | 
| 
      
 92 
     | 
    
         
            +
                  if json_string.include? "[[TODAY]]"
         
     | 
| 
      
 93 
     | 
    
         
            +
                    json_string = eval json_string.gsub("[[TODAY]]", "Date.today")
         
     | 
| 
      
 94 
     | 
    
         
            +
                    json_string = json_string.strftime('%Y-%m-%d')
         
     | 
| 
      
 95 
     | 
    
         
            +
                  end
         
     | 
| 
      
 96 
     | 
    
         
            +
                  if json_string == "[[NULL]]"
         
     | 
| 
      
 97 
     | 
    
         
            +
                    json_string = nil
         
     | 
| 
      
 98 
     | 
    
         
            +
                  end
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
                  return json_string
         
     | 
| 
      
 101 
     | 
    
         
            +
                else
         
     | 
| 
      
 102 
     | 
    
         
            +
                  raise "*** ERROR: unexpected error at Environment.replace_json_with_date_holder function."
         
     | 
| 
      
 103 
     | 
    
         
            +
                end
         
     | 
| 
      
 104 
     | 
    
         
            +
              end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
              def self.convert_to_symbol_json(json)
         
     | 
| 
      
 107 
     | 
    
         
            +
                begin
         
     | 
| 
      
 108 
     | 
    
         
            +
                  json = JSON.parse(json)
         
     | 
| 
      
 109 
     | 
    
         
            +
                rescue
         
     | 
| 
      
 110 
     | 
    
         
            +
                end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                if json.kind_of? Hash
         
     | 
| 
      
 113 
     | 
    
         
            +
                  json_sym = Hash.new()
         
     | 
| 
      
 114 
     | 
    
         
            +
                  json.each {|k,v|
         
     | 
| 
      
 115 
     | 
    
         
            +
                    json_sym[k.downcase.to_sym] = convert_to_symbol_json(v)
         
     | 
| 
      
 116 
     | 
    
         
            +
                  }
         
     | 
| 
      
 117 
     | 
    
         
            +
                  return json_sym
         
     | 
| 
      
 118 
     | 
    
         
            +
                elsif json.kind_of? Array
         
     | 
| 
      
 119 
     | 
    
         
            +
                  array_sym = Array.new()
         
     | 
| 
      
 120 
     | 
    
         
            +
                  json.each {|temp|
         
     | 
| 
      
 121 
     | 
    
         
            +
                    array_sym << convert_to_symbol_json(temp)
         
     | 
| 
      
 122 
     | 
    
         
            +
                  }
         
     | 
| 
      
 123 
     | 
    
         
            +
                  return array_sym
         
     | 
| 
      
 124 
     | 
    
         
            +
                else
         
     | 
| 
      
 125 
     | 
    
         
            +
                  return json
         
     | 
| 
      
 126 
     | 
    
         
            +
                end
         
     | 
| 
      
 127 
     | 
    
         
            +
              end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
              def self.generate_condition_statement(condition_json, wildcard_type = nil)
         
     | 
| 
      
 130 
     | 
    
         
            +
                v_condition = ''
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                condition_json.each_pair { |col, vals|
         
     | 
| 
      
 133 
     | 
    
         
            +
                  #puts "DatabaseMethods.generate_condition_statement.col: #{col}"
         
     | 
| 
      
 134 
     | 
    
         
            +
                  #puts "DatabaseMethods.generate_condition_statement.vals: #{vals}"
         
     | 
| 
      
 135 
     | 
    
         
            +
                  condition = ''
         
     | 
| 
      
 136 
     | 
    
         
            +
                  if vals.nil?
         
     | 
| 
      
 137 
     | 
    
         
            +
                    condition = "#{col} is null"
         
     | 
| 
      
 138 
     | 
    
         
            +
                    # elsif self.metadata[:datetime_cols].include? col.downcase.to_sym
         
     | 
| 
      
 139 
     | 
    
         
            +
                    #   condition = "#{col} >= to_date(#{DB_Utils.sql_value_format(vals)}, 'yyyy-mm-dd') AND #{col} < to_date(#{DB_Utils.sql_value_format(vals)}, 'yyyy-mm-dd') + 1"
         
     | 
| 
      
 140 
     | 
    
         
            +
                  else
         
     | 
| 
      
 141 
     | 
    
         
            +
                    vals = vals.to_s.split(',') unless vals.kind_of? Array
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                    vals = vals.map { |val|
         
     | 
| 
      
 144 
     | 
    
         
            +
                      if wildcard_type.nil?
         
     | 
| 
      
 145 
     | 
    
         
            +
                        DB_Utils.sql_value_format(val)
         
     | 
| 
      
 146 
     | 
    
         
            +
                      else
         
     | 
| 
      
 147 
     | 
    
         
            +
                        case wildcard_type.to_s.downcase.to_sym
         
     | 
| 
      
 148 
     | 
    
         
            +
                          when :prefix
         
     | 
| 
      
 149 
     | 
    
         
            +
                            DB_Utils.sql_value_format_prefix_wildcard(val)
         
     | 
| 
      
 150 
     | 
    
         
            +
                          when :suffix
         
     | 
| 
      
 151 
     | 
    
         
            +
                            DB_Utils.sql_value_format_suffix_wildcard(val)
         
     | 
| 
      
 152 
     | 
    
         
            +
                          when :wildcard
         
     | 
| 
      
 153 
     | 
    
         
            +
                            DB_Utils.sql_value_format_wildcard(val)
         
     | 
| 
      
 154 
     | 
    
         
            +
                          else
         
     | 
| 
      
 155 
     | 
    
         
            +
                            DB_Utils.sql_value_format(val)
         
     | 
| 
      
 156 
     | 
    
         
            +
                        end
         
     | 
| 
      
 157 
     | 
    
         
            +
                      end
         
     | 
| 
      
 158 
     | 
    
         
            +
                    }
         
     | 
| 
      
 159 
     | 
    
         
            +
                    vals.each { |val|
         
     | 
| 
      
 160 
     | 
    
         
            +
                      temp_condition = val == 'null' ? "#{col} is #{val}" : "#{col} like #{val}"
         
     | 
| 
      
 161 
     | 
    
         
            +
                      condition += condition.empty? ? temp_condition : " OR #{temp_condition}"
         
     | 
| 
      
 162 
     | 
    
         
            +
                    }
         
     | 
| 
      
 163 
     | 
    
         
            +
                  end
         
     | 
| 
      
 164 
     | 
    
         
            +
                  v_condition += v_condition.empty? ? "(#{condition})" : " AND (#{condition})"
         
     | 
| 
      
 165 
     | 
    
         
            +
                }
         
     | 
| 
      
 166 
     | 
    
         
            +
                v_condition
         
     | 
| 
      
 167 
     | 
    
         
            +
              end
         
     | 
| 
      
 168 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,291 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'net/https'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative 'required_files'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            # This file contains assertion methods which are called from assertion_steps.rb
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # Method to return page title
         
     | 
| 
      
 7 
     | 
    
         
            +
            def get_page_title
         
     | 
| 
      
 8 
     | 
    
         
            +
              page.title
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            # Method to verify title
         
     | 
| 
      
 12 
     | 
    
         
            +
            # param 1 : String : expected title
         
     | 
| 
      
 13 
     | 
    
         
            +
            # param 2 : Boolean : test case [true or flase]
         
     | 
| 
      
 14 
     | 
    
         
            +
            def check_title(title, test_case)
         
     | 
| 
      
 15 
     | 
    
         
            +
              page_title = get_page_title
         
     | 
| 
      
 16 
     | 
    
         
            +
              if test_case
         
     | 
| 
      
 17 
     | 
    
         
            +
                if page_title != "#{title}"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  raise TestCaseFailed, "Page Title Not Matched, Actual Page Title : #{page_title}, Expected Page Title : #{title}"
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
              else
         
     | 
| 
      
 21 
     | 
    
         
            +
                if page_title == "#{title}"
         
     | 
| 
      
 22 
     | 
    
         
            +
                  raise TestCaseFailed, "Page Title Matched, Actual Page Title: #{page_title}"
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            # Method to verify partial title
         
     | 
| 
      
 28 
     | 
    
         
            +
            # param 1 : String : partial title string
         
     | 
| 
      
 29 
     | 
    
         
            +
            # param 2 : Boolean : test case [true or flase]
         
     | 
| 
      
 30 
     | 
    
         
            +
            def check_partial_title(partial_text_title, test_case)
         
     | 
| 
      
 31 
     | 
    
         
            +
              page_title = get_page_title
         
     | 
| 
      
 32 
     | 
    
         
            +
              if test_case
         
     | 
| 
      
 33 
     | 
    
         
            +
                if not page_title.include? "#{partial_text_title}"
         
     | 
| 
      
 34 
     | 
    
         
            +
                  raise TestCaseFailed, 'Partial Page Title Not Present'
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
              else
         
     | 
| 
      
 37 
     | 
    
         
            +
                if page_title.include? "#{partial_text_title}"
         
     | 
| 
      
 38 
     | 
    
         
            +
                  raise TestCaseFailed, 'Page Title Matched'
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            # Open Browser with config-able maximize browser option
         
     | 
| 
      
 45 
     | 
    
         
            +
            def execute_openbrowser url_site #, redirect
         
     | 
| 
      
 46 
     | 
    
         
            +
              begin
         
     | 
| 
      
 47 
     | 
    
         
            +
                if $_CFWEB['Maximize Browser'] == true
         
     | 
| 
      
 48 
     | 
    
         
            +
                  page.driver.browser.manage.window.maximize
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
              rescue StandardError => myStandardError
         
     | 
| 
      
 51 
     | 
    
         
            +
                put_log "\n>>> Error: #{myStandardError}"
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              if url_site == ""
         
     | 
| 
      
 55 
     | 
    
         
            +
                visit("")
         
     | 
| 
      
 56 
     | 
    
         
            +
              else
         
     | 
| 
      
 57 
     | 
    
         
            +
                visit(url_site)
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            # Click on element
         
     | 
| 
      
 62 
     | 
    
         
            +
            def execute_click element
         
     | 
| 
      
 63 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 64 
     | 
    
         
            +
              if foundElement != nil
         
     | 
| 
      
 65 
     | 
    
         
            +
                page.driver.execute_script('window.focus();')
         
     | 
| 
      
 66 
     | 
    
         
            +
                startTime = Time.new.to_i
         
     | 
| 
      
 67 
     | 
    
         
            +
                begin
         
     | 
| 
      
 68 
     | 
    
         
            +
                  sleep(0.5)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  currentTime = Time.new.to_i
         
     | 
| 
      
 70 
     | 
    
         
            +
                end while (foundElement.native.enabled? == false and (currentTime - startTime) < $_CFWEB['Wait Time'])
         
     | 
| 
      
 71 
     | 
    
         
            +
                page.driver.browser.execute_script("arguments[0].scrollIntoView(true);", foundElement.native)
         
     | 
| 
      
 72 
     | 
    
         
            +
                page.driver.browser.mouse.click(foundElement.native)
         
     | 
| 
      
 73 
     | 
    
         
            +
              else
         
     | 
| 
      
 74 
     | 
    
         
            +
                put_log "\nError >> Not found object: #{element}"
         
     | 
| 
      
 75 
     | 
    
         
            +
              end
         
     | 
| 
      
 76 
     | 
    
         
            +
            end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            # Set option state with state value True/False
         
     | 
| 
      
 79 
     | 
    
         
            +
            def execute_setstate element, state
         
     | 
| 
      
 80 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 81 
     | 
    
         
            +
              if foundElement != nil
         
     | 
| 
      
 82 
     | 
    
         
            +
                if state.upcase == "TRUE"
         
     | 
| 
      
 83 
     | 
    
         
            +
                  foundElement.set(true)
         
     | 
| 
      
 84 
     | 
    
         
            +
                else
         
     | 
| 
      
 85 
     | 
    
         
            +
                  foundElement.set(false)
         
     | 
| 
      
 86 
     | 
    
         
            +
                end
         
     | 
| 
      
 87 
     | 
    
         
            +
              else
         
     | 
| 
      
 88 
     | 
    
         
            +
                put_log "\nError >> Not found object: #{element}"
         
     | 
| 
      
 89 
     | 
    
         
            +
                exit
         
     | 
| 
      
 90 
     | 
    
         
            +
              end
         
     | 
| 
      
 91 
     | 
    
         
            +
            end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
            #Enter text to element
         
     | 
| 
      
 94 
     | 
    
         
            +
            def execute_settext element, text
         
     | 
| 
      
 95 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 96 
     | 
    
         
            +
              if foundElement != nil
         
     | 
| 
      
 97 
     | 
    
         
            +
                begin
         
     | 
| 
      
 98 
     | 
    
         
            +
                  foundElement.set(text)
         
     | 
| 
      
 99 
     | 
    
         
            +
                    #page.driver.browser.mouse.click(foundElement.native)
         
     | 
| 
      
 100 
     | 
    
         
            +
                    #foundElement.native.send_keys(text)
         
     | 
| 
      
 101 
     | 
    
         
            +
                    # put_log "\nfoundElement.value: #{foundElement.value}"
         
     | 
| 
      
 102 
     | 
    
         
            +
                    #foundElement.native.send_keys([:tab])
         
     | 
| 
      
 103 
     | 
    
         
            +
                rescue StandardError => myStandardError
         
     | 
| 
      
 104 
     | 
    
         
            +
                  put_log "\n>>> Error: #{myStandardError}"
         
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
      
 106 
     | 
    
         
            +
              else
         
     | 
| 
      
 107 
     | 
    
         
            +
                put_log "\nError >> Not found object: #{element}"
         
     | 
| 
      
 108 
     | 
    
         
            +
                exit
         
     | 
| 
      
 109 
     | 
    
         
            +
              end
         
     | 
| 
      
 110 
     | 
    
         
            +
            end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
            # Move mouse to element then click
         
     | 
| 
      
 113 
     | 
    
         
            +
            def execute_mousehoverandclick element
         
     | 
| 
      
 114 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 115 
     | 
    
         
            +
              if foundElement != nil
         
     | 
| 
      
 116 
     | 
    
         
            +
                page.driver.browser.mouse.move_to(foundElement.native, element)
         
     | 
| 
      
 117 
     | 
    
         
            +
                page.driver.browser.mouse.click(foundElement.native)
         
     | 
| 
      
 118 
     | 
    
         
            +
                sleep(2)
         
     | 
| 
      
 119 
     | 
    
         
            +
              else
         
     | 
| 
      
 120 
     | 
    
         
            +
                put_log "\nError >> Not found object: #{element}"
         
     | 
| 
      
 121 
     | 
    
         
            +
              end
         
     | 
| 
      
 122 
     | 
    
         
            +
            end
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
            def execute_drag_to_new_object from_element, element
         
     | 
| 
      
 125 
     | 
    
         
            +
              found_from_element = find_object(from_element)
         
     | 
| 
      
 126 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 127 
     | 
    
         
            +
              if foundElement != nil and found_from_element != nil
         
     | 
| 
      
 128 
     | 
    
         
            +
                found_from_element.drag_to(foundElement)
         
     | 
| 
      
 129 
     | 
    
         
            +
              end
         
     | 
| 
      
 130 
     | 
    
         
            +
            end
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
            def execute_hover_mouse_on element
         
     | 
| 
      
 133 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 134 
     | 
    
         
            +
              if foundElement != nil
         
     | 
| 
      
 135 
     | 
    
         
            +
                page.driver.browser.mouse.move_to(foundElement.native, element)
         
     | 
| 
      
 136 
     | 
    
         
            +
                sleep 1
         
     | 
| 
      
 137 
     | 
    
         
            +
              else
         
     | 
| 
      
 138 
     | 
    
         
            +
                put_log "\nError >> Not found object: #{element}"
         
     | 
| 
      
 139 
     | 
    
         
            +
              end
         
     | 
| 
      
 140 
     | 
    
         
            +
            end
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
            def execute_click_to_upload object, file_name
         
     | 
| 
      
 143 
     | 
    
         
            +
              upload_file = ($test_data_dir + file_name).gsub!(/\//, "\\")
         
     | 
| 
      
 144 
     | 
    
         
            +
              foundElement = find_object(object)
         
     | 
| 
      
 145 
     | 
    
         
            +
              if foundElement != nil
         
     | 
| 
      
 146 
     | 
    
         
            +
                call_step("I click on \"#{object}\"")
         
     | 
| 
      
 147 
     | 
    
         
            +
                window = RAutomation::Window.new(:title => /File Upload/)
         
     | 
| 
      
 148 
     | 
    
         
            +
                window.text_field(:class => "Edit").set(upload_file)
         
     | 
| 
      
 149 
     | 
    
         
            +
                window.button(:value => "&Open").click
         
     | 
| 
      
 150 
     | 
    
         
            +
              else
         
     | 
| 
      
 151 
     | 
    
         
            +
                raise "Error >> Object #{object} not found.!"
         
     | 
| 
      
 152 
     | 
    
         
            +
              end
         
     | 
| 
      
 153 
     | 
    
         
            +
            end
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
            # Check exists
         
     | 
| 
      
 156 
     | 
    
         
            +
            def execute_checkexists negate, element, timeout
         
     | 
| 
      
 157 
     | 
    
         
            +
              origin_timeout = $_CFWEB['Wait Time']
         
     | 
| 
      
 158 
     | 
    
         
            +
              set_time_out(timeout)
         
     | 
| 
      
 159 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 160 
     | 
    
         
            +
              set_time_out(origin_timeout)
         
     | 
| 
      
 161 
     | 
    
         
            +
              #put_log "\nexecute_checkexists : #{foundElement}"
         
     | 
| 
      
 162 
     | 
    
         
            +
              check = false
         
     | 
| 
      
 163 
     | 
    
         
            +
              if foundElement != nil
         
     | 
| 
      
 164 
     | 
    
         
            +
                check = true
         
     | 
| 
      
 165 
     | 
    
         
            +
              end
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
              negate = negate.strip if negate != nil
         
     | 
| 
      
 168 
     | 
    
         
            +
              #puts "---------->#{negate}"
         
     | 
| 
      
 169 
     | 
    
         
            +
              if negate == "not"
         
     | 
| 
      
 170 
     | 
    
         
            +
                # check.should_not eq true
         
     | 
| 
      
 171 
     | 
    
         
            +
                expect(check).not_to eql true
         
     | 
| 
      
 172 
     | 
    
         
            +
              elsif check.should eq true
         
     | 
| 
      
 173 
     | 
    
         
            +
                expect(check).to eq true
         
     | 
| 
      
 174 
     | 
    
         
            +
              end
         
     | 
| 
      
 175 
     | 
    
         
            +
            end
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
            # Send Key
         
     | 
| 
      
 178 
     | 
    
         
            +
            def execute_sendkeys element, text
         
     | 
| 
      
 179 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 180 
     | 
    
         
            +
              if foundElement != nil
         
     | 
| 
      
 181 
     | 
    
         
            +
                if foundElement[:disabled] == ''
         
     | 
| 
      
 182 
     | 
    
         
            +
                  if text == ":down"
         
     | 
| 
      
 183 
     | 
    
         
            +
                    foundElement.native.send_keys([:down])
         
     | 
| 
      
 184 
     | 
    
         
            +
                  elsif text == ":enter"
         
     | 
| 
      
 185 
     | 
    
         
            +
                    foundElement.native.send_keys([:enter])
         
     | 
| 
      
 186 
     | 
    
         
            +
                  elsif text == ":tab"
         
     | 
| 
      
 187 
     | 
    
         
            +
                    foundElement.native.send_keys([:tab])
         
     | 
| 
      
 188 
     | 
    
         
            +
                  else
         
     | 
| 
      
 189 
     | 
    
         
            +
                    foundElement.native.send_keys(text)
         
     | 
| 
      
 190 
     | 
    
         
            +
                  end
         
     | 
| 
      
 191 
     | 
    
         
            +
                end
         
     | 
| 
      
 192 
     | 
    
         
            +
              else
         
     | 
| 
      
 193 
     | 
    
         
            +
                put_log "\nError >> Not found object: #{element}"
         
     | 
| 
      
 194 
     | 
    
         
            +
                exit
         
     | 
| 
      
 195 
     | 
    
         
            +
              end
         
     | 
| 
      
 196 
     | 
    
         
            +
            end
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
            # method to scroll page to top or end
         
     | 
| 
      
 199 
     | 
    
         
            +
            def scroll_page(to)
         
     | 
| 
      
 200 
     | 
    
         
            +
              if to == 'end'
         
     | 
| 
      
 201 
     | 
    
         
            +
                page.driver.execute_script('window.scrollTo(0,Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight));')
         
     | 
| 
      
 202 
     | 
    
         
            +
              elsif to == 'top'
         
     | 
| 
      
 203 
     | 
    
         
            +
                page.driver.execute_script('window.scrollTo(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight),0);')
         
     | 
| 
      
 204 
     | 
    
         
            +
              else
         
     | 
| 
      
 205 
     | 
    
         
            +
                raise "Exception : Invalid Direction (only scroll \"top\" or \"end\")"
         
     | 
| 
      
 206 
     | 
    
         
            +
              end
         
     | 
| 
      
 207 
     | 
    
         
            +
            end
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
            # Method to return element status - enabled?
         
     | 
| 
      
 210 
     | 
    
         
            +
            # param 1 : String : Locator type (id, name, class, xpath, css)
         
     | 
| 
      
 211 
     | 
    
         
            +
            # param 2 : String : Locator value
         
     | 
| 
      
 212 
     | 
    
         
            +
            def is_element_enabled(element)
         
     | 
| 
      
 213 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 214 
     | 
    
         
            +
              expect(foundElement).to be_visible
         
     | 
| 
      
 215 
     | 
    
         
            +
            end
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
            # Element enabled checking
         
     | 
| 
      
 218 
     | 
    
         
            +
            # param 1 : String : Expected element text
         
     | 
| 
      
 219 
     | 
    
         
            +
            # param 2 : Boolean : test case [true or flase]
         
     | 
| 
      
 220 
     | 
    
         
            +
            def check_element_enable(element, test_case)
         
     | 
| 
      
 221 
     | 
    
         
            +
              result = is_element_enabled(element)
         
     | 
| 
      
 222 
     | 
    
         
            +
             
     | 
| 
      
 223 
     | 
    
         
            +
              if test_case
         
     | 
| 
      
 224 
     | 
    
         
            +
                raise TestCaseFailed, 'Element Not Enabled' unless result
         
     | 
| 
      
 225 
     | 
    
         
            +
              else
         
     | 
| 
      
 226 
     | 
    
         
            +
                raise TestCaseFailed, 'Element Enabled' unless !result
         
     | 
| 
      
 227 
     | 
    
         
            +
              end
         
     | 
| 
      
 228 
     | 
    
         
            +
            end
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
             
     | 
| 
      
 231 
     | 
    
         
            +
            # method to assert checkbox check/uncheck
         
     | 
| 
      
 232 
     | 
    
         
            +
            # param 1 : String : Locator value
         
     | 
| 
      
 233 
     | 
    
         
            +
            # param 2 : Boolean : test case [true or flase]
         
     | 
| 
      
 234 
     | 
    
         
            +
            def is_checkbox_checked(element, should_be_checked = true)
         
     | 
| 
      
 235 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 236 
     | 
    
         
            +
              checkbox = expect(foundElement).to be_checked
         
     | 
| 
      
 237 
     | 
    
         
            +
             
     | 
| 
      
 238 
     | 
    
         
            +
              if !checkbox && should_be_checked
         
     | 
| 
      
 239 
     | 
    
         
            +
                raise TestCaseFailed, 'Checkbox is not checked'
         
     | 
| 
      
 240 
     | 
    
         
            +
              elsif checkbox && !should_be_checked
         
     | 
| 
      
 241 
     | 
    
         
            +
                raise TestCaseFailed, 'Checkbox is checked'
         
     | 
| 
      
 242 
     | 
    
         
            +
              end
         
     | 
| 
      
 243 
     | 
    
         
            +
            end
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
            # method to assert radio button selected/unselected
         
     | 
| 
      
 246 
     | 
    
         
            +
            # param 1 : String : Locator value
         
     | 
| 
      
 247 
     | 
    
         
            +
            # param 2 : Boolean : test case [true or flase]
         
     | 
| 
      
 248 
     | 
    
         
            +
            def is_radio_button_selected(element, should_be_selected = true)
         
     | 
| 
      
 249 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 250 
     | 
    
         
            +
              radio = expect(foundElement).to be_checked
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
              if !radio && should_be_selected
         
     | 
| 
      
 253 
     | 
    
         
            +
                raise TestCaseFailed, 'Radio Button not selected'
         
     | 
| 
      
 254 
     | 
    
         
            +
              elsif radio && !should_be_selected
         
     | 
| 
      
 255 
     | 
    
         
            +
                raise TestCaseFailed, 'Radio Button is selected'
         
     | 
| 
      
 256 
     | 
    
         
            +
              end
         
     | 
| 
      
 257 
     | 
    
         
            +
            end
         
     | 
| 
      
 258 
     | 
    
         
            +
             
     | 
| 
      
 259 
     | 
    
         
            +
            def double_click(element)
         
     | 
| 
      
 260 
     | 
    
         
            +
              foundElement = find_object(element)
         
     | 
| 
      
 261 
     | 
    
         
            +
              page.driver.browser.mouse.double_click(foundElement.native)
         
     | 
| 
      
 262 
     | 
    
         
            +
            end
         
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
            # Method to maximize browser
         
     | 
| 
      
 265 
     | 
    
         
            +
            def maximize_browser
         
     | 
| 
      
 266 
     | 
    
         
            +
              page.driver.browser.manage.window.maximize
         
     | 
| 
      
 267 
     | 
    
         
            +
            end
         
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
      
 269 
     | 
    
         
            +
            # Method to switch to window by title
         
     | 
| 
      
 270 
     | 
    
         
            +
            def switch_to_window_by_title window_title
         
     | 
| 
      
 271 
     | 
    
         
            +
              $previous_window = page.driver.browser.window_handle
         
     | 
| 
      
 272 
     | 
    
         
            +
              window_found = false
         
     | 
| 
      
 273 
     | 
    
         
            +
              page.driver.browser.window_handles.each{ |handle|
         
     | 
| 
      
 274 
     | 
    
         
            +
                page.driver.browser.switch_to.window handle
         
     | 
| 
      
 275 
     | 
    
         
            +
                if page.title == window_title
         
     | 
| 
      
 276 
     | 
    
         
            +
                  window_found = true
         
     | 
| 
      
 277 
     | 
    
         
            +
                  break
         
     | 
| 
      
 278 
     | 
    
         
            +
                end
         
     | 
| 
      
 279 
     | 
    
         
            +
              }
         
     | 
| 
      
 280 
     | 
    
         
            +
              raise "Window having title \"#{window_title}\" not found" if not window_found
         
     | 
| 
      
 281 
     | 
    
         
            +
            end
         
     | 
| 
      
 282 
     | 
    
         
            +
             
     | 
| 
      
 283 
     | 
    
         
            +
            # Method to resize browser
         
     | 
| 
      
 284 
     | 
    
         
            +
            def resize_browser(width, heigth)
         
     | 
| 
      
 285 
     | 
    
         
            +
              page.driver.browser.manage.window.resize_to(width, heigth)
         
     | 
| 
      
 286 
     | 
    
         
            +
            end
         
     | 
| 
      
 287 
     | 
    
         
            +
             
     | 
| 
      
 288 
     | 
    
         
            +
            def take_screenshot
         
     | 
| 
      
 289 
     | 
    
         
            +
              cur_time = Time.now.strftime('%Y%m%d%H%M%S%L')
         
     | 
| 
      
 290 
     | 
    
         
            +
              page.driver.browser.save_screenshot($test_data_dir + '/screenshots/screenshot' + cur_time + '.png')
         
     | 
| 
      
 291 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,63 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rest-client'
         
     | 
| 
      
 2 
     | 
    
         
            +
            class WebServiceMethods
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              def self.get_response_code(url, timeout)
         
     | 
| 
      
 5 
     | 
    
         
            +
                response = HTTParty.get url, {timeout => timeout}
         
     | 
| 
      
 6 
     | 
    
         
            +
                return response.code
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def self.url_reach? (url, timeout)
         
     | 
| 
      
 10 
     | 
    
         
            +
                response_code = get_response_code(url, timeout)
         
     | 
| 
      
 11 
     | 
    
         
            +
                if response_code/10 ==2
         
     | 
| 
      
 12 
     | 
    
         
            +
                  return true
         
     | 
| 
      
 13 
     | 
    
         
            +
                else
         
     | 
| 
      
 14 
     | 
    
         
            +
                  return false
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              def self.send_put_request(url, data)
         
     | 
| 
      
 19 
     | 
    
         
            +
                begin
         
     | 
| 
      
 20 
     | 
    
         
            +
                  response = HTTParty.put url, {:body => data, :timeout => 180000}
         
     | 
| 
      
 21 
     | 
    
         
            +
                  return response
         
     | 
| 
      
 22 
     | 
    
         
            +
                rescue => e
         
     | 
| 
      
 23 
     | 
    
         
            +
                  raise "*** ERROR: when sending put request to '#{url}'. Info: \n\n #{e.message}"
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              def self.send_post_request(url, data)
         
     | 
| 
      
 28 
     | 
    
         
            +
                begin
         
     | 
| 
      
 29 
     | 
    
         
            +
                  puts "*** #{'WebServiceMethods.send_post_request.url'.ljust(47,' ')}: #{url}"
         
     | 
| 
      
 30 
     | 
    
         
            +
                  puts "WebServiceMethods.send_post_request.data: #{data}"
         
     | 
| 
      
 31 
     | 
    
         
            +
                  response = HTTParty.post url, {:body => data, :timeout => 180000}
         
     | 
| 
      
 32 
     | 
    
         
            +
                  return response
         
     | 
| 
      
 33 
     | 
    
         
            +
                rescue => e
         
     | 
| 
      
 34 
     | 
    
         
            +
                  raise "*** ERROR: when sending put request to '#{url}'. Info: \n\n #{e.message}"
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
              def self.send_XML_post_request(url, data)
         
     | 
| 
      
 39 
     | 
    
         
            +
                begin
         
     | 
| 
      
 40 
     | 
    
         
            +
                  # puts "*** #{'WebServiceMethods.send_post_request.url'.ljust(47,' ')}: #{url}"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  # puts "WebServiceMethods.send_post_request.data: #{data}"
         
     | 
| 
      
 42 
     | 
    
         
            +
                  response = RestClient.post url, data, :content_type => "text/xml", :timeout => 180000
         
     | 
| 
      
 43 
     | 
    
         
            +
                  return response
         
     | 
| 
      
 44 
     | 
    
         
            +
                rescue => e
         
     | 
| 
      
 45 
     | 
    
         
            +
                  raise "*** ERROR: when sending put request to '#{url}'. Info: \n\n #{e.message}"
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
              def self.send_get_request(url)
         
     | 
| 
      
 50 
     | 
    
         
            +
                begin
         
     | 
| 
      
 51 
     | 
    
         
            +
                  response = HTTParty.get url, timeout: 180000
         
     | 
| 
      
 52 
     | 
    
         
            +
                  return response
         
     | 
| 
      
 53 
     | 
    
         
            +
                rescue => e
         
     | 
| 
      
 54 
     | 
    
         
            +
                  raise "*** ERROR: when sending get request to '#{url}'. Info: \n\n #{e.message}"
         
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              def self.verify_response(reponse)
         
     | 
| 
      
 59 
     | 
    
         
            +
                if response.code/100 != 2
         
     | 
| 
      
 60 
     | 
    
         
            +
                  raise "*** ERROR: when processing the request. More info: \n\n #{response.body.to_s}"
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/anhpham.rb
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Dir[File.dirname(__FILE__) + '/anhpham/*.rb'].each { |file| require file }
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,153 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: anhpham
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.1
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Anh Pham
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-10-16 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: cucumber
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 2.0.0
         
     | 
| 
      
 20 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 21 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 22 
     | 
    
         
            +
                    version: 1.3.18
         
     | 
| 
      
 23 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 24 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 25 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: 2.0.0
         
     | 
| 
      
 30 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 31 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 32 
     | 
    
         
            +
                    version: 1.3.18
         
     | 
| 
      
 33 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 34 
     | 
    
         
            +
              name: selenium-webdriver
         
     | 
| 
      
 35 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 36 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 37 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 38 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 39 
     | 
    
         
            +
                    version: 2.46.2
         
     | 
| 
      
 40 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 41 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 42 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 43 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 44 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 45 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 46 
     | 
    
         
            +
                    version: 2.46.2
         
     | 
| 
      
 47 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 48 
     | 
    
         
            +
              name: chunky_png
         
     | 
| 
      
 49 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 50 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 51 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 52 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 53 
     | 
    
         
            +
                    version: 1.3.3
         
     | 
| 
      
 54 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 55 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 56 
     | 
    
         
            +
                    version: 1.3.0
         
     | 
| 
      
 57 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 58 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 59 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 60 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 61 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 62 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 63 
     | 
    
         
            +
                    version: 1.3.3
         
     | 
| 
      
 64 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 65 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 66 
     | 
    
         
            +
                    version: 1.3.0
         
     | 
| 
      
 67 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 68 
     | 
    
         
            +
              name: appium_lib
         
     | 
| 
      
 69 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 70 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 71 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 72 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 73 
     | 
    
         
            +
                    version: 4.1.0
         
     | 
| 
      
 74 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 75 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 76 
     | 
    
         
            +
                    version: 4.0.0
         
     | 
| 
      
 77 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 78 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 79 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 80 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 81 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 82 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 83 
     | 
    
         
            +
                    version: 4.1.0
         
     | 
| 
      
 84 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 85 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 86 
     | 
    
         
            +
                    version: 4.0.0
         
     | 
| 
      
 87 
     | 
    
         
            +
            description: Behavior driven development (BDD) approach to write automation test script
         
     | 
| 
      
 88 
     | 
    
         
            +
              to testing on Website
         
     | 
| 
      
 89 
     | 
    
         
            +
            email: anhpq.info@gmail.com
         
     | 
| 
      
 90 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 91 
     | 
    
         
            +
            - anhpham
         
     | 
| 
      
 92 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 93 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 94 
     | 
    
         
            +
            files:
         
     | 
| 
      
 95 
     | 
    
         
            +
            - bin/anhpham
         
     | 
| 
      
 96 
     | 
    
         
            +
            - bin/generate.rb
         
     | 
| 
      
 97 
     | 
    
         
            +
            - bin/helper.rb
         
     | 
| 
      
 98 
     | 
    
         
            +
            - features/TestData/testdata.yml
         
     | 
| 
      
 99 
     | 
    
         
            +
            - features/TestSuite/Login/login.feature
         
     | 
| 
      
 100 
     | 
    
         
            +
            - features/step_definitions/lib_steps/login_steps.rb
         
     | 
| 
      
 101 
     | 
    
         
            +
            - features/step_definitions/repositories/ob_login.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - features/support/env.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - features/support/hooks.rb
         
     | 
| 
      
 104 
     | 
    
         
            +
            - features/support/project_env.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - lib/anhpham.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - lib/anhpham/assertion_steps.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - lib/anhpham/email_steps.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - lib/anhpham/javascript_handling_steps.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - lib/anhpham/lib_file_steps.rb
         
     | 
| 
      
 110 
     | 
    
         
            +
            - lib/anhpham/lib_schema_data_steps.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            - lib/anhpham/lib_web_steps.rb
         
     | 
| 
      
 112 
     | 
    
         
            +
            - lib/anhpham/lib_webservice_steps.rb
         
     | 
| 
      
 113 
     | 
    
         
            +
            - lib/anhpham/methods/IFD_Assertion_methods.rb
         
     | 
| 
      
 114 
     | 
    
         
            +
            - lib/anhpham/methods/IFD_Connection.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib/anhpham/methods/IFD_email_methods.rb
         
     | 
| 
      
 116 
     | 
    
         
            +
            - lib/anhpham/methods/IFD_webservice.rb
         
     | 
| 
      
 117 
     | 
    
         
            +
            - lib/anhpham/methods/core.rb
         
     | 
| 
      
 118 
     | 
    
         
            +
            - lib/anhpham/methods/database_methods.rb
         
     | 
| 
      
 119 
     | 
    
         
            +
            - lib/anhpham/methods/db_utils.rb
         
     | 
| 
      
 120 
     | 
    
         
            +
            - lib/anhpham/methods/error_handling_methods.rb
         
     | 
| 
      
 121 
     | 
    
         
            +
            - lib/anhpham/methods/javascript_handling_methods.rb
         
     | 
| 
      
 122 
     | 
    
         
            +
            - lib/anhpham/methods/lib_var.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - lib/anhpham/methods/misc_methods.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - lib/anhpham/methods/required_files.rb
         
     | 
| 
      
 125 
     | 
    
         
            +
            - lib/anhpham/methods/util.rb
         
     | 
| 
      
 126 
     | 
    
         
            +
            - lib/anhpham/methods/web_methods.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            - lib/anhpham/methods/web_service_methods.rb
         
     | 
| 
      
 128 
     | 
    
         
            +
            - lib/anhpham/version.rb
         
     | 
| 
      
 129 
     | 
    
         
            +
            homepage: https://rubygems.org/gems/anhpham
         
     | 
| 
      
 130 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 131 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 132 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 133 
     | 
    
         
            +
            post_install_message: Thank you for installing Anh Pham gem.
         
     | 
| 
      
 134 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 135 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 136 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 137 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 138 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 139 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 140 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 141 
     | 
    
         
            +
                  version: 1.9.3
         
     | 
| 
      
 142 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 143 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 144 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 145 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 146 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 147 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 148 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 149 
     | 
    
         
            +
            rubygems_version: 2.3.0
         
     | 
| 
      
 150 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 151 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 152 
     | 
    
         
            +
            summary: SELENIUM WEBDRIVER WITH RUBY & CUCUMBER
         
     | 
| 
      
 153 
     | 
    
         
            +
            test_files: []
         
     |