capybara-select-2 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/README.md +7 -0
- data/capybara_select2.gemspec +2 -1
- data/lib/capybara_select2/helpers.rb +1 -0
- data/lib/capybara_select2/selectors.rb +2 -2
- data/lib/capybara_select2/version.rb +1 -1
- metadata +18 -6
- data/ci/install-chrome +0 -11
- data/ci/install-chromedriver +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30e42ae946b9db5831c6b273b80b1375a4b38b04629c13936df6bc6fe39ab259
|
4
|
+
data.tar.gz: 8421aa74a1d08543b75eb69e02dce4c35a30209ddf61e44a2f28482e9d43be95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c31a763c6e2e095c17b77bbc5de112840204a8e4ce3d624ca82390002bab7acbe3802ea93f9c14a01c3b4ca195b5a4f3183ad140f0628359d4076978a2633fd
|
7
|
+
data.tar.gz: f9e4d96512ed254a26acdb6f83291b4b60475991513636c2b6454167d50eba0e16c582222fbe3b921b39384a822866345ab247f84fc305bb86cf14ee94163838
|
data/.rspec
CHANGED
data/README.md
CHANGED
@@ -67,6 +67,8 @@ select2 'Buy Milk', css: '#todo'
|
|
67
67
|
select2 'Buy Milk', xpath: '//div[@id="todo"]'
|
68
68
|
```
|
69
69
|
|
70
|
+
[Note] CSS and xPath selectors should identify a block which wraps select2 element or a select2 element itself (an html element with the `.select2-container` class)
|
71
|
+
|
70
72
|
### Select from select2 control identified by label
|
71
73
|
```ruby
|
72
74
|
select2 'Buy Milk', from: 'Things to do'
|
@@ -92,6 +94,11 @@ select2 'Buy Milk', 'Go to gym', css: '#todo'
|
|
92
94
|
select2 'Buy Milk', from: 'Things to do', search: true, match: :first
|
93
95
|
```
|
94
96
|
|
97
|
+
### Search for exact text in the specified node
|
98
|
+
```ruby
|
99
|
+
select2 'Buy Milk', from: 'Things to do', exact_text: true
|
100
|
+
```
|
101
|
+
|
95
102
|
### Check for select2 option on the page
|
96
103
|
```ruby
|
97
104
|
expect(page).to have_select2_option('Buy Milk')
|
data/capybara_select2.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 2.0"
|
30
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
-
spec.add_development_dependency "rspec", "~> 3.
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.9"
|
32
32
|
spec.add_development_dependency "capybara", "~> 3.12"
|
33
33
|
spec.add_development_dependency "chromedriver-helper", "~> 2.1"
|
34
34
|
spec.add_development_dependency "selenium-webdriver", "~> 3.141.0"
|
@@ -36,4 +36,5 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency "puma", "~> 3.12"
|
37
37
|
spec.add_development_dependency "pry", "~> 0.11.0"
|
38
38
|
spec.add_development_dependency "simplecov", "~> 0.16"
|
39
|
+
spec.add_development_dependency "sinatra", "~> 2.0"
|
39
40
|
end
|
@@ -26,6 +26,7 @@ module CapybaraSelect2
|
|
26
26
|
|
27
27
|
find_options = { text: value }
|
28
28
|
find_options[:match] = options[:match] if options[:match]
|
29
|
+
find_options[:exact_text] = options[:exact_text] if options[:exact_text]
|
29
30
|
find(:xpath, '//body').find(:css, option_selector, find_options).click
|
30
31
|
end
|
31
32
|
end
|
@@ -26,8 +26,8 @@ module CapybaraSelect2
|
|
26
26
|
|
27
27
|
OptionSelectors = {
|
28
28
|
'2' => ".select2-container-active .select2-result",
|
29
|
-
'3' => ".select2-drop-active .select2-result",
|
30
|
-
'4' => ".select2-results .select2-results__option[
|
29
|
+
'3' => ".select2-drop-active .select2-result-label",
|
30
|
+
'4' => ".select2-results .select2-results__option[aria-selected='false']"
|
31
31
|
}.freeze
|
32
32
|
|
33
33
|
def option_selector(select2_version)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-select-2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dzmitry Kavalionak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.9'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.9'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: capybara
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.16'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: sinatra
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '2.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '2.0'
|
153
167
|
description:
|
154
168
|
email:
|
155
169
|
- dzm.kov@gmail.com
|
@@ -170,8 +184,6 @@ files:
|
|
170
184
|
- bin/console
|
171
185
|
- bin/setup
|
172
186
|
- capybara_select2.gemspec
|
173
|
-
- ci/install-chrome
|
174
|
-
- ci/install-chromedriver
|
175
187
|
- lib/capybara-select-2.rb
|
176
188
|
- lib/capybara_select2.rb
|
177
189
|
- lib/capybara_select2/helpers.rb
|
data/ci/install-chrome
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
set -xe
|
4
|
-
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
5
|
-
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
|
6
|
-
|
7
|
-
# Update packages
|
8
|
-
apt-get update -yqqq
|
9
|
-
|
10
|
-
# Install Chrome browser
|
11
|
-
apt-get install -y google-chrome-stable
|
data/ci/install-chromedriver
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
set -xe
|
4
|
-
|
5
|
-
# Update packages
|
6
|
-
apt-get update -yqqq
|
7
|
-
|
8
|
-
# Install Chrome browser
|
9
|
-
apt-get install -y unzip
|
10
|
-
|
11
|
-
# Install/use specific version of chrome if an installed version is lower
|
12
|
-
install_chromedriver() {
|
13
|
-
wget -O $TMPDIR/chromedriver.zip https://chromedriver.storage.googleapis.com/${MIN_CHROMEDRIVER_VER}/chromedriver_linux64.zip
|
14
|
-
mkdir -p $HOME/.chromedriver
|
15
|
-
(cd $HOME/.chromedriver && unzip $TMPDIR/chromedriver.zip && chmod +x chromedriver)
|
16
|
-
rm -f $TMPDIR/chromedriver.zip
|
17
|
-
ln -s $HOME/.chromedriver/chromedriver /usr/local/bin/chromedriver
|
18
|
-
}
|
19
|
-
if ! which chromedriver; then
|
20
|
-
install_chromedriver
|
21
|
-
elif dpkg --compare-versions `chromedriver --version | cut -d " " -f2` lt $MIN_CHROMEDRIVER_VER; then
|
22
|
-
install_chromedriver
|
23
|
-
fi
|