sapphire 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,13 +3,11 @@ module Sapphire
3
3
  module Browser
4
4
  def Clear(item)
5
5
  if(item.is_a? Class)
6
- x = item.new
6
+ x = item.new $browser
7
7
  x.Clear
8
8
  return
9
9
  end
10
- @page.Reset
11
10
  end
12
11
  end
13
12
  end
14
- end
15
-
13
+ end
@@ -0,0 +1,10 @@
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Disable(args)
5
+ return Hide(args)
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -8,7 +8,15 @@ module Sapphire
8
8
  begin
9
9
  x = field[field_key].Find
10
10
  if(x)
11
- return x.displayed?
11
+ begin
12
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
13
+ result = wait.until { y = x.displayed?
14
+ y unless y == false
15
+ }
16
+ return result
17
+ rescue
18
+ return false
19
+ end
12
20
  end
13
21
  rescue
14
22
  return false
@@ -0,0 +1,13 @@
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ class Popup
5
+ def Close
6
+ $browser.switch_to.window($browser.window_handles.last)
7
+ $browser.close
8
+ $browser.switch_to.window($browser.window_handles[0])
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,16 +2,19 @@ module Sapphire
2
2
  module DSL
3
3
  module Browser
4
4
  def Show(item)
5
- sleep(0.5)
6
5
  if(item.is_a? Hash)
7
6
  ExecuteHashAgainstControl(item) do |control, arg|
8
- return control.Text == arg
7
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
8
+ text = wait.until { x = control.Text
9
+ x unless x == ""
10
+ }
11
+
12
+ return text == arg
9
13
  end
10
14
  elsif(item.is_a? Symbol)
11
15
  return IsVisible(item) == true
12
16
  elsif(item.is_a? Class)
13
17
  temp, @page = @browser.ShouldNavigateTo item
14
- sleep(1.5)
15
18
  @page.Init
16
19
  return temp
17
20
  else
@@ -19,7 +22,6 @@ module Sapphire
19
22
  @page.Init
20
23
  return true
21
24
  end
22
-
23
25
  end
24
26
  end
25
27
  end
@@ -0,0 +1,9 @@
1
+ module Sapphire
2
+ module DSL
3
+ module Data
4
+ def Write(query)
5
+ query.Execute
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ module Sapphire
2
+ module DataAbstractions
3
+ module NonQuery
4
+ def Execute
5
+ x = self.Database.new
6
+
7
+ x.Open $config[x.Connection]
8
+
9
+ path = File.expand_path(self.Script, __FILE__)
10
+ file = File.open(path)
11
+ contents = file.read
12
+ self.Tokenize(contents)
13
+
14
+ x.query(contents)
15
+ x.close
16
+ end
17
+ end
18
+ end
19
+ end
@@ -30,11 +30,16 @@ module Sapphire
30
30
  end
31
31
 
32
32
  def CurrentUrl
33
- self.current_url
33
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
34
+ url = wait.until { x = self.current_url
35
+ x unless x == nil
36
+ }
37
+
38
+ url
34
39
  end
35
40
 
36
41
  def Reload
37
- self.browser.get self.current_url
42
+ self.browser.get self.CurrentUrl
38
43
  end
39
44
 
40
45
  def ShouldNavigateTo(page)
@@ -44,7 +49,7 @@ module Sapphire
44
49
  nav = page
45
50
  end
46
51
 
47
- temp = self.current_url.upcase.start_with?("HTTPS://" + nav.Url.upcase) == true
52
+ temp = self.CurrentUrl.upcase.start_with?("HTTPS://" + nav.Url.upcase) == true
48
53
 
49
54
  return temp, nav
50
55
  end
@@ -60,11 +65,11 @@ module Sapphire
60
65
 
61
66
  def ShouldTransitionTo(url)
62
67
  if(url.instance_of?(String))
63
- temp = self.current_url.upcase.start_with?("HTTPS://" + url.upcase) == true
68
+ temp = self.CurrentUrl.upcase.start_with?("HTTPS://" + url.upcase) == true
64
69
  @rootUrl = url
65
70
  else
66
71
  x = url.new().Url
67
- temp = self.current_url.upcase.start_with?("HTTPS://" + x.upcase) == true
72
+ temp = self.CurrentUrl.upcase.start_with?("HTTPS://" + x.upcase) == true
68
73
  @rootUrl = x
69
74
  end
70
75
 
@@ -1,15 +1,15 @@
1
1
  module Sapphire
2
2
  module WebAbstractions
