rwebspec 6.0.3 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c644623905f8dd471b82b5fc4c6f484a99dde76f
4
- data.tar.gz: 58157d45569170ea93ccb21c6f42758cb2840dab
3
+ metadata.gz: a5573de85d53760dcc6e601d4f580262f76359ce
4
+ data.tar.gz: c6d7642e66b2684c68a8905c95cf7c7d5f306fe0
5
5
  SHA512:
6
- metadata.gz: b1908a8a2c1b96741cb8c99797db90f680ffbb0842d2a02cab8d17eedf54b138070313fda92655e9679eea8a41c71837f7e34a458da5262d0c3eed15494705f9
7
- data.tar.gz: 4e2b1aae3d57197d2dbb4604f5449447b18a51c51ed5380d1f5a0e088d64793d04ab24258c93e5015801fcdb92c8c1ba510f87d58cfda8d421eb5e5e58cc51fe
6
+ metadata.gz: 47638dcb16b3bf65e5a824b9c381764afc791ccdc13eff0bdc800b4d0ffd5956787b5134893e35181ecd27f9e8f750277454525eb3820b92740766f79c927a2d
7
+ data.tar.gz: 4df38f3a99225a8fdacbec2b37838a06b7028a2d4471e92a58142f8148509507b79fdb1c35881767797f19899691a2371db004f28c8938c60e0ca2eafdc6e5a9
data/CHANGELOG CHANGED
@@ -1,6 +1,12 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 6.2
5
+ [Change] Support TestWise 5 pause
6
+
7
+ 6.1
8
+ [Change] Support TestWise 5
9
+
4
10
  6.0.3
5
11
  [Fix] assert.rb reference to MiniTest
6
12
 
data/Rakefile CHANGED
@@ -77,7 +77,7 @@ end
77
77
  spec = Gem::Specification.new do |s|
78
78
  s.platform= Gem::Platform::RUBY
79
79
  s.name = "rwebspec"
80
- s.version = "6.0.3"
80
+ s.version = "6.2.0"
81
81
  s.summary = "Web application functional specification in Ruby"
82
82
  s.description = "Executable functional specification for web applications in RSpec syntax with Watir or Selenium WebDriver"
83
83
 
@@ -1,35 +1,45 @@
1
1
  require 'socket'
2
2
 
3
- MAX_MESSAGE_LENGTH = 8192 unless defined?(MAX_MESSAGE_LENGTH)# < 10K
3
+ MAX_MESSAGE_LENGTH = 8192 # < 10K
4
+
4
5
  $testwise_support = true
5
6
 
6
7
  module RWebSpec
7
8
  module TestWisePlugin
8
9
 
10
+ def debugging?
11
+ if ENV["TESTWISE_DEBUGGING"].to_s == "true" && ENV["TESTWISE_RUNNING_AS"] == "test_case"
12
+ return true
13
+ end
14
+ return $TESTWISE_DEBUGGING && $TESTWISE_RUNNING_AS == "test_case"
15
+ end
16
+
9
17
  def debug(message)
10
18
  Thread.pass
11
- if $RUN_IN_TESTWISE && message
12
- the_sent_msg = message.to_s
13
- if the_sent_msg.size > MAX_MESSAGE_LENGTH
14
- the_sent_msg = the_sent_msg[0..MAX_MESSAGE_LENGTH] + "..."
15
- end
16
- connect_to_testwise(" DEBUG", the_sent_msg + "\r\n")
17
- end
18
-
19
+ if (ENV["RUN_IN_TESTWISE"] && ENV["RUN_IN_TESTWISE"].to_s == "true" || $RUN_IN_TESTWISE) && message
20
+ the_sent_msg = message.to_s
21
+ if the_sent_msg.size > MAX_MESSAGE_LENGTH
22
+ the_sent_msg = the_sent_msg[0..MAX_MESSAGE_LENGTH] + "..."
23
+ end
24
+ connect_to_testwise(" DEBUG", the_sent_msg + "\r\n")
25
+ else
26
+ puts message
27
+ end
19
28
  end
29
+ alias write_to_console debug
20
30
 
21
31
 
22
- # Support of iTest to ajust the intervals between keystroke/mouse operations
32
+ # Support of TestWise to ajust the intervals between keystroke/mouse operations
23
33
  def operation_delay
24
- begin
25
-
26
- if $TESTWISE_OPERATION_DELAY && $TESTWISE_OPERATION_DELAY > 0 &&
34
+ begin
35
+ $TESTWISE_OPERATION_DELAY = ENV["TESTWISE_OPERATION_DELAY"] if ENV["TESTWISE_OPERATION_DELAY"] && ENV["TESTWISE_OPERATION_DELAY"].to_i > 0
36
+ if $TESTWISE_OPERATION_DELAY && $TESTWISE_OPERATION_DELAY > 0 &&
27
37
  $TESTWISE_OPERATION_DELAY < 30000 then # max 30 seconds
28
38
  Thread.pass
29
39
  sleep($TESTWISE_OPERATION_DELAY / 1000)
30
40
  end
31
41
 
32
- while $TESTWISE_PAUSE
42
+ while (ENV["TESTWISE_PAUSE"] && ENV["TESTWISE_PAUSE"].to_s == "true") || $TESTWISE_PAUSE
33
43
  Thread.pass
34
44
  debug("Paused, waiting ...")
35
45
  sleep 1
@@ -40,33 +50,14 @@ module RWebSpec
40
50
  end
41
51
  end
42
52
 
