module Magnesium::TestUI

Public Instance Methods

generate_UI(prefix,caseno) click to toggle source
# File lib/magnesium/factor/test_ui.rb, line 13
def generate_UI(prefix,caseno)
  @hash = Hash.new

  yaml = YAML.load(File.open("#{Config.config["temp"]}#{TestLink.find_path(prefix,caseno)}"))
  yaml["web"].collect do |row|
    row.each do |k,v|
      if k == 'ui'
        v.collect do |row|
          @hash_element = Hash.new
          @hash_locate = Hash.new
          @hash_value = Hash.new
          @hash_action = Hash.new
          @hash_box = Hash.new

          @cont = Container.new
          @cont.container_mark = row["page"]["mark"]
          @cont.container_type = row["page"]["type"]
          @cont.container_title = row["page"]["title"]
          row["page"]["container"].collect do |c|
            @hash_element[c["element"]] = c["name"]
            @hash_locate[c["element"]] = c["locate"]
            @hash_value[c["element"]] = c["value"]
            @hash_action[c["element"]] = c["action"]
            unless c["box"].nil?
              @hash_box[c["element"]] = c["box"]
            end
          end

          @cont.hash_element = @hash_element
          @cont.hash_locate = @hash_locate
          @cont.hash_value = @hash_value
          @cont.hash_action = @hash_action
          @cont.hash_box = @hash_box

          @hash[row["page"]["mark"]] = @cont
        end
      end
    end
  end
  return @hash
end