appium_capybara 1.8.1 → 2.0.0.rc2

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
  SHA256:
3
- metadata.gz: 838caf9468d6e6513df67cc554df7109b7efeb4154960f0355af05613cf6cd25
4
- data.tar.gz: 800173f5e38349d0264a2fd978f9bfb201d3af333c495f816fd165c5af371358
3
+ metadata.gz: 947bfdf7c0237c37cce5004a3173afbd77ed90e71f51006570d480e9f69dab4c
4
+ data.tar.gz: 251188882b88ddb6dc53efbe7fc8c9bafaf983464b4625f401ebdb9cc8875a16
5
5
  SHA512:
6
- metadata.gz: 5617b2c7eb1b8745aae6ee8bc0752952c3609a7d8fca3c6469bc395f1779ecf16ef8cc2039ecb9c5bba63ca7393b1e4cbaf85f15e8686ac1fe073e8ade342c1c
7
- data.tar.gz: a9df43925ed328b4a8a1fc1d123c177dedacb1ecbf331627e8bdbc96c0fcc0e14cb18ce1684b8469baf1d010b70d96d04daf00fab09ef9ee3c38743c776fc41f
6
+ metadata.gz: 016614a0eace8a1b7b811c42d038c088ca86327473253f2fe6b42554748291587e7b196373676f39c63fbaf7f51979ff2f6913e56284330589e0c930f5bc89a6
7
+ data.tar.gz: 43a4f79e36c663bdb0aa975bbd5553fe3a184fb97b6af275366b4359e943931f1dcd9f47d8b8731cba088c6dbf5f64349527f9b9de3062d43130fd1da2a229ac
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # appium_capybara [![Gem Version](https://badge.fury.io/rb/appium_capybara.svg)](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: "7.1",
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: url
27
+ server_url: url
26
28
  }
27
29
  all_options = {
28
- appium_lib: appium_lib_options,
29
- caps: desired_caps_ios
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+
@@ -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.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', '>= 9.15.0'
23
- s.add_runtime_dependency 'capybara', '~> 3.19'
22
+ s.add_runtime_dependency 'appium_lib', '12.0.0.rc5'
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
@@ -1,6 +1,6 @@
1
1
  [caps]
2
2
  platformName = "ios"
3
- platformVersion = "12.2"
3
+ platformVersion = "15.0"
4
4
  deviceName ="iPhone Simulator"
5
5
  automationName = 'XCUITest'
6
6
  app = "./UICatalog.app.zip"
@@ -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
- capy_driver.appium_driver.find_element(:name, 'TextFields').click
14
- expect(capy_driver.find_custom(:name, '<enter text>').size).to be 3
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, '<enter text>')[0].send_keys 'abc'
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
@@ -78,6 +78,26 @@ module Appium::Capybara
78
78
  browser.execute_script('mobile: scroll', direction: 'down')
79
79
  end
80
80
 
81
+ # new
82
+ def swipe(opts)
83
+ start_x = opts.fetch :start_x, 0
84
+ start_y = opts.fetch :start_y, 0
85
+ end_x = opts.fetch :end_x, 0
86
+ end_y = opts.fetch :end_y, 0
87
+ duration = opts.fetch :duration, 200
88
+
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
99
+ end
100
+
81
101
  # new
82
102
  # Use :landscape or :portrait
83
103
  def rotate(opts)
@@ -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 = if selector.format == :css
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 = '1.8.1'.freeze unless defined? ::Appium::Capybara::VERSION
4
- DATE = '2019-06-23'.freeze unless defined? ::Appium::Capybara::DATE
3
+ VERSION = '2.0.0.rc2'.freeze unless defined? ::Appium::Capybara::VERSION
4
+ DATE = '2021-11-05'.freeze unless defined? ::Appium::Capybara::DATE
5
5
  end
6
6
  end
data/release_notes.md CHANGED
@@ -1,3 +1,16 @@
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
+
8
+ #### v1.9.0 2019-07-11
9
+
10
+ - [8c42306](https://github.com/appium/appium_capybara/commit/8c423067b4347ab64521f298737e76d1164f9929) Release 1.9.0
11
+ - [ad6df40](https://github.com/appium/appium_capybara/commit/ad6df40144c372dcac538f8f43054bf521f99695) feat: Added swipe feature for android and ios (#50)
12
+
13
+
1
14
  #### v1.8.1 2019-06-23
2
15
 
3
16
  - [805b248](https://github.com/appium/appium_capybara/commit/805b24839f414c936e408739a871be9df3620fbf) Release 1.8.1
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: 1.8.1
4
+ version: 2.0.0.rc2
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: 2019-06-23 00:00:00.000000000 Z
13
+ date: 2021-11-05 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: 9.15.0
21
+ version: 12.0.0.rc5
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: 9.15.0
28
+ version: 12.0.0.rc5
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.19'
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.19'
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: '0.0'
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: '0.0'
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.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
- version: '0'
105
+ version: 1.3.1
126
106
  requirements: []
127
- rubygems_version: 3.0.1
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: []