43
- def check_for_pause
44
-
45
- if $TESTWISE_READY_TO_PAUSE
46
- # Already executed the the line immedately above,
47
- # give some buffer time for TW to set $TESTWISE_PAUSE flag
48
- sleep 0.5
49
- end
50
-
51
- # If the executed line no change, ignore
52
- while $TESTWISE_PAUSE
53
- Thread.pass
54
- debug("[selenium_webdriver_extension] Paused, waiting ...")
55
- sleep 1
56
- end
57
- end
58
-
53
+
59
54
  def notify_screenshot_location(image_file_path)
60
- begin
61
- connect_to_testwise(" SHOT", image_file_path)
62
- rescue => e
63
- puts "[DEBUG] failed to notify TestWise a screenshot"
64
- end
55
+ connect_to_testwise(" SHOT", image_file_path)
65
56
  end
66
57
 
67
58
  # find out the line (and file) the execution is on, and notify iTest via Socket
68
59
  def dump_caller_stack
69
- return unless ($TESTWISE_TRACE_EXECUTION)
60
+ return unless (ENV["TESTWISE_TRACE_EXECUTION"].to_s == "true" || $TESTWISE_TRACE_EXECUTION)
70
61
  begin
71
62
  trace_lines = []
72
63
  trace_file = nil
@@ -104,15 +95,43 @@ module RWebSpec
104
95
  if @last_message == the_message then # ignore the message same as preivous one
105
96
  return
106
97
  end
107
- itest_port = $TESTWISE_TRACE_PORT || 7025
108
- itest_socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
109
- itest_socket.connect(Socket.pack_sockaddr_in(itest_port, '127.0.0.1'))
110
- itest_socket.puts(the_message)
98
+ testwise_port = ENV["TESTWISE_TRACE_PORT"].to_i || $TESTWISE_TRACE_PORT || 7025
99
+ testwise_socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
100
+ testwise_socket.connect(Socket.pack_sockaddr_in(testwise_port, '127.0.0.1'))
101
+ testwise_socket.puts(the_message)
111
102
  @last_message = the_message
112
- itest_socket.close
103
+ testwise_socket.close
113
104
  rescue => e
114
105
  end
115
106
  end
116
107
 
108
+ def check_for_pause
109
+ json_data = fetch_debug_server_status
110
+
111
+ if json_data["testwise_ready_to_pause"]
112
+ # Already executed the the line immedately above,
113
+ # give some buffer time for TW to set $TESTWISE_PAUSE flag
114
+ sleep 0.5
115
+ end
116
+
117
+ # If the executed line no change, ignore
118
+ while json_data["testwise_pause"] || $TESTWISE_PAUSE
119
+ Thread.pass
120
+ write_to_console("[rwebspec] Paused, waiting ...")
121
+ sleep 1
122
+ json_data = fetch_debug_server_status
123
+ end
124
+
125
+ end
126
+
127
+ def fetch_debug_server_status
128
+ testwise_debug_server_port = ENV["TESTWISE_DEBUG_PORT"].to_i || $TESTWISE_DEBUG_PORT || 7035
129
+ server = TCPSocket.open("127.0.0.1", testwise_debug_server_port)
130
+ server.puts("debug_status")
131
+ msg = server.gets.chomp
132
+ server.close
133
+ json_data = JSON.parse(msg)
134
+ end
135
+
117
136
  end
118
137
  end
@@ -29,7 +29,7 @@ module RWebSpec
29
29
  # New Options:
30
30
  # :browser => :ie | :firefox | :chrome | :safari
31
31
  def open_browser(opts = {})
32
- puts "[INFO] RWebSpec.Framework currently set to => #{RWebSpec.framework }"
32
+ # puts "[INFO] RWebSpec.Framework currently set to => #{RWebSpec.framework }"
33
33
  =begin
34
34
  if RWebSpec.framework =~ /watir/i
35
35
  RWebSpec.load_watir
@@ -45,12 +45,12 @@ module RWebSpec
45
45
  return open_browser_by_selenium(opts)
46
46
  end
47
47
  =end
48
- puts "[INFO] No underlying framework is set, try to determine browser: #{opts.inspect}"
48
+ # puts "[INFO] No underlying framework is set, try to determine browser: #{opts.inspect}"
49
49
  if opts.class == Hash
50
50
  if opts[:browser]
51
51
 
52
52
  if opts[:browser].to_s =~ /ie/i || opts[:browser].to_s =~ /internet\sexplorer/i
53
- puts "[INFO] based on browser, set to Watir"
53
+ # puts "[INFO] based on browser, set to Watir"
54
54
  RWebSpec.framework = "Watir"
55
55
  self.class.send(:include, RWebSpec::Driver)
56
56
  # Reload abstract web page to load driver
@@ -58,7 +58,7 @@ module RWebSpec
58
58
  return open_browser_by_watir(opts)
59
59
  end
60
60
 
61
- puts "[INFO] based on browser, set to Selenium"
61
+ # puts "[INFO] based on browser, set to Selenium"
62
62
  # not IE, using selenium
63
63
  RWebSpec.framework = "Selenium"
64
64
  self.class.send(:include, RWebSpec::Driver)
@@ -68,7 +68,7 @@ module RWebSpec
68
68
  end
69
69
  end
70
70
 
71
- puts "[INFO] browser type not specified, decide framework based on platform"
71
+ # puts "[INFO] browser type not specified, decide framework based on platform"
72
72
  if RUBY_PLATFORM =~ /mingw/
73
73
  # if it is Windows, set to Watir
74
74
  RWebSpec.framework = "Watir"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rwebspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.3
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zhimin Zhan
8
8
  autorequire: rwebspec
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-17 00:00:00.000000000 Z
11
+ date: 2015-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  requirements:
165
165
  - none
166
166
  rubyforge_project: rwebspec
167
- rubygems_version: 2.2.2
167
+ rubygems_version: 2.4.8
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: Web application functional specification in Ruby