3
3
  class FireFoxBrowser < DelegateClass(Selenium::WebDriver::Firefox::Bridge)
4
- include WebBrowser
4
+ include WebBrowser
5
5
 
6
- attr_reader :browser
6
+ attr_reader :browser
7
7
 
8
- def initialize()
9
- @browser = Selenium::WebDriver.for :firefox
10
- super(@browser)
11
- $browser = @browser
12
- end
8
+ def initialize()
9
+ @browser = Selenium::WebDriver.for :firefox
10
+ super(@browser)
11
+ $browser = @browser
12
+ end
13
13
 
14
14
  end
15
15
 
@@ -1,3 +1,3 @@
1
1
  module Sapphire
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
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.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-12 00:00:00.000000000 -05:00
13
- default_executable:
12
+ date: 2011-07-29 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: albacore
17
- requirement: &24316488 !ruby/object:Gem::Requirement
16
+ requirement: &9595572 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: '0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *24316488
24
+ version_requirements: *9595572
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: selenium-webdriver
28
- requirement: &24316044 !ruby/object:Gem::Requirement
27
+ requirement: &9595140 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ! '>='
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *24316044
35
+ version_requirements: *9595140
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: activesupport
39
- requirement: &24315720 !ruby/object:Gem::Requirement
38
+ requirement: &9594708 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ! '>='
@@ -44,7 +43,7 @@ dependencies:
44
43
  version: '0'
45
44
  type: :runtime
46
45
  prerelease: false
47
- version_requirements: *24315720
46
+ version_requirements: *9594708
48
47
  description: An automated web acceptance test framework for non-technical resources
49
48
  using selenium-wedriver.
50
49
  email:
@@ -54,6 +53,7 @@ extensions: []
54
53
  extra_rdoc_files: []
55
54
  files:
56
55
  - lib/sapphire/DataAbstractions/Database.rb
56
+ - lib/sapphire/DataAbstractions/NonQuery.rb
57
57
  - lib/sapphire/DataAbstractions/Query.rb
58
58
  - lib/sapphire/DSL/Browser/Browser.rb
59
59
  - lib/sapphire/DSL/Browser/Check.rb
@@ -62,6 +62,7 @@ files:
62
62
  - lib/sapphire/DSL/Browser/Close.rb
63
63
  - lib/sapphire/DSL/Browser/Complete.rb
64
64
  - lib/sapphire/DSL/Browser/CurrentUrl.rb
65
+ - lib/sapphire/DSL/Browser/Disable.rb
65
66
  - lib/sapphire/DSL/Browser/Error.rb
66
67
  - lib/sapphire/DSL/Browser/ExecuteAgainstControl.rb
67
68
  - lib/sapphire/DSL/Browser/Exists.rb
@@ -72,6 +73,7 @@ files:
72
73
  - lib/sapphire/DSL/Browser/MouseOver.rb
73
74
  - lib/sapphire/DSL/Browser/Navigate.rb
74
75
  - lib/sapphire/DSL/Browser/Not.rb
76
+ - lib/sapphire/DSL/Browser/Popup.rb
75
77
  - lib/sapphire/DSL/Browser/Reload.rb
76
78
  - lib/sapphire/DSL/Browser/Set.rb
77
79
  - lib/sapphire/DSL/Browser/Should.rb
@@ -91,6 +93,7 @@ files:
91
93
  - lib/sapphire/DSL/Data/Underscore.rb
92
94
  - lib/sapphire/DSL/Data/Validate.rb
93
95
  - lib/sapphire/DSL/Data/Verify.rb
96
+ - lib/sapphire/DSL/Data/Write.rb
94
97
  - lib/sapphire/DSL/Scenarios/and.rb
95
98
  - lib/sapphire/DSL/Scenarios/background.rb
96
99
  - lib/sapphire/DSL/Scenarios/dsl.rb
@@ -128,7 +131,6 @@ files:
128
131
  - lib/sapphire/WebAbstractions/Controls/TextBox.rb
129
132
  - lib/sapphire/WebAbstractions/Controls/Title.rb
130
133
  - lib/sapphire.rb
131
- has_rdoc: true
132
134
  homepage: http://github.com/MarcusTheBold/Sapphire/
133
135
  licenses: []
134
136
  post_install_message:
@@ -149,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
151
  version: '0'
150
152
  requirements: []
151
153
  rubyforge_project:
152
- rubygems_version: 1.5.2
154
+ rubygems_version: 1.8.5
153
155
  signing_key:
154
156
  specification_version: 3
155
157
  summary: An automated web acceptance test framework for non-technical resources