appium_capybara 3.2.0 → 3.3.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/CHANGELOG.md +15 -0
- data/Gemfile +2 -1
- data/README.md +93 -24
- data/Rakefile +3 -0
- data/appium_capybara.gemspec +6 -0
- data/contributing.md +5 -22
- data/lib/appium_capybara/driver/appium/driver.rb +14 -2
- data/lib/appium_capybara/driver/appium/node.rb +8 -3
- data/lib/appium_capybara/version.rb +2 -2
- metadata +5 -8
- data/.github/workflows/run_example.yml +0 -68
- data/Thorfile +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fefc79777a33211ebc6e074e06b7492c36b30c1b3e78c3238d341ed4c16ad7d9
|
|
4
|
+
data.tar.gz: '0189794800803c4d0cfc133aba42d9393f87f38ebb15effc752413e2edb71709'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78d3eeb43f5e6e36fc44672ca2f6f892506d2e5b9f488344f04348ca06bd7e75bcda3dc507a7f25158d3bc77208810f128247c49ad6dae5fcf4cee983fb6fcfd
|
|
7
|
+
data.tar.gz: 6818d7abcfcc18d0ff9d6bcb3ad8a6730b117829b1e3ccb69506f25411f2ec65be284b5a5a8a7e8572c86b804239197650ab0ff36609f05afada29c8bca6177f
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Historical commit-level notes through 3.2.0 are in [release_notes.md](release_notes.md).
|
|
4
|
+
New entries are maintained by Release Please.
|
|
5
|
+
|
|
6
|
+
## [3.3.0](https://github.com/appium/appium_capybara/compare/v3.2.0...v3.3.0) (2026-10-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* use W3C actions for scroll_up, scroll_down, and long_press ([#83](https://github.com/appium/appium_capybara/issues/83)) ([021893a](https://github.com/appium/appium_capybara/commit/021893a2a657d31e97d476fdd3ddf48082d348d0))
|
|
12
|
+
|
|
13
|
+
## [3.2.0] - 2025-01-25
|
|
14
|
+
|
|
15
|
+
- See the historical release notes for this release.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -7,30 +7,28 @@ Gem enabling appium support in capybara
|
|
|
7
7
|
Please use `v1.4.1` for Capybara 2.x users. `v1.5.0` requires Capybara 3.x.
|
|
8
8
|
|
|
9
9
|
## Driver Setup
|
|
10
|
-
Set up the appium_capybara driver by
|
|
10
|
+
Set up the `appium_capybara` driver by registering `:appium` with Capybara before starting your tests:
|
|
11
11
|
|
|
12
12
|
```ruby
|
|
13
13
|
require 'appium_capybara'
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
app
|
|
15
|
+
capabilities = {
|
|
16
|
+
'platformName' => 'ios',
|
|
17
|
+
'platformVersion' => ENV['PLATFORM_VERSION'] || '17.4',
|
|
18
|
+
'appium:deviceName' => ENV['DEVICE_NAME'] || 'iPhone 15 Plus',
|
|
19
|
+
'appium:automationName' => 'xcuitest',
|
|
20
|
+
'appium:app' => File.expand_path('path/to/UICatalog.app.zip')
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
url =
|
|
23
|
+
url = 'http://localhost:4723' # or a remote/cloud server URL
|
|
24
24
|
|
|
25
25
|
Capybara.register_driver(:appium) do |app|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
Appium::Capybara::Driver.new app, all_options
|
|
26
|
+
Appium::Capybara::Driver.new(
|
|
27
|
+
app,
|
|
28
|
+
capabilities: capabilities,
|
|
29
|
+
appium_lib: { server_url: url },
|
|
30
|
+
global_driver: false
|
|
31
|
+
)
|
|
34
32
|
end
|
|
35
33
|
|
|
36
34
|
Capybara.default_driver = :appium
|
|
@@ -48,25 +46,96 @@ Capybara.server_host = '0.0.0.0' # Listen to all interfaces
|
|
|
48
46
|
Capybara.server_port = 56844 # Open port TCP 56844, change at your convenience
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
##
|
|
49
|
+
## Using Capybara DSL & Custom Selectors
|
|
52
50
|
|
|
53
|
-
appium_capybara
|
|
51
|
+
`appium_capybara` registers the following Appium-specific selectors with Capybara in addition to `:xpath` and `:css`:
|
|
52
|
+
- `:id`
|
|
53
|
+
- `:class`
|
|
54
|
+
- `:name`
|
|
55
|
+
- `:accessibility_id`
|
|
56
|
+
- `:custom`
|
|
57
|
+
|
|
58
|
+
You can query elements through `Capybara.current_session` (or directly in RSpec feature specs):
|
|
54
59
|
|
|
55
60
|
```ruby
|
|
56
|
-
|
|
61
|
+
session = Capybara.current_session
|
|
62
|
+
|
|
63
|
+
# Find a single element or all matching elements using Capybara selectors
|
|
64
|
+
nav_bar = session.find(:xpath, '//XCUIElementTypeNavigationBar')
|
|
65
|
+
expect(nav_bar.find(:class, 'XCUIElementTypeButton').text).to eq('UIKitCatalog')
|
|
66
|
+
|
|
67
|
+
buttons = session.all(:class, 'XCUIElementTypeButton')
|
|
68
|
+
expect(buttons.count).to be > 0
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> Note: Web-only Capybara navigation helpers such as `visit` or `click_link` only apply to web/hybrid contexts, not native mobile views.
|
|
57
72
|
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
## Using with SitePrism Page Objects
|
|
74
|
+
|
|
75
|
+
`appium_capybara` works with [SitePrism](https://github.com/site-prism/site_prism) pages and sections using the registered Appium selectors:
|
|
76
|
+
|
|
77
|
+
```ruby
|
|
78
|
+
require 'site_prism'
|
|
79
|
+
|
|
80
|
+
module Sections
|
|
81
|
+
class Sheets < SitePrism::Section
|
|
82
|
+
elements :buttons, :class, 'XCUIElementTypeButton'
|
|
83
|
+
end
|
|
84
|
+
end
|
|
60
85
|
|
|
61
|
-
|
|
86
|
+
module Pages
|
|
87
|
+
class Home < SitePrism::Page
|
|
88
|
+
elements :navigation_bar, :accessibility_id, 'UIKitCatalog'
|
|
89
|
+
section :action_sheets_section, Sections::Sheets, :name, 'Alert Views'
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
home_page = Pages::Home.new
|
|
94
|
+
expect(home_page.navigation_bar.first).to be_truthy
|
|
95
|
+
expect(home_page.action_sheets_section.has_buttons?).to be(false)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Driver & Node Methods
|
|
99
|
+
|
|
100
|
+
`appium_capybara` provides access to both `Appium::Capybara::Driver` helpers and the underlying `appium_lib` (`Appium::Driver`) / Selenium (`Appium::Core::Base::Driver`) instances:
|
|
101
|
+
|
|
102
|
+
```ruby
|
|
103
|
+
capy_driver = Capybara.current_session.driver
|
|
104
|
+
|
|
105
|
+
# Find elements with any Appium finder (:predicate, :class_chain, :uiautomator, :name, etc.)
|
|
106
|
+
# Returns an Array of Appium::Capybara::Node instances
|
|
107
|
+
nodes = capy_driver.find_custom(:predicate, 'value == "Placeholder text"')
|
|
108
|
+
node = nodes.first
|
|
109
|
+
node.name # element name attribute
|
|
110
|
+
node.label # element label attribute
|
|
111
|
+
node.set('abc') # clears the element and sends keys
|
|
112
|
+
node.send_keys([:shift, :end])
|
|
113
|
+
|
|
114
|
+
# Perform a W3C pointer swipe gesture (duration in ms, defaults to 200)
|
|
115
|
+
capy_driver.swipe(start_x: 100, start_y: 500, end_x: 100, end_y: 200, duration: 200)
|
|
116
|
+
|
|
117
|
+
# Scroll or rotate via driver helpers
|
|
118
|
+
capy_driver.scroll_down
|
|
119
|
+
capy_driver.scroll_up
|
|
120
|
+
capy_driver.rotate(:landscape) # or :portrait
|
|
121
|
+
|
|
122
|
+
# Save screenshots and handle alerts
|
|
123
|
+
capy_driver.save_screenshot('screen.png')
|
|
124
|
+
capy_driver.accept_modal(:alert)
|
|
125
|
+
capy_driver.dismiss_modal(:alert)
|
|
126
|
+
|
|
127
|
+
# Call methods defined on appium_lib (Appium::Driver) directly
|
|
62
128
|
capy_driver.appium_driver.find_element(:name, 'TextFields').click
|
|
63
129
|
capy_driver.appium_driver.hide_keyboard
|
|
130
|
+
capy_driver.appium_driver.back
|
|
64
131
|
```
|
|
65
132
|
|
|
133
|
+
See the complete working example in [`example/spec/`](example/spec/).
|
|
134
|
+
|
|
66
135
|
## Publishing to rubygems
|
|
67
136
|
|
|
68
|
-
|
|
69
|
-
|
|
137
|
+
Review and merge the Release Please PR to publish. See [RELEASING.md](RELEASING.md)
|
|
138
|
+
for one-time Trusted Publishing setup and recovery instructions.
|
|
70
139
|
|
|
71
140
|
|
|
72
141
|
## major changelogs
|
data/Rakefile
ADDED
data/appium_capybara.gemspec
CHANGED
|
@@ -22,4 +22,10 @@ Gem::Specification.new do |s|
|
|
|
22
22
|
s.add_dependency 'capybara', '~> 3.36'
|
|
23
23
|
|
|
24
24
|
s.files = s.remove_zip_files(`git ls-files`.split("\n"))
|
|
25
|
+
# Keep release automation out of the published package.
|
|
26
|
+
s.files.reject! do |file|
|
|
27
|
+
file.start_with?('.github/', 'script/', 'test/release/') ||
|
|
28
|
+
%w[RELEASING.md release-please-config.json .release-please-manifest.json].include?(file)
|
|
29
|
+
end
|
|
30
|
+
|
|
25
31
|
end
|
data/contributing.md
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
|
-
appium_capybara strives to follow the [GitHub Ruby style guide](https://github.com/styleguide/ruby)
|
|
1
|
+
appium_capybara strives to follow the [GitHub Ruby style guide](https://github.com/styleguide/ruby).
|
|
2
2
|
|
|
3
|
+
## Building and releasing
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
$ thor list
|
|
8
|
-
default
|
|
9
|
-
-------
|
|
10
|
-
thor build # Build a new gem
|
|
11
|
-
thor bump # Bump the z version number and update the date.
|
|
12
|
-
thor bumpx # Bump the x version number, set y & z to zero, update the date.
|
|
13
|
-
thor bumpy # Bump the y version number, set z to zero, update the date.
|
|
14
|
-
thor byte # Remove non-ascii bytes from all *.rb files in the current dir
|
|
15
|
-
thor docs # Update docs
|
|
16
|
-
thor gem_install # Install gem
|
|
17
|
-
thor gem_uninstall # Uninstall gem
|
|
18
|
-
thor info # prints config info for this gem
|
|
19
|
-
thor notes # Update release notes
|
|
20
|
-
thor publish # Build and release a new gem to rubygems.org
|
|
21
|
-
thor release # Build and release a new gem to rubygems.org (same as publish)
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
To release use `thor bump` then `thor publish`
|
|
5
|
+
Run `bundle install` and `bundle exec rake build` to build locally.
|
|
6
|
+
Release validation uses the shared `ruby-release-validate` Action.
|
|
7
|
+
See [RELEASING.md](RELEASING.md) for automated releases and recovery.
|
|
@@ -69,12 +69,24 @@ module Appium::Capybara
|
|
|
69
69
|
|
|
70
70
|
# new
|
|
71
71
|
def scroll_up
|
|
72
|
-
|
|
72
|
+
window = appium_driver.window_rect
|
|
73
|
+
swipe(
|
|
74
|
+
start_x: window.width / 2,
|
|
75
|
+
start_y: window.height / 10,
|
|
76
|
+
end_x: window.width / 2,
|
|
77
|
+
end_y: window.height * 8 / 10
|
|
78
|
+
)
|
|
73
79
|
end
|
|
74
80
|
|
|
75
81
|
# new
|
|
76
82
|
def scroll_down
|
|
77
|
-
|
|
83
|
+
window = appium_driver.window_rect
|
|
84
|
+
swipe(
|
|
85
|
+
start_x: window.width / 2,
|
|
86
|
+
start_y: window.height * 8 / 10,
|
|
87
|
+
end_x: window.width / 2,
|
|
88
|
+
end_y: window.height / 10
|
|
89
|
+
)
|
|
78
90
|
end
|
|
79
91
|
|
|
80
92
|
# new
|
|
@@ -15,9 +15,14 @@ module Appium::Capybara
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def long_press
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
action_builder = driver.browser.action
|
|
19
|
+
input = action_builder.pointer_inputs[0]
|
|
20
|
+
action_builder
|
|
21
|
+
.move_to(native)
|
|
22
|
+
.pointer_down(:left)
|
|
23
|
+
.pause(device: input, duration: 2)
|
|
24
|
+
.release
|
|
25
|
+
.perform
|
|
21
26
|
end
|
|
22
27
|
|
|
23
28
|
def find_custom(finder, locator)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Appium
|
|
2
2
|
module Capybara
|
|
3
|
-
VERSION = '3.
|
|
4
|
-
DATE = '
|
|
3
|
+
VERSION = '3.3.0'.freeze unless defined? ::Appium::Capybara::VERSION
|
|
4
|
+
DATE = '2026-10-27'.freeze unless defined? ::Appium::Capybara::DATE # x-release-please-date
|
|
5
5
|
end
|
|
6
6
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appium_capybara
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- fly.49.89.over@gmail.com
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: appium_lib
|
|
@@ -45,12 +44,12 @@ executables: []
|
|
|
45
44
|
extensions: []
|
|
46
45
|
extra_rdoc_files: []
|
|
47
46
|
files:
|
|
48
|
-
- ".github/workflows/run_example.yml"
|
|
49
47
|
- ".gitignore"
|
|
48
|
+
- CHANGELOG.md
|
|
50
49
|
- Gemfile
|
|
51
50
|
- LICENSE-2.0.txt
|
|
52
51
|
- README.md
|
|
53
|
-
-
|
|
52
|
+
- Rakefile
|
|
54
53
|
- appium_capybara.gemspec
|
|
55
54
|
- contributing.md
|
|
56
55
|
- example/Gemfile
|
|
@@ -73,7 +72,6 @@ homepage: https://github.com/appium/appium_capybara
|
|
|
73
72
|
licenses:
|
|
74
73
|
- http://www.apache.org/licenses/LICENSE-2.0.txt
|
|
75
74
|
metadata: {}
|
|
76
|
-
post_install_message:
|
|
77
75
|
rdoc_options: []
|
|
78
76
|
require_paths:
|
|
79
77
|
- lib
|
|
@@ -88,8 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
88
86
|
- !ruby/object:Gem::Version
|
|
89
87
|
version: '0'
|
|
90
88
|
requirements: []
|
|
91
|
-
rubygems_version:
|
|
92
|
-
signing_key:
|
|
89
|
+
rubygems_version: 4.0.20
|
|
93
90
|
specification_version: 4
|
|
94
91
|
summary: Enables appium support in Capybara
|
|
95
92
|
test_files: []
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
name: Run example
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
# Run by manual at this time
|
|
5
|
-
workflow_dispatch:
|
|
6
|
-
push:
|
|
7
|
-
branches: [ "master" ]
|
|
8
|
-
pull_request:
|
|
9
|
-
branches: [ "master" ]
|
|
10
|
-
|
|
11
|
-
concurrency:
|
|
12
|
-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
13
|
-
cancel-in-progress: true
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
test:
|
|
17
|
-
|
|
18
|
-
runs-on: macos-14
|
|
19
|
-
|
|
20
|
-
env:
|
|
21
|
-
PLATFORM_VERSION: '17.4'
|
|
22
|
-
XCODE_VERSION: '15.3'
|
|
23
|
-
DEVICE_NAME: iPhone 15 Plus
|
|
24
|
-
|
|
25
|
-
steps:
|
|
26
|
-
- uses: actions/checkout@v3
|
|
27
|
-
|
|
28
|
-
- name: Install Node.js
|
|
29
|
-
uses: actions/setup-node@v3
|
|
30
|
-
with:
|
|
31
|
-
node-version: 'lts/*'
|
|
32
|
-
|
|
33
|
-
- name: Select Xcode
|
|
34
|
-
uses: maxim-lobanov/setup-xcode@v1
|
|
35
|
-
with:
|
|
36
|
-
xcode-version: ${{ env.XCODE_VERSION }}
|
|
37
|
-
- run: defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false
|
|
38
|
-
|
|
39
|
-
- uses: futureware-tech/simulator-action@v3
|
|
40
|
-
with:
|
|
41
|
-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
|
|
42
|
-
model: ${{ env.DEVICE_NAME }}
|
|
43
|
-
os_version: ${{ env.PLATFORM_VERSION }}
|
|
44
|
-
|
|
45
|
-
- name: Install Appium XCUITest
|
|
46
|
-
run: |
|
|
47
|
-
npm install -g appium
|
|
48
|
-
appium driver install xcuitest
|
|
49
|
-
- name: run Appium background
|
|
50
|
-
run: |
|
|
51
|
-
nohup appium --log-timestamp --log-no-colors > appium.log 2>&1 &
|
|
52
|
-
|
|
53
|
-
- name: Set up Ruby
|
|
54
|
-
uses: ruby/setup-ruby@v1
|
|
55
|
-
with:
|
|
56
|
-
ruby-version: 3.2
|
|
57
|
-
- name: Run example
|
|
58
|
-
run: |
|
|
59
|
-
bundle install
|
|
60
|
-
bundle exec rspec spec/ios_example_spec.rb
|
|
61
|
-
working-directory: example
|
|
62
|
-
|
|
63
|
-
- name: Upload appium.log
|
|
64
|
-
if: ${{ always() }}
|
|
65
|
-
uses: actions/upload-artifact@v4
|
|
66
|
-
with:
|
|
67
|
-
path: appium.log
|
|
68
|
-
|