Class: Symbol

Inherits:
Object show all
Defined in:
lib/sapphire/Extensions/Symbol.rb

Instance Method Summary collapse

Instance Method Details

#+(item) ⇒ Object



85
86
87
88
# File 'lib/sapphire/Extensions/Symbol.rb', line 85

def +(item)
  return Parameter(self) + item if Sapphire::DSL::TestPlans::Parameters.instance.Contains(self)
  raise "No Parameter defined for: " << self.to_s
end

#AcceptObject



21
22
23
24
25
# File 'lib/sapphire/Extensions/Symbol.rb', line 21

def Accept
  ExecuteAgainstControl(self) do |control, arg|
    control.Accept
  end
end

#CheckObject



9
10
11
12
13
# File 'lib/sapphire/Extensions/Symbol.rb', line 9

def Check
  ExecuteAgainstControl(self) do |control, arg|
    control.Check true
  end
end

#Checked(item, comparator) ⇒ Object



51
52
53
54
55
# File 'lib/sapphire/Extensions/Symbol.rb', line 51

def Checked(item, comparator)
  Examine(item, comparator) do |field, value|
    field.Checked
  end
end

#Clear(item) ⇒ Object



3
4
5
6
7
# File 'lib/sapphire/Extensions/Symbol.rb', line 3

def Clear(item)
  ExecuteAgainstControl(self) do |control, arg|
    control.Clear
  end
end

#ClickObject



15
16
17
18
19
# File 'lib/sapphire/Extensions/Symbol.rb', line 15

def Click
  ExecuteAgainstControl(self) do |control, arg|
    control.Click
  end
end

#Examine(key, comparator, &block) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/sapphire/Extensions/Symbol.rb', line 63

def Examine(key, comparator, &block)
  item = key
  key = item.first if item.is_a? Array
  return FieldNotDefinedEvaluation.new(key, $page) if !$page.Contains key

  field = $page.Get(key)
  return FieldNotFoundEvaluation.new(key, $page, "selenium could not find the field") if field == nil

  element = field.Find(comparator)
  return Evaluation.new(true, true) if element.nil? and comparator.Compare(true, false)
  return Fix(field.Evaluate(key, item, comparator, block), comparator)
end

#Fix(evaluation, comparator) ⇒ Object



76
77
78
79
# File 'lib/sapphire/Extensions/Symbol.rb', line 76

def Fix(evaluation, comparator)
  comparator = comparator.Create(evaluation)
  comparator
end

#MouseOverObject



27
28
29
30
31
# File 'lib/sapphire/Extensions/Symbol.rb', line 27

def MouseOver
  ExecuteAgainstControl(self) do |control, arg|
    control.MouseOver
  end
end

#Selected(item, comparator) ⇒ Object



45
46
47
48
49
# File 'lib/sapphire/Extensions/Symbol.rb', line 45

def Selected(item, comparator)
  Examine(item, comparator) do |field, value|
    field.Selected
  end
end

#Set(hash) ⇒ Object



39
40
41
42
43
# File 'lib/sapphire/Extensions/Symbol.rb', line 39

def Set(hash)
  ExecuteHashAgainstControl(hash) do |control, arg|
    control.Set arg
  end
end

#Show(item, comparator) ⇒ Object



57
58
59
60
61
# File 'lib/sapphire/Extensions/Symbol.rb', line 57

def Show(item, comparator)
  Examine(item, comparator) do |field, value|
    field.Visible true, comparator
  end
end

#UncheckObject



33
34
35
36
37
# File 'lib/sapphire/Extensions/Symbol.rb', line 33

def Uncheck
  ExecuteAgainstControl(self) do |control, arg|
    control.Check false
  end
end

#Validate(hash) ⇒ Object



81
82
83
# File 'lib/sapphire/Extensions/Symbol.rb', line 81

def Validate(hash)
  GetPageField(hash[hash.keys.first]).Equals(hash.keys.first.to_s)
end