sapphire 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,14 +21,13 @@ module Sapphire
21
21
  if(evaluation.left == evaluation.right)
22
22
  messages = []
23
23
 
24
- messages << "expected NOT: (nil)" if evaluation.left == nil
25
- messages << "expected NOT: " + evaluation.left.to_s if evaluation.left != nil
26
- messages << "got: (nil)" if evaluation.right == nil
27
- messages << "got: " + evaluation.right.to_s if evaluation.right != nil
24
+ messages << "expected NOT: (nil)" if evaluation.right == nil
25
+ messages << "expected NOT: " + evaluation.right.to_s if evaluation.right != nil
26
+ messages << "got: (nil)" if evaluation.left == nil
27
+ messages << "got: " + evaluation.left.to_s if evaluation.left != nil
28
28
 
29
29
  raise ExpectationException.new(messages)
30
30
  end
31
- #evaluation.left.should_not == evaluation.right
32
31
  end
33
32
 
34
33
  def execute
@@ -2,9 +2,11 @@ module Sapphire
2
2
  module DSL
3
3
  module TestPlans
4
4
  def Run(item)
5
- if(item.is_a? Class)
6
- if(item.new.is_a? Job)
7
- job = item.new
5
+ if(item.is_a? Job)
6
+ job = item
7
+ if(job.Arg)
8
+ system(job.PsExecPath + " " + job.Server + " -u " + job.User + " -p " + job.Password + " " + job.Path + " " + job.Arg.to_s)
9
+ else
8
10
  system(job.PsExecPath + " " + job.Server + " -u " + job.User + " -p " + job.Password + " " + job.Path)
9
11
  end
10
12
  else
@@ -13,4 +15,4 @@ module Sapphire
13
15
  end
14
16
  end
15
17
  end
16
- end
18
+ end
@@ -22,6 +22,10 @@ module Sapphire
22
22
  return ""
23
23
  end
24
24
 
25
+ def Arg
26
+ return nil
27
+ end
28
+
25
29
  end
26
30
  end
27
31
  end
@@ -19,14 +19,13 @@ class NullModifier
19
19
  if(evaluation.left != evaluation.right)
20
20
  messages = []
21
21
 
22
- messages << "expected: (nil)" if evaluation.left == nil
23
- messages << "expected: " + evaluation.left.to_s if evaluation.left != nil
24
- messages << "got: (nil)" if evaluation.right == nil
25
- messages << "got: " + evaluation.right.to_s if evaluation.right != nil
22
+ messages << "expected: (nil)" if evaluation.right == nil
23
+ messages << "expected: " + evaluation.right.to_s if evaluation.right != nil
24
+ messages << "got: (nil)" if evaluation.left == nil
25
+ messages << "got: " + evaluation.left.to_s if evaluation.left != nil
26
26
 
27
27
  raise ExpectationException.new(messages)
28
28
  end
29
- #evaluation.left.should == evaluation.right if @modifier == nil
30
29
  end
31
30
 
32
31
  def execute
@@ -124,30 +124,33 @@ module Sapphire
124
124
  log(@message_factory.create_test_started(test.text))
125
125
  end
126
126
 
127
- def TestCompleted(test)
128
- if test.type == "pending"
129
- log(@message_factory.create_test_ignored(test.text, "Pending: Not Yet Implemented"))
130
- elsif test.type == "pass"
131
- log(@message_factory.create_test_finished(test.text, test.time))
132
- elsif test.type == "fail"
133
-
134
- if test.messages.is_a? Array
135
- messages = test.messages.join("\n")
136
- else
137
- messages = test.messages
138
- end
139
- stack = ""
140
- test.stack.each do |line|
141
- if (!line.include? "sapphire")
142
- stack += line + "\n"
143
- end
127
+ def TestPassed(test)
128
+ log(@message_factory.create_test_finished(test.text, test.time))
129
+ log(@message_factory.create_suite_finished("Finally")) if test.item.is_a? Finally
130
+ end
131
+
132
+ def TestFailed(test)
133
+ if test.messages.is_a? Array
134
+ messages = test.messages.join("\n")
135
+ else
136
+ messages = test.messages
144
137
  end
