selenium-client 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -283,6 +283,58 @@ module Selenium
|
|
283
283
|
wait_for options
|
284
284
|
end
|
285
285
|
|
286
|
+
# Return all cookies for the current page under test.
|
287
|
+
def cookies
|
288
|
+
string_command "getCookie"
|
289
|
+
end
|
290
|
+
|
291
|
+
# Returns the value of the cookie with the specified name, or throws an error if the cookie is not present.
|
292
|
+
#
|
293
|
+
# 'name' is the name of the cookie
|
294
|
+
def cookie(name)
|
295
|
+
string_command "getCookieByName", [name,]
|
296
|
+
end
|
297
|
+
|
298
|
+
# Returns true if a cookie with the specified name is present, or false otherwise.
|
299
|
+
#
|
300
|
+
# 'name' is the name of the cookie
|
301
|
+
def cookie?(name)
|
302
|
+
boolean_command "isCookiePresent", [name,]
|
303
|
+
end
|
304
|
+
|
305
|
+
# Create a new cookie whose path and domain are same with those of current page
|
306
|
+
# under test, unless you specified a path for this cookie explicitly.
|
307
|
+
#
|
308
|
+
# 'nameValuePair' is name and value of the cookie in a format "name=value"
|
309
|
+
# 'optionsString' is options for the cookie. Currently supported options include 'path', 'max_age' and 'domain'.
|
310
|
+
# the optionsString's format is "path=/path/, max_age=60, domain=.foo.com". The order of options are irrelevant, the unit of the value of 'max_age' is second. Note that specifying a domain that isn't a subset of the current domain will usually fail.
|
311
|
+
def create_cookie(name_value_pair, options="")
|
312
|
+
if options.kind_of? Hash
|
313
|
+
options = options.keys.collect {|key| "#{key}=#{options[key]}" }.join(", ")
|
314
|
+
end
|
315
|
+
remote_control_command "createCookie", [name_value_pair,options,]
|
316
|
+
end
|
317
|
+
|
318
|
+
# Delete a named cookie with specified path and domain. Be careful; to delete a cookie, you
|
319
|
+
# need to delete it using the exact same path and domain that were used to create the cookie.
|
320
|
+
# If the path is wrong, or the domain is wrong, the cookie simply won't be deleted. Also
|
321
|
+
# note that specifying a domain that isn't a subset of the current domain will usually fail.
|
322
|
+
#
|
323
|
+
# Since there's no way to discover at runtime the original path and domain of a given cookie,
|
324
|
+
# we've added an option called 'recurse' to try all sub-domains of the current domain with
|
325
|
+
# all paths that are a subset of the current path. Beware; this option can be slow. In
|
326
|
+
# big-O notation, it operates in O(n*m) time, where n is the number of dots in the domain
|
327
|
+
# name and m is the number of slashes in the path.
|
328
|
+
#
|
329
|
+
# 'name' is the name of the cookie to be deleted
|
330
|
+
# 'optionsString' is options for the cookie. Currently supported options include 'path', 'domain' and 'recurse.' The optionsString's format is "path=/path/, domain=.foo.com, recurse=true". The order of options are irrelevant. Note that specifying a domain that isn't a subset of the current domain will usually fail.
|
331
|
+
def delete_cookie(name, options="")
|
332
|
+
if options.kind_of? Hash
|
333
|
+
options = options.keys.collect {|key| "#{key}=#{options[key]}" }.join(", ")
|
334
|
+
end
|
335
|
+
remote_control_command "deleteCookie", [name,options,]
|
336
|
+
end
|
337
|
+
|
286
338
|
end
|
287
339
|
|
288
340
|
end
|
@@ -6,6 +6,7 @@
|
|
6
6
|
require "digest/md5"
|
7
7
|
require "base64"
|
8
8
|
require "rubygems"
|
9
|
+
gem "rspec", "1.1.4"
|
9
10
|
require "spec"
|
10
11
|
require 'spec/runner/formatter/html_formatter'
|
11
12
|
require File.expand_path(File.dirname(__FILE__) + "/file_path_strategy")
|
@@ -63,7 +64,7 @@ module Selenium
|
|
63
64
|
|
64
65
|
# Should be called from config.after(:each) in spec helper
|
65
66
|
def self.capture_system_state(selenium_driver, example)
|
66
|
-
system_capture = Selenium::RSpec::Reporting::SystemCapture.new(selenium_driver, example,
|
67
|
+
system_capture = Selenium::RSpec::Reporting::SystemCapture.new(selenium_driver, example, file_path_strategy)
|
67
68
|
system_capture.capture_system_state
|
68
69
|
end
|
69
70
|
|
@@ -75,6 +76,14 @@ module Selenium
|
|
75
76
|
Selenium::RSpec::Reporting::HtmlReport.append_css(super)
|
76
77
|
end
|
77
78
|
|
79
|
+
def self.file_path_strategy
|
80
|
+
### HACK ####
|
81
|
+
# When running with DeepTest the class instance variable could not have been set
|
82
|
+
# For now you must set the env variable before launching the tests. We need to revisit the way DeepTest
|
83
|
+
# and RSpec reporting work for a proper fix.
|
84
|
+
@@file_path_strategy ||= Selenium::RSpec::Reporting::FilePathStrategy.new(ENV["SELENIUM_TEST_REPORT_FILE"])
|
85
|
+
end
|
86
|
+
|
78
87
|
protected
|
79
88
|
|
80
89
|
def include_example_group_description(example)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenQA
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-10-02 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements: []
|
73
73
|
|
74
74
|
rubyforge_project: selenium-client
|
75
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.3.0
|
76
76
|
signing_key:
|
77
77
|
specification_version: 2
|
78
78
|
summary: Official Ruby Client for Selenium RC.
|