appium_capybara 1.9.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +29 -4
- data/appium_capybara.gemspec +5 -5
- data/example/appium.txt +1 -1
- data/example/spec/capybara_init.rb +1 -1
- data/example/spec/ios_example_spec.rb +21 -3
- data/lib/appium_capybara/driver/appium/driver.rb +10 -1
- data/lib/appium_capybara/ext/selector_query_ext.rb +31 -13
- data/lib/appium_capybara/version.rb +2 -2
- data/release_notes.md +7 -0
- metadata +15 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0634d48c60b2246e9a42aaedbdb7f72a42063651e56968056152429277e93bbc
|
4
|
+
data.tar.gz: 685dd99bb13802ab16c877cbf520b3376eda7805fb44403aa8e43fce41be5a65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c01a45692198f6b19815e38af5961db137f4e2588c22c1adcf7855322c02d8be447cfc2f0ee13b6ad089f9c82fb7a8230c33a9efe03ef5a78fc1d9c47c58b50a
|
7
|
+
data.tar.gz: ace7cde1c74fee6d1c13a3461945d9d67053320f25555715ed680b102ad7a819f9001d367f50862d0cb2e4c2470cf14d3282580ced8a7851ea5ad275ffde5936
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# appium_capybara [](http://badge.fury.io/rb/appium_capybara)
|
2
2
|
|
3
|
+
[Documentation](https://www.rubydoc.info/gems/appium_capybara/)
|
4
|
+
|
3
5
|
Gem enabling appium support in capybara
|
4
6
|
|
5
7
|
Please use `v1.4.1` for Capybara 2.x users. `v1.5.0` requires Capybara 3.x.
|
@@ -14,7 +16,7 @@ desired_caps_ios = {
|
|
14
16
|
platform: "Mac",
|
15
17
|
deviceName: "iPhone Simulator",
|
16
18
|
platformName: "iOS",
|
17
|
-
platformVersion: "
|
19
|
+
platformVersion: "12.4",
|
18
20
|
app: "full/path/to/app.zip"
|
19
21
|
}
|
20
22
|
|
@@ -22,11 +24,11 @@ url = "http://localhost:4723/wd/hub" # or a sauce labs url
|
|
22
24
|
|
23
25
|
Capybara.register_driver(:appium) do |app|
|
24
26
|
appium_lib_options = {
|
25
|
-
server_url:
|
27
|
+
server_url: url
|
26
28
|
}
|
27
29
|
all_options = {
|
28
|
-
appium_lib:
|
29
|
-
caps:
|
30
|
+
appium_lib: appium_lib_options,
|
31
|
+
caps: desired_caps_ios
|
30
32
|
}
|
31
33
|
Appium::Capybara::Driver.new app, all_options
|
32
34
|
end
|
@@ -46,7 +48,30 @@ Capybara.server_host = '0.0.0.0' # Listen to all interfaces
|
|
46
48
|
Capybara.server_port = 56844 # Open port TCP 56844, change at your convenience
|
47
49
|
```
|
48
50
|
|
51
|
+
## Call methods
|
52
|
+
|
53
|
+
appium_capybara provides both Capybara methods and appium_lib methods.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
capy_driver = Capybara.current_session.driver
|
57
|
+
|
58
|
+
# Calls methods defined in Appium::Capybara::Driver and Capybara::Selenium::Driver
|
59
|
+
capy_driver.find_custom :name, '<enter text>'
|
60
|
+
|
61
|
+
# Calls methods defined in only appium_lib (Appium::Driver)
|
62
|
+
capy_driver.appium_driver.find_element(:name, 'TextFields').click
|
63
|
+
capy_driver.appium_driver.hide_keyboard
|
64
|
+
```
|
65
|
+
|
49
66
|
## Publishing to rubygems
|
50
67
|
|
51
68
|
Make sure to run `thor bump` or manually modify version.rb before publishing. RubyGems will not allow the same
|
52
69
|
version to be published twice. After the version is bumped, run `thor publish`
|
70
|
+
|
71
|
+
|
72
|
+
## Changelogs
|
73
|
+
|
74
|
+
- v2.0.0
|
75
|
+
- Bump base appium_lib version to v12
|
76
|
+
- Bump base capybara version to over 3.36
|
77
|
+
- Support Ruby 2.6+
|
data/appium_capybara.gemspec
CHANGED
@@ -7,7 +7,7 @@ class Gem::Specification
|
|
7
7
|
end
|
8
8
|
|
9
9
|
Gem::Specification.new do |s|
|
10
|
-
s.required_ruby_version = '>= 2.
|
10
|
+
s.required_ruby_version = '>= 2.6'
|
11
11
|
|
12
12
|
s.name = 'appium_capybara'
|
13
13
|
s.version = Appium::Capybara::VERSION
|
@@ -19,11 +19,11 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.homepage = 'https://github.com/appium/appium_capybara'
|
20
20
|
s.require_paths = ['lib']
|
21
21
|
|
22
|
-
s.add_runtime_dependency 'appium_lib', '
|
23
|
-
s.add_runtime_dependency 'capybara', '~> 3.
|
22
|
+
s.add_runtime_dependency 'appium_lib', '~> 12.0.0'
|
23
|
+
s.add_runtime_dependency 'capybara', '~> 3.36'
|
24
|
+
|
25
|
+
s.add_development_dependency 'appium_thor', '~> 1.1.6'
|
24
26
|
|
25
|
-
s.add_development_dependency 'appium_thor', '~> 0.0', '>= 0.0.7'
|
26
|
-
s.add_development_dependency 'pry'
|
27
27
|
|
28
28
|
s.files = s.remove_zip_files(`git ls-files`.split("\n"))
|
29
29
|
end
|
data/example/appium.txt
CHANGED
@@ -12,7 +12,7 @@ Capybara.register_driver(:appium) do |app|
|
|
12
12
|
all_options = caps.merge(appium_lib: { server_url: url }, global_driver: false)
|
13
13
|
puts all_options.inspect
|
14
14
|
|
15
|
-
Appium::Capybara::Driver.new app, all_options
|
15
|
+
Appium::Capybara::Driver.new app, **all_options
|
16
16
|
end
|
17
17
|
|
18
18
|
Capybara.default_driver = :appium
|
@@ -10,10 +10,28 @@ describe 'UICatalog smoke test' do
|
|
10
10
|
capy_driver = Capybara.current_session.driver
|
11
11
|
|
12
12
|
# Call appium driver's methods
|
13
|
-
|
14
|
-
|
13
|
+
Capybara.current_session.driver.appium_driver.find_element(:name, 'Buttons').click
|
14
|
+
Capybara.current_session.driver.appium_driver.wait do
|
15
|
+
expect(capy_driver.find_custom(:class_name, 'XCUIElementTypeButton').size).to be 6
|
16
|
+
end
|
15
17
|
|
16
18
|
# Get Appium::Capybara::Node elements
|
17
|
-
capy_driver.find_custom(:name, '
|
19
|
+
expect(capy_driver.find_custom(:name, 'X Button')[0].name).to eq('X Button')
|
20
|
+
|
21
|
+
e = Capybara.current_session.find(:xpath, '//XCUIElementTypeNavigationBar')
|
22
|
+
expect(e.find(:class, 'XCUIElementTypeButton').text).to eq('UICatalog')
|
23
|
+
|
24
|
+
Capybara.current_session.driver.appium_driver.back
|
25
|
+
|
26
|
+
capy_driver.swipe({start_x: 100, start_y: 500, end_x: 100, end_y: 200})
|
27
|
+
Capybara.current_session.driver.appium_driver.find_element(:name, 'Text Fields').click
|
28
|
+
|
29
|
+
e = capy_driver.find_custom(:predicate, 'value == "Placeholder text"').first
|
30
|
+
e.send_keys [:shift, :end]
|
31
|
+
|
32
|
+
e = Capybara.current_session.find(:xpath, '//XCUIElementTypeTextField[@value=""]')
|
33
|
+
e.send_keys [:shift, :end]
|
34
|
+
|
35
|
+
expect(e.text).to eq("")
|
18
36
|
end
|
19
37
|
end
|
@@ -86,7 +86,16 @@ module Appium::Capybara
|
|
86
86
|
end_y = opts.fetch :end_y, 0
|
87
87
|
duration = opts.fetch :duration, 200
|
88
88
|
|
89
|
-
|
89
|
+
action_builder = browser.action
|
90
|
+
input = action_builder.pointer_inputs[0]
|
91
|
+
action_builder
|
92
|
+
.move_to_location(start_x, start_y)
|
93
|
+
.pointer_down(:left)
|
94
|
+
.pause(input, duration / 1000)
|
95
|
+
.move_to_location(end_x, end_y)
|
96
|
+
.pause(input, 1)
|
97
|
+
.release
|
98
|
+
.perform
|
90
99
|
end
|
91
100
|
|
92
101
|
# new
|
@@ -2,21 +2,39 @@ class Capybara::Queries::SelectorQuery < Capybara::Queries::BaseQuery
|
|
2
2
|
|
3
3
|
# @api private
|
4
4
|
def resolve_for(node, exact = nil)
|
5
|
+
applied_filters.clear
|
6
|
+
@resolved_node = node
|
7
|
+
@resolved_count += 1
|
5
8
|
node.synchronize do
|
6
|
-
children =
|
7
|
-
node.find_css(css)
|
8
|
-
elsif selector.format == :xpath
|
9
|
-
node.find_xpath(xpath(exact))
|
10
|
-
else
|
11
|
-
node.find_custom(selector.format, @expression)
|
12
|
-
end.map do |child|
|
13
|
-
if node.is_a?(Capybara::Node::Base)
|
14
|
-
Capybara::Node::Element.new(node.session, child, node, self)
|
15
|
-
else
|
16
|
-
Capybara::Node::Simple.new(child)
|
17
|
-
end
|
18
|
-
end
|
9
|
+
children = find_nodes_by_selector_format(node, exact).map(&method(:to_element))
|
19
10
|
Capybara::Result.new(children, self)
|
20
11
|
end
|
21
12
|
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
# https://github.com/teamcapybara/capybara/blob/a7ebe1216f8d65f2e96c170437a732777353a81d/lib/capybara/queries/selector_query.rb#L227
|
17
|
+
def find_nodes_by_selector_format(node, exact)
|
18
|
+
hints = {}
|
19
|
+
hints[:uses_visibility] = true unless visible == :all
|
20
|
+
hints[:texts] = text_fragments unless selector_format == :xpath
|
21
|
+
hints[:styles] = options[:style] if use_default_style_filter?
|
22
|
+
hints[:position] = true if use_spatial_filter?
|
23
|
+
|
24
|
+
if selector_format == :css
|
25
|
+
if node.method(:find_css).arity != 1
|
26
|
+
node.find_css(css, **hints)
|
27
|
+
else
|
28
|
+
node.find_css(css)
|
29
|
+
end
|
30
|
+
elsif selector_format == :xpath
|
31
|
+
if node.method(:find_xpath).arity != 1
|
32
|
+
node.find_xpath(xpath(exact), **hints)
|
33
|
+
else
|
34
|
+
node.find_xpath(xpath(exact))
|
35
|
+
end
|
36
|
+
else
|
37
|
+
node.find_custom(selector_format, @expression)
|
38
|
+
end
|
39
|
+
end
|
22
40
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Appium
|
2
2
|
module Capybara
|
3
|
-
VERSION = '
|
4
|
-
DATE = '
|
3
|
+
VERSION = '2.0.0'.freeze unless defined? ::Appium::Capybara::VERSION
|
4
|
+
DATE = '2021-11-11'.freeze unless defined? ::Appium::Capybara::DATE
|
5
5
|
end
|
6
6
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
#### v1.10.0 2019-11-23
|
2
|
+
|
3
|
+
- [2a0a739](https://github.com/appium/appium_capybara/commit/2a0a739685b571ab8d54655f924ed078c45d3bbe) Release 1.10.0
|
4
|
+
- [7b3baf1](https://github.com/appium/appium_capybara/commit/7b3baf11af0775935812bcfb5a83d18f1d2c7cb6) for capybara 3.27+ (#55)
|
5
|
+
- [541fe41](https://github.com/appium/appium_capybara/commit/541fe419e0cb96cc8ccb9426c72c4774c4f44a09) chore: Update readme and the ios test app (#54)
|
6
|
+
|
7
|
+
|
1
8
|
#### v1.9.0 2019-07-11
|
2
9
|
|
3
10
|
- [8c42306](https://github.com/appium/appium_capybara/commit/8c423067b4347ab64521f298737e76d1164f9929) Release 1.9.0
|
metadata
CHANGED
@@ -1,79 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- scott.bonebrake@gmail.com
|
8
8
|
- code@bootstraponline.com
|
9
9
|
- jason.s.carr@gmail.com
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: appium_lib
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - "
|
19
|
+
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 12.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- - "
|
26
|
+
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
28
|
+
version: 12.0.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: capybara
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '3.
|
35
|
+
version: '3.36'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '3.
|
42
|
+
version: '3.36'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: appium_thor
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 0.0.7
|
49
|
+
version: 1.1.6
|
53
50
|
type: :development
|
54
51
|
prerelease: false
|
55
52
|
version_requirements: !ruby/object:Gem::Requirement
|
56
53
|
requirements:
|
57
54
|
- - "~>"
|
58
55
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 0.0.7
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: pry
|
65
|
-
requirement: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
56
|
+
version: 1.1.6
|
77
57
|
description: Enables appium support in Capybara.
|
78
58
|
email:
|
79
59
|
- scott.bonebrake@gmail.com
|
@@ -109,7 +89,7 @@ homepage: https://github.com/appium/appium_capybara
|
|
109
89
|
licenses:
|
110
90
|
- http://www.apache.org/licenses/LICENSE-2.0.txt
|
111
91
|
metadata: {}
|
112
|
-
post_install_message:
|
92
|
+
post_install_message:
|
113
93
|
rdoc_options: []
|
114
94
|
require_paths:
|
115
95
|
- lib
|
@@ -117,15 +97,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
97
|
requirements:
|
118
98
|
- - ">="
|
119
99
|
- !ruby/object:Gem::Version
|
120
|
-
version: '2.
|
100
|
+
version: '2.6'
|
121
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
102
|
requirements:
|
123
103
|
- - ">="
|
124
104
|
- !ruby/object:Gem::Version
|
125
105
|
version: '0'
|
126
106
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
128
|
-
signing_key:
|
107
|
+
rubygems_version: 3.2.15
|
108
|
+
signing_key:
|
129
109
|
specification_version: 4
|
130
110
|
summary: Enables appium support in Capybara
|
131
111
|
test_files: []
|