sapphire 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/lib/sapphire/DSL/Browser/Browser.rb +13 -13
  2. data/lib/sapphire/DSL/Browser/Check.rb +12 -12
  3. data/lib/sapphire/DSL/Browser/Clear.rb +15 -15
  4. data/lib/sapphire/DSL/Browser/Click.rb +12 -12
  5. data/lib/sapphire/DSL/Browser/Close.rb +12 -12
  6. data/lib/sapphire/DSL/Browser/Complete.rb +15 -15
  7. data/lib/sapphire/DSL/Browser/CurrentUrl.rb +11 -11
  8. data/lib/sapphire/DSL/Browser/Error.rb +12 -12
  9. data/lib/sapphire/DSL/Browser/ExecuteAgainstControl.rb +45 -45
  10. data/lib/sapphire/DSL/Browser/Exists.rb +22 -22
  11. data/lib/sapphire/DSL/Browser/For.rb +10 -10
  12. data/lib/sapphire/DSL/Browser/Hide.rb +10 -10
  13. data/lib/sapphire/DSL/Browser/IsHidden.rb +28 -28
  14. data/lib/sapphire/DSL/Browser/IsVisible.rb +25 -25
  15. data/lib/sapphire/DSL/Browser/MouseOver.rb +12 -12
  16. data/lib/sapphire/DSL/Browser/Navigate.rb +11 -11
  17. data/lib/sapphire/DSL/Browser/Not.rb +9 -0
  18. data/lib/sapphire/DSL/Browser/Reload.rb +11 -11
  19. data/lib/sapphire/DSL/Browser/Set.rb +12 -12
  20. data/lib/sapphire/DSL/Browser/Should.rb +10 -10
  21. data/lib/sapphire/DSL/Browser/Show.rb +27 -26
  22. data/lib/sapphire/DSL/Browser/Start.rb +16 -16
  23. data/lib/sapphire/DSL/Browser/To.rb +10 -10
  24. data/lib/sapphire/DSL/Browser/Tracker.rb +15 -15
  25. data/lib/sapphire/DSL/Browser/Transition.rb +10 -10
  26. data/lib/sapphire/DSL/Browser/Uncheck.rb +12 -12
  27. data/lib/sapphire/DSL/Browser/With.rb +10 -10
  28. data/lib/sapphire/DSL/Configuration/ConfiguredBrowser.rb +12 -12
  29. data/lib/sapphire/DSL/Configuration/ConfiguredUser.rb +10 -10
  30. data/lib/sapphire/DSL/Configuration/Use.rb +15 -15
  31. data/lib/sapphire/DSL/Data/Exist.rb +11 -11
  32. data/lib/sapphire/DSL/Data/Find.rb +10 -10
  33. data/lib/sapphire/DSL/Data/GetPageField.rb +17 -17
  34. data/lib/sapphire/DSL/Data/Underscore.rb +8 -8
  35. data/lib/sapphire/DSL/Data/Validate.rb +16 -16
  36. data/lib/sapphire/DSL/Data/Verify.rb +10 -10
  37. data/lib/sapphire/DSL/Scenarios/Is.rb +9 -9
  38. data/lib/sapphire/DSL/Scenarios/Pending.rb +28 -28
  39. data/lib/sapphire/DSL/Scenarios/and.rb +24 -24
  40. data/lib/sapphire/DSL/Scenarios/background.rb +22 -22
  41. data/lib/sapphire/DSL/Scenarios/dsl.rb +60 -60
  42. data/lib/sapphire/DSL/Scenarios/finally.rb +31 -31
  43. data/lib/sapphire/DSL/Scenarios/given.rb +56 -56
  44. data/lib/sapphire/DSL/Scenarios/runner.rb +30 -30
  45. data/lib/sapphire/DSL/Scenarios/scenario.rb +51 -51
  46. data/lib/sapphire/DSL/Scenarios/then.rb +33 -33
  47. data/lib/sapphire/DSL/Scenarios/when.rb +46 -46
  48. data/lib/sapphire/DataAbstractions/Database.rb +57 -57
  49. data/lib/sapphire/DataAbstractions/Query.rb +19 -19
  50. data/lib/sapphire/Testing/ResultList.rb +18 -18
  51. data/lib/sapphire/Testing/ResultTree.rb +37 -37
  52. data/lib/sapphire/WebAbstractions/Controls/Base/Control.rb +74 -74
  53. data/lib/sapphire/WebAbstractions/Controls/Base/Page.rb +47 -47
  54. data/lib/sapphire/WebAbstractions/Controls/Base/WebBrowser.rb +74 -74
  55. data/lib/sapphire/WebAbstractions/Controls/Button.rb +9 -9
  56. data/lib/sapphire/WebAbstractions/Controls/CheckBox.rb +28 -28
  57. data/lib/sapphire/WebAbstractions/Controls/Chrome.rb +21 -21
  58. data/lib/sapphire/WebAbstractions/Controls/DropDown.rb +25 -25
  59. data/lib/sapphire/WebAbstractions/Controls/FireFox.rb +22 -22
  60. data/lib/sapphire/WebAbstractions/Controls/Hyperlink.rb +8 -8
  61. data/lib/sapphire/WebAbstractions/Controls/Image.rb +9 -9
  62. data/lib/sapphire/WebAbstractions/Controls/InternetExplorer.rb +21 -21
  63. data/lib/sapphire/WebAbstractions/Controls/Label.rb +8 -8
  64. data/lib/sapphire/WebAbstractions/Controls/RadioButton.rb +18 -18
  65. data/lib/sapphire/WebAbstractions/Controls/TableCell.rb +10 -0
  66. data/lib/sapphire/WebAbstractions/Controls/TextBox.rb +31 -31
  67. data/lib/sapphire/WebAbstractions/Controls/Title.rb +12 -12
  68. data/lib/sapphire/version.rb +1 -1
  69. metadata +13 -9
