sapphire 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,23 @@ module Sapphire
2
2
  module DSL
3
3
  module Browser
4
4
  def Hide(args)
5
- IsHidden(args) == true
5
+ NullModifier.new(Hide.new(args, @page, @browser))
6
+ end
7
+
8
+ class Hide
9
+ def initialize(item, page, browser)
10
+ @item = item
11
+ @page = page
12
+ @browser = browser
13
+ end
14
+
15
+ def ModifyWith(item)
16
+ @modifier = item
17
+ end
18
+
19
+ def execute
20
+ return { :value => SapphireConfig.Current.GetBy(@item.class).new(@page, @browser).Hide(@item, @modifier), :modifier => @modifier }
21
+ end
6
22
  end
7
23
  end
8
24
  end
@@ -2,25 +2,7 @@ module Sapphire
2
2
  module DSL
3
3
  module Browser
4
4
  def IsHidden(args)
5
- @page.fields.each do |field|
6
- field.keys.each do |field_key|
7
- if(field_key == args)
8
- begin
9
- wait = Selenium::WebDriver::Wait.new(:timeout => 10)
10
- element = wait.until { x = field[field_key].Find
11
- x and !x.displayed?
12
- }
13
- if(element)
14
- return element.displayed?
15
- end
16
- rescue
17
- return true
18
- end
19
- end
20
- end
21
- end
22
5
 
23
- raise "cannot find control matching " + args.to_s + " for page " + @page.to_s
24
6
  end
25
7
  end
26
8
  end
@@ -22,6 +22,7 @@ module Sapphire
22
22
  return control.Equals(arg)
23
23
  end
24
24
  end
25
+
25
26
  end
26
27
  end
27
28
  end
@@ -26,7 +26,28 @@ module Sapphire
26
26
  end
27
27
  end
28
28
 
29
- raise "cannot find control matching " + args.to_s + " for page " + @page.to_s
29
+ raise "cannot find control matching " + item.to_s + " for page " + @page.to_s
30
+ end
31
+
32
+ def Hide(item, modifier)
33
+ @page.fields.each do |field|
34
+ field.keys.each do |field_key|
35
+ if(field_key == item)
36
+ begin
37
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
38
+ element = wait.until { x = field[field_key].Find
39
+ x and modifier.Modify(!x.displayed?)
40
+ }
41
+ if(element)
42
+ return Evaluation.new(modifier.Modify(element.displayed?), modifier.Modify(true))
43
+ end
44
+ rescue
45
+ return Evaluation.new(true, true)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ raise "cannot find control matching " + item.to_s + " for page " + @page.to_s
30
51
  end
31
52
 
32
53
  def Validate(hash)
@@ -1,3 +1,3 @@
1
1
  module Sapphire
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
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.2.0
4
+ version: 0.2.1
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-08-31 00:00:00.000000000Z
12
+ date: 2011-09-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: albacore
16
- requirement: &9358284 !ruby/object:Gem::Requirement
16
+ requirement: &9358704 !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: *9358284
24
+ version_requirements: *9358704
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: selenium-webdriver
27
- requirement: &9358020 !ruby/object:Gem::Requirement
27
+ requirement: &9358404 !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: *9358020
35
+ version_requirements: *9358404
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &9357672 !ruby/object:Gem::Requirement
38
+ requirement: &9358092 !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: *9357672
46
+ version_requirements: *9358092
47
47
  description: An automated web acceptance test framework for non-technical resources
48
48
  using selenium-wedriver.
49
49
  email: