sapphire 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sapphire/DataAbstractions/Query.rb +2 -2
- data/lib/sapphire/Strategies/ClassStrategy.rb +13 -0
- data/lib/sapphire/Strategies/DefaultStrategy.rb +13 -0
- data/lib/sapphire/Strategies/HashStrategy.rb +19 -0
- data/lib/sapphire/Strategies/NullModifier.rb +19 -0
- data/lib/sapphire/Strategies/Strategy.rb +12 -0
- data/lib/sapphire/Strategies/SymbolStrategy.rb +34 -0
- data/lib/sapphire/version.rb +1 -1
- metadata +14 -8
@@ -5,8 +5,8 @@ module Sapphire
|
|
5
5
|
x = self.Database.new
|
6
6
|
|
7
7
|
x.Open $config[x.Connection]
|
8
|
-
|
9
|
-
path = File.expand_path(self.Script, __FILE__)
|
8
|
+
y = AppConfig.Current.SqlPath || ""
|
9
|
+
path = File.expand_path(y + self.Script, __FILE__)
|
10
10
|
file = File.open(path)
|
11
11
|
contents = file.read
|
12
12
|
self.Tokenize(contents)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Strategies
|
4
|
+
class ClassStrategy < Strategy
|
5
|
+
def Show(item, modifier)
|
6
|
+
temp, @page = @browser.ShouldNavigateTo item
|
7
|
+
@page.Init
|
8
|
+
{:page => @page, :value => modifier.Modify(temp) }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Strategies
|
4
|
+
class HashStrategy < Strategy
|
5
|
+
def Show(item, modifier)
|
6
|
+
ExecuteHashAgainstControl(item) do |control, arg|
|
7
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
8
|
+
text = wait.until { x = control
|
9
|
+
x if (x.Equals(arg) || (!x.Equals("")))
|
10
|
+
}
|
11
|
+
|
12
|
+
puts arg
|
13
|
+
modifier.Modify(text.Equals(arg))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class NullModifier
|
2
|
+
def initialize(item)
|
3
|
+
@item = item
|
4
|
+
@item.ModifyWith self
|
5
|
+
end
|
6
|
+
|
7
|
+
def ModifyWith(item)
|
8
|
+
@modifier = item
|
9
|
+
end
|
10
|
+
|
11
|
+
def Modify(arg)
|
12
|
+
return @modifier.Modify(arg) if @modifier != nil
|
13
|
+
arg if @modifier == nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute
|
17
|
+
@item.execute
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module Strategies
|
4
|
+
class SymbolStrategy < Strategy
|
5
|
+
def Show(item, modifier)
|
6
|
+
@page.fields.each do |field|
|
7
|
+
field.keys.each do |field_key|
|
8
|
+
if(field_key == item)
|
9
|
+
begin
|
10
|
+
x = field[field_key].Find
|
11
|
+
if(x)
|
12
|
+
begin
|
13
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
14
|
+
result = wait.until { y = modifier.Modify(x.displayed?)
|
15
|
+
y unless y == false
|
16
|
+
}
|
17
|
+
return result
|
18
|
+
rescue
|
19
|
+
return false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
rescue
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
raise "cannot find control matching " + args.to_s + " for page " + @page.to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/sapphire/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.2
|
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-
|
12
|
+
date: 2011-08-30 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: albacore
|
16
|
-
requirement: &
|
16
|
+
requirement: &9415884 !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: *
|
24
|
+
version_requirements: *9415884
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: selenium-webdriver
|
27
|
-
requirement: &
|
27
|
+
requirement: &9415584 !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: *
|
35
|
+
version_requirements: *9415584
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activesupport
|
38
|
-
requirement: &
|
38
|
+
requirement: &9415296 !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: *
|
46
|
+
version_requirements: *9415296
|
47
47
|
description: An automated web acceptance test framework for non-technical resources
|
48
48
|
using selenium-wedriver.
|
49
49
|
email:
|
@@ -114,6 +114,12 @@ files:
|
|
114
114
|
- lib/sapphire/DSL/TestPlans/PathHandler.rb
|
115
115
|
- lib/sapphire/DSL/TestPlans/Run.rb
|
116
116
|
- lib/sapphire/DSL/TestPlans/TestPlan.rb
|
117
|
+
- lib/sapphire/Strategies/ClassStrategy.rb
|
118
|
+
- lib/sapphire/Strategies/DefaultStrategy.rb
|
119
|
+
- lib/sapphire/Strategies/HashStrategy.rb
|
120
|
+
- lib/sapphire/Strategies/NullModifier.rb
|
121
|
+
- lib/sapphire/Strategies/Strategy.rb
|
122
|
+
- lib/sapphire/Strategies/SymbolStrategy.rb
|
117
123
|
- lib/sapphire/Testing/Executable.rb
|
118
124
|
- lib/sapphire/Testing/RakeTask.rb
|
119
125
|
- lib/sapphire/Testing/ResultList.rb
|