abak-selenium-integration 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/README.md +1 -0
- data/abak-selenium-integration.gemspec +8 -8
- data/lib/page/gems_overriding.rb +22 -23
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 951a68fbb765edaf5efe0d966c727e1b81d2a845
|
4
|
+
data.tar.gz: 660eb47c982dbe9f3a3d8b11265eb59e5d1fe81e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d01caa2c2bdff95e3b09f8629ccb6ca9ceecd0c9e108f5a38d4497922f918129b98e9a119df59d0fb864968bfe783d85fa88d44255b79be0282da15803c7179
|
7
|
+
data.tar.gz: e040305cbad1328102fd98ac12b9096e8dfc783e80a7ba23feeb320dba6a90eb40048243d614765c8275f26276d792e62a9d6dffda26ed74af1decdf8bd95a07
|
data/.gitignore
CHANGED
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# abak-selenium-integration
|
@@ -3,17 +3,17 @@ lib = File.expand_path('lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'abak-selenium-integration'
|
6
|
-
spec.version = '1.0.
|
7
|
-
spec.authors = [
|
8
|
-
spec.email = [
|
9
|
-
spec.summary =
|
6
|
+
spec.version = '1.0.6'
|
7
|
+
spec.authors = ['Sergey Avdonin']
|
8
|
+
spec.email = ['sunlf@yandex.ru']
|
9
|
+
spec.summary = 'Selenium integration gem'
|
10
10
|
spec.files = `git ls-files -z`.split("\x0")
|
11
|
-
spec.require_paths = [
|
11
|
+
spec.require_paths = ['lib']
|
12
12
|
spec.add_runtime_dependency('page-object')
|
13
13
|
spec.add_runtime_dependency('activesupport')
|
14
14
|
spec.add_runtime_dependency('rspec')
|
15
15
|
spec.add_runtime_dependency('selenium-webdriver')
|
16
|
-
spec.description =
|
16
|
+
spec.description = 'Integration gem for test automatisation based on page-object'
|
17
17
|
spec.homepage = 'http://rubygems.org/gems/abak-selenium-integration'
|
18
|
-
spec.license =
|
19
|
-
end
|
18
|
+
spec.license = 'MIT'
|
19
|
+
end
|
data/lib/page/gems_overriding.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
module GemsOverriding
|
3
3
|
# Override selenium gem to make find element more exact. Selenium will try to find
|
4
4
|
# element for some time. Override click to ignore wrappers around element.
|
5
|
-
|
6
5
|
Selenium::WebDriver::Element.class_eval do
|
7
6
|
attr_reader :bridge, :id
|
8
7
|
|
@@ -13,7 +12,7 @@ module GemsOverriding
|
|
13
12
|
|
14
13
|
def send_keys(*args)
|
15
14
|
bridge.send_keys_to_element id, Selenium::WebDriver::Keys.encode(args)
|
16
|
-
|
15
|
+
# rescue if cant focus
|
17
16
|
rescue Selenium::WebDriver::Error::UnknownError
|
18
17
|
bridge.execute_script('arguments[0].value = arguments[1];', self, Selenium::WebDriver::Keys.encode(args))
|
19
18
|
end
|
@@ -21,7 +20,7 @@ module GemsOverriding
|
|
21
20
|
|
22
21
|
PageObject::Platforms::SeleniumWebDriver::PageObject.class_eval do
|
23
22
|
def select_list_value_set(identifier, value)
|
24
|
-
process_selenium_call(identifier, Elements::SelectList, 'select') do |how, what|
|
23
|
+
process_selenium_call(identifier, PageObject::Elements::SelectList, 'select') do |how, what|
|
25
24
|
select_list = @browser.find_element(how, what)
|
26
25
|
select_list.find_elements(tag_name: 'option').find do |option|
|
27
26
|
option.text == value
|
@@ -34,27 +33,27 @@ module GemsOverriding
|
|
34
33
|
# need for find_element reconstruction
|
35
34
|
def extract_args(args)
|
36
35
|
case args.size
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
36
|
+
when 3
|
37
|
+
args
|
38
|
+
when 2
|
39
|
+
# base timeout for find_element
|
40
|
+
args.push(10)
|
41
|
+
args
|
42
|
+
when 1
|
43
|
+
arg = args.first
|
44
|
+
unless arg.respond_to?(:shift)
|
45
|
+
raise ArgumentError, "expected #{arg.inspect}:#{arg.class} to respond to #shift"
|
46
|
+
end
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
# this will be a single-entry hash, so use #shift over #first or #[]
|
49
|
+
arr = arg.dup.shift
|
50
|
+
unless arr.size == 2
|
51
|
+
raise ArgumentError, "expected #{arr.inspect} to have 2 elements"
|
52
|
+
end
|
53
|
+
arr.push(10)
|
54
|
+
arr
|
55
|
+
else
|
56
|
+
raise ArgumentError, "wrong number of arguments (#{args.size} for 2)"
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abak-selenium-integration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Avdonin
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- ".gitignore"
|
77
77
|
- Gemfile
|
78
78
|
- Gemfile.lock
|
79
|
+
- README.md
|
79
80
|
- abak-selenium-integration.gemspec
|
80
81
|
- lib/page.rb
|
81
82
|
- lib/page/driver.rb
|