@@ -1,25 +1,25 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def IsVisible(args)
5
- @page.fields.each do |field|
6
- field.keys.each do |field_key|
7
- if(field_key == args)
8
- begin
9
- x = field[field_key].Find
10
- if(x)
11
- return x.displayed?
12
- end
13
- rescue
14
- return false
15
- end
16
- end
17
- end
18
- end
19
-
20
- raise "cannot find control matching " + args.to_s + " for page " + @page.to_s
21
- end
22
- end
23
- end
24
- end
25
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def IsVisible(args)
5
+ @page.fields.each do |field|
6
+ field.keys.each do |field_key|
7
+ if(field_key == args)
8
+ begin
9
+ x = field[field_key].Find
10
+ if(x)
11
+ return x.displayed?
12
+ end
13
+ rescue
14
+ return false
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ raise "cannot find control matching " + args.to_s + " for page " + @page.to_s
21
+ end
22
+ end
23
+ end
24
+ end
25
+
@@ -1,12 +1,12 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def MouseOver(*args)
5
- ExecuteAgainstControl(args) do |control, arg|
6
- control.MouseOver
7
- end
8
- end
9
- end
10
- end
11
- end
12
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def MouseOver(*args)
5
+ ExecuteAgainstControl(args) do |control, arg|
6
+ control.MouseOver
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -1,11 +1,11 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Navigate(page)
5
- @page = @browser.NavigateTo(page)
6
- @page.Init
7
- end
8
- end
9
- end
10
- end
11
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Navigate(page)
5
+ @page = @browser.NavigateTo(page)
6
+ @page.Init
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,9 @@
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Not(item)
5
+ !item
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,11 +1,11 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Reload(item)
5
- @browser.Reload
6
- Should Show item
7
- end
8
- end
9
- end
10
- end
11
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Reload(item)
5
+ @browser.Reload
6
+ Should Show item
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -1,12 +1,12 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Set(hash)
5
- ExecuteHashAgainstControl(hash) do |control, arg|
6
- control.Set arg
7
- end
8
- end
9
- end
10
- end
11
- end
12
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Set(hash)
5
+ ExecuteHashAgainstControl(hash) do |control, arg|
6
+ control.Set arg
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Should(item)
5
- item
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Should(item)
5
+ item.should == true
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,26 +1,27 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Show(item)
5
-
6
- if(item.is_a? Hash)
7
- ExecuteHashAgainstControl(item) do |control, arg|
8
- control.Text.should == arg
9
- end
10
- return
11
- elsif(item.is_a? Symbol)
12
- IsVisible(item).should == true
13
- return
14
- elsif(item.is_a? Class)
15
- @page = @browser.ShouldNavigateTo item
16
- sleep(1)
17
- else
18
- @page = item
19
- end
20
-
21
- @page.Init
22
- end
23
- end
24
- end
25
- end
26
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Show(item)
5
+ sleep(0.5)
6
+ if(item.is_a? Hash)
7
+ ExecuteHashAgainstControl(item) do |control, arg|
8
+ return control.Text == arg
9
+ end
10
+ elsif(item.is_a? Symbol)
11
+ return IsVisible(item) == true
12
+ elsif(item.is_a? Class)
13
+ temp, @page = @browser.ShouldNavigateTo item
14
+ sleep(1.5)
15
+ @page.Init
16
+ return temp
17
+ else
18
+ @page = item
19
+ @page.Init
20
+ return true
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end
27
+
@@ -1,16 +1,16 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Start(browser)
5
- if(browser == ConfigurationBrowser)
6
- @browser = AppConfig.Current.Browser
7
- else
8
- @browser = browser
9
- end
10
-
11
- @browser.SetRootUrl(@rootUrl)
12
- end
13
- end
14
- end
15
- end
16
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Start(browser)
5
+ if(browser == ConfigurationBrowser)
6
+ @browser = AppConfig.Current.Browser
7
+ else
8
+ @browser = browser
9
+ end
10
+
11
+ @browser.SetRootUrl(@rootUrl)
12
+ end
13
+ end
14
+ end
15
+ end
16
+
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def To(url)
5
- url
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def To(url)
5
+ url
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,15 +1,15 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Track(hash)
5
- $tracker ||= {}
6
- $tracker.merge! hash
7
- end
8
-
9
- def Tracker(item)
10
- $tracker[item]
11
- end
12
- end
13
- end
14
- end
15
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Track(hash)
5
+ $tracker ||= {}
6
+ $tracker.merge! hash
7
+ end
8
+
9
+ def Tracker(item)
10
+ $tracker[item]
11
+ end
12
+ end
13
+ end
14
+ end
15
+
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Transition(url)
5
- @browser.ShouldTransitionTo url
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Transition(url)
5
+ @browser.ShouldTransitionTo url
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,12 +1,12 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def Uncheck(*args)
5
- ExecuteAgainstControl(args) do |control, arg|
6
- control.Check false
7
- end
8
- end
9
- end
10
- end
11
- end
12
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def Uncheck(*args)
5
+ ExecuteAgainstControl(args) do |control, arg|
6
+ control.Check false
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -1,10 +1,10 @@
1
- module Sapphire
2
- module DSL
3
- module Browser
4
- def With(item)
5
- item
6
- end
7
- end
8
- end
9
- end
10
-
1
+ module Sapphire
2
+ module DSL
3
+ module Browser
4
+ def With(item)
5
+ item
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,13 +1,13 @@
1
- module Sapphire
2
- module DSL
3
- module Configuration
4
- def ConfiguredBrowser(url)
5
- @rootUrl = url
6
- ConfigurationBrowser
7
- end
8
-
9
- class ConfigurationBrowser
10
- end
11
- end
12
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Configuration
4
+ def ConfiguredBrowser(url)
5
+ @rootUrl = url
6
+ ConfigurationBrowser
7
+ end
8
+
9
+ class ConfigurationBrowser
10
+ end
11
+ end
12
+ end
13
13
  end
@@ -1,11 +1,11 @@
1
- module Sapphire
2
- module DSL
3
- module Configuration
4
- def configured_user
5
- $user
6
- end
7
- class ConfiguredUser
8
- end
9
- end
10
- end
1
+ module Sapphire
2
+ module DSL
3
+ module Configuration
4
+ def configured_user
5
+ $user
6
+ end
7
+ class ConfiguredUser
8
+ end
9
+ end
10
+ end
11
11
  end
@@ -1,15 +1,15 @@
1
- module Sapphire
2
- module DSL
3
- module Configuration
4
- def Use(user)
5
- if(user == ConfiguredUser)
6
- $user = AppConfig.new().User
7
- else
8
- $user = user.new
9
- end
10
- end
11
- end
12
- end
13
- end
14
-
15
-
1
+ module Sapphire
2
+ module DSL
3
+ module Configuration
4
+ def Use(user)
5
+ if(user == ConfiguredUser)
6
+ $user = AppConfig.new().User
7
+ else
8
+ $user = user.new
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+