sapphire 0.0.6 → 0.0.7

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.
@@ -3,7 +3,7 @@ module Sapphire
3
3
  module Browser
4
4
  def Error(hash)
5
5
  ExecuteHashAgainstControl(hash) do |control, arg|
6
- return control.Text == arg
6
+ return control.Equals(arg)
7
7
  end
8
8
  end
9
9
  end
@@ -2,7 +2,7 @@ module Sapphire
2
2
  module DSL
3
3
  module Browser
4
4
  def Hide(args)
5
- return IsHidden(args) == true
5
+ IsHidden(args) == true
6
6
  end
7
7
  end
8
8
  end
@@ -0,0 +1,14 @@
1
+ module Sapphire
2
+ module WebAbstractions
3
+ class List < Control
4
+
5
+ def Equals(value)
6
+ x = self.FindAll
7
+ x.each do |item|
8
+ return true if item.text == value
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -5,11 +5,11 @@ module Sapphire
5
5
  if(item.is_a? Hash)
6
6
  ExecuteHashAgainstControl(item) do |control, arg|
7
7
  wait = Selenium::WebDriver::Wait.new(:timeout => 10)
8
- text = wait.until { x = control.Text
9
- x unless x == ""
8
+ text = wait.until { x = control
9
+ x unless (!x.Equals(arg) && x.Equals(""))
10
10
  }
11
11
 
12
- return text == arg
12
+ return text.Equals(arg)
13
13
  end
14
14
  elsif(item.is_a? Symbol)
15
15
  return IsVisible(item) == true
@@ -4,7 +4,7 @@ module Sapphire
4
4
  def Validate(hash)
5
5
  hash.keys.each do |key|
6
6
  if(hash[key].is_a? Symbol)
7
- return key.to_s == GetPageField(hash[key]).Text
7
+ return GetPageField(hash[key]).Equals(key.to_s)
8
8
  else
9
9
  return key.to_s == hash[key].to_s
10
10
  end
@@ -16,6 +16,16 @@ module Sapphire
16
16
  end
17
17
  end
18
18
 
19
+ def FindAll
20
+ if(@hash.has_key?(:id))
21
+ FindAllBy :id
22
+ elsif (@hash.has_key?(:name))
23
+ FindAllBy :name
24
+ elsif (@hash.has_key?(:xpath))
25
+ FindAllBy :xpath
26
+ end
27
+ end
28
+
19
29
  def FindWithoutWait
20
30
  if(@hash.has_key?(:id))
21
31
  FindWithoutWaitBy :id
@@ -37,6 +47,13 @@ module Sapphire
37
47
  }
38
48
  end
39
49
 
50
+ def FindAllBy(symbol)
51
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
52
+ element = wait.until { x = @browser.find_elements symbol, @hash.fetch(symbol)
53
+ x
54
+ }
55
+ end
56
+
40
57
  def FindParent(hash)
41
58
  if(hash.has_key?(:id))
42
59
  @browser.find_element :id, hash.fetch(:id)
@@ -67,6 +84,10 @@ module Sapphire
67
84
  end
68
85
  sleep(1)
69
86
  end
87
+
88
+ def Equals(value)
89
+ self.Text == value
90
+ end
70
91
  end
71
92
  end
72
93
  end
@@ -41,6 +41,10 @@ module Sapphire
41
41
  @fields << { args.first => Hyperlink.new(@browser, args[1]) }
42
42
  end
43
43
 
44
+ def List(*args)
45
+ @fields << { args.first => List.new(@browser, args[1]) }
46
+ end
47
+
44
48
  end
45
49
  end
46
50
  end
@@ -1,3 +1,3 @@
1
1
  module Sapphire
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sapphire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-29 00:00:00.000000000Z
12
+ date: 2011-08-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: albacore
16
- requirement: &9595572 !ruby/object:Gem::Requirement
16
+ requirement: &9555948 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *9595572
24
+ version_requirements: *9555948
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: selenium-webdriver
27
- requirement: &9595140 !ruby/object:Gem::Requirement
27
+ requirement: &9555528 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *9595140
35
+ version_requirements: *9555528
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &9594708 !ruby/object:Gem::Requirement
38
+ requirement: &9555084 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *9594708
46
+ version_requirements: *9555084
47
47
  description: An automated web acceptance test framework for non-technical resources
48
48
  using selenium-wedriver.
49
49
  email:
@@ -70,6 +70,7 @@ files:
70
70
  - lib/sapphire/DSL/Browser/Hide.rb
71
71
  - lib/sapphire/DSL/Browser/IsHidden.rb
72
72
  - lib/sapphire/DSL/Browser/IsVisible.rb
73
+ - lib/sapphire/DSL/Browser/List.rb
73
74
  - lib/sapphire/DSL/Browser/MouseOver.rb
74
75
  - lib/sapphire/DSL/Browser/Navigate.rb
75
76
  - lib/sapphire/DSL/Browser/Not.rb