145
- log(@message_factory.create_test_failed(test.text, messages, stack))
138
+ stack = ""
139
+ test.stack.each do |line|
140
+ #if (!line.include? "sapphire")
141
+ stack += line + "\n"
142
+ #end
146
143
  end
144
+ log(@message_factory.create_test_failed(test.text, messages, stack))
145
+ log(@message_factory.create_suite_finished("Finally")) if test.item.is_a? Finally
146
+ end
147
147
 
148
- if test.item.is_a? Finally
149
- log(@message_factory.create_suite_finished("Finally"))
150
- end
148
+ def TestPending(test)
149
+ log(@message_factory.create_test_ignored(test.text, "Pending: Not Yet Implemented"))
150
+ log(@message_factory.create_suite_finished("Finally")) if test.item.is_a? Finally
151
+ end
152
+
153
+ def TestingComplete()
151
154
 
152
155
  end
153
156
 
@@ -49,19 +49,17 @@ module Sapphire
49
49
  nav = page
50
50
  end
51
51
 
52
- temp = self.CurrentUrl.upcase.start_with?("HTTP://" + nav.Url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + nav.Url.upcase)
53
-
54
- #if you aren't on the expected page, check the alternate urls
55
- if(temp == false)
56
- nav.AlternateUrls.each do |url|
57
- temp = self.CurrentUrl.upcase.start_with?("HTTP://" + url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + url.upcase)
58
- if(temp)
59
- temp = Evaluation.new(self.CurrentUrl.upcase.start_with?("HTTP://" + url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + url.upcase), true)
60
- return temp, nav
52
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
53
+ found = wait.until {
54
+ x = self.CurrentUrl.upcase.start_with?("HTTP://" + nav.Url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + nav.Url.upcase)
55
+ if(x == false)
56
+ nav.AlternateUrls.each do |url|
57
+ x = self.CurrentUrl.upcase.start_with?("HTTP://" + url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + url.upcase)
61
58
  end
62
59
  end
63
- end
64
- temp = Evaluation.new(self.CurrentUrl.upcase.start_with?("HTTP://" + nav.Url.upcase) || self.CurrentUrl.upcase.start_with?("HTTPS://" + nav.Url.upcase), true)
60
+ x
61
+ }
62
+ temp = Evaluation.new(found, true)
65
63
  return temp, nav
66
64
  end
67
65
 
@@ -19,7 +19,7 @@ module Sapphire
19
19
  def IsChecked
20
20
 
21
21
  radio = self.Find
22
- radio.attribute("checked");
22
+ radio.attribute("checked")
23
23
 
24
24
  end
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module Sapphire
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
data/lib/sapphire.rb CHANGED
@@ -39,7 +39,7 @@ module Sapphire
39
39
  include JobAbstractions
40
40
  include WebAbstractions
41
41
  include Testing
42
- #include Testing::TeamCity
42
+ # include Testing::TeamCity
43
43
  include UI
44
44
  end
45
45
  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.4.2
4
+ version: 0.4.3
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-10-06 00:00:00.000000000Z
12
+ date: 2011-10-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
16
- requirement: &10006188 !ruby/object:Gem::Requirement
16
+ requirement: &9953184 !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: *10006188
24
+ version_requirements: *9953184
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: colorize
27
- requirement: &10005936 !ruby/object:Gem::Requirement
27
+ requirement: &9952932 !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: *10005936
35
+ version_requirements: *9952932
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: win32console
38
- requirement: &10005684 !ruby/object:Gem::Requirement
38
+ requirement: &9952680 !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: *10005684
46
+ version_requirements: *9952680
47
47
  description: An automated web acceptance test framework for non-technical resources
48
48
  using selenium-wedriver.
49
49
  email: