spreewald 1.2.14 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +18 -2
- data/lib/spreewald/web_steps.rb +23 -2
- data/lib/spreewald_support/version.rb +1 -1
- data/tests/rails-2.3/Gemfile.lock +4 -1
- data/tests/rails-2.3/features/support/selectors.rb +43 -0
- data/tests/rails-3.2/capybara-1/Gemfile.lock +4 -1
- data/tests/rails-3.2/capybara-1/features/support/selectors.rb +43 -0
- data/tests/rails-3.2/capybara-2/Gemfile.lock +4 -1
- data/tests/shared/app/views/static_pages/see_element.html.haml +2 -0
- data/tests/shared/features/shared/web_steps.feature +10 -1
- data/tests/shared/features/support/selectors.rb +43 -0
- metadata +19 -11
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NGFhYWJkZjY5OTM3NmZlMzIzNDA2MzYyZmM4YWFmNTg2NGNkNTM1Mw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f5ec1825f75d18526b1dfd8b7d87176b668ba69d
|
4
|
+
data.tar.gz: 609b83408b678029224561918bcc0cdfaf232924
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NzJjZmY3MTczMzVjY2VkZjk3MWU4N2QyNzcyZDI5MDE2OGJhMjQzOGM1YWQ0
|
11
|
-
OTBiNTJmZmRjYTU5YzZmZjA4NTQzNzMwYzE1Yzk0ODJiNzU0MmM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZWU0ZDlkNTZjOWYyMDE3ZjI2MzkzMzJiNWM3MzFmYThmZDQwZWIwODYwYWYz
|
14
|
-
OWZiNGQ1NDgyOGUxN2JjZTdmY2ZmNDU4ZWJkZTcwODI4NmNhZTlkMDFlZjIx
|
15
|
-
MTU2NDM3YmViMDVjMjdhNDljOGE2ZWFlZGQyMDJmMmI3MTRhYmQ=
|
6
|
+
metadata.gz: 037de990af78547368e9b8e2148f65cd17492bcc8a219c665f8c84015c01be0774ea62c4c62a3b5bfb306d1f005aad1f032fe069c732ec61bbe9bf5707c37db8
|
7
|
+
data.tar.gz: 55268100bd3e011ea57b6d80c97dcd4d71f81bad3bc7efed972dbe5bb46abd46fe64737053753fc14736eeabbe9b7b6fdbc9661bd866ada3ceff1e3f8d38df7a
|
data/README.md
CHANGED
@@ -528,7 +528,7 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
528
528
|
More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
|
529
529
|
|
530
530
|
|
531
|
-
* **Then (the tag )?"..." should be hidden
|
531
|
+
* **Then (the tag )?"..." should be hidden**
|
532
532
|
|
533
533
|
Checks that an element is actually present and hidden, also considering styles.
|
534
534
|
Within a selenium test, the browser is asked whether the element is really hidden.
|
@@ -552,9 +552,25 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
552
552
|
|
553
553
|
* **Then I should (not )?see an element "..."**
|
554
554
|
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
* **Then I should (not )?see ((a |an |the )?("...")|...) element**
|
559
|
+
|
560
|
+
Check that an element with the given selector is present on the page.
|
561
|
+
|
555
562
|
Example:
|
556
563
|
|
557
|
-
|
564
|
+
Then I should see a ".panel" element
|
565
|
+
Then I should not see ".sidebar" element
|
566
|
+
Then I should see the ".twitter-timeline" element
|
567
|
+
|
568
|
+
We recommend to [define a `selector_for` method](https://github.com/makandra/spreewald/blob/master/examples/selectors.rb) in `features/support/selectors.rb`
|
569
|
+
so you can refer to the selector in plain English:
|
570
|
+
|
571
|
+
Then I should see a panel element
|
572
|
+
Then I should not see a sidebar element
|
573
|
+
Then I should see the Twitter timeline element
|
558
574
|
|
559
575
|
|
560
576
|
|
data/lib/spreewald/web_steps.rb
CHANGED
@@ -469,17 +469,38 @@ Then /^"([^"]*)" should link to "([^"]*)"$/ do |link_label, target|
|
|
469
469
|
end
|
470
470
|
end
|
471
471
|
|
472
|
+
Then /^I should (not )?see an element "([^"]*)"$/ do |negate, selector|
|
473
|
+
warn %(The step 'I should see an element "..."' is deprecated. Please use 'I should see a "..." element instead')
|
474
|
+
expectation = negate ? :should_not : :should
|
475
|
+
patiently do
|
476
|
+
page.send(expectation, have_css(selector))
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
# Check that an element with the given selector is present on the page.
|
481
|
+
#
|
472
482
|
# Example:
|
473
483
|
#
|
474
|
-
#
|
484
|
+
# Then I should see a ".panel" element
|
485
|
+
# Then I should not see ".sidebar" element
|
486
|
+
# Then I should see the ".twitter-timeline" element
|
475
487
|
#
|
476
|
-
|
488
|
+
# We recommend to [define a `selector_for` method](https://github.com/makandra/spreewald/blob/master/examples/selectors.rb) in `features/support/selectors.rb`
|
489
|
+
# so you can refer to the selector in plain English:
|
490
|
+
#
|
491
|
+
# Then I should see a panel element
|
492
|
+
# Then I should not see a sidebar element
|
493
|
+
# Then I should see the Twitter timeline element
|
494
|
+
#
|
495
|
+
Then /^I should (not )?see (?:(?:a |an |the )?("[^"]+")|(.*?)) element$/ do |negate, locator_with_quotes, locator_without_quotes|
|
477
496
|
expectation = negate ? :should_not : :should
|
497
|
+
selector = selector_for(locator_with_quotes || locator_without_quotes)
|
478
498
|
patiently do
|
479
499
|
page.send(expectation, have_css(selector))
|
480
500
|
end
|
481
501
|
end
|
482
502
|
|
503
|
+
|
483
504
|
# Checks that the result has content type `text/plain`
|
484
505
|
Then /^I should get a text response$/ do
|
485
506
|
step 'I should get a response with content-type "text/plain"'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module HtmlSelectorsHelpers
|
2
|
+
# Maps a name to a selector. Used primarily by the
|
3
|
+
#
|
4
|
+
# When /^(.+) within (.+)$/ do |step, scope|
|
5
|
+
#
|
6
|
+
# step definitions in web_steps.rb
|
7
|
+
#
|
8
|
+
def selector_for(locator)
|
9
|
+
case locator
|
10
|
+
|
11
|
+
when /^a panel?$/
|
12
|
+
'.panel'
|
13
|
+
|
14
|
+
when /^the timeline?$/
|
15
|
+
'.timeline'
|
16
|
+
|
17
|
+
# Add more mappings here.
|
18
|
+
# Here is an example that pulls values out of the Regexp:
|
19
|
+
#
|
20
|
+
# when /^the (notice|error|info) flash$/
|
21
|
+
# ".flash.#{$1}"
|
22
|
+
|
23
|
+
# You can also return an array to use a different selector
|
24
|
+
# type, like:
|
25
|
+
#
|
26
|
+
# when /the header/
|
27
|
+
# [:xpath, "//header"]
|
28
|
+
|
29
|
+
# This allows you to provide a quoted selector as the scope
|
30
|
+
# for "within" steps as was previously the default for the
|
31
|
+
# web steps:
|
32
|
+
when /^"(.+)"$/
|
33
|
+
$1
|
34
|
+
|
35
|
+
else
|
36
|
+
raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
|
37
|
+
"Now, go and add a mapping in #{__FILE__}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
World(HtmlSelectorsHelpers)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module HtmlSelectorsHelpers
|
2
|
+
# Maps a name to a selector. Used primarily by the
|
3
|
+
#
|
4
|
+
# When /^(.+) within (.+)$/ do |step, scope|
|
5
|
+
#
|
6
|
+
# step definitions in web_steps.rb
|
7
|
+
#
|
8
|
+
def selector_for(locator)
|
9
|
+
case locator
|
10
|
+
|
11
|
+
when /^a panel?$/
|
12
|
+
'.panel'
|
13
|
+
|
14
|
+
when /^the timeline?$/
|
15
|
+
'.timeline'
|
16
|
+
|
17
|
+
# Add more mappings here.
|
18
|
+
# Here is an example that pulls values out of the Regexp:
|
19
|
+
#
|
20
|
+
# when /^the (notice|error|info) flash$/
|
21
|
+
# ".flash.#{$1}"
|
22
|
+
|
23
|
+
# You can also return an array to use a different selector
|
24
|
+
# type, like:
|
25
|
+
#
|
26
|
+
# when /the header/
|
27
|
+
# [:xpath, "//header"]
|
28
|
+
|
29
|
+
# This allows you to provide a quoted selector as the scope
|
30
|
+
# for "within" steps as was previously the default for the
|
31
|
+
# web steps:
|
32
|
+
when /^"(.+)"$/
|
33
|
+
$1
|
34
|
+
|
35
|
+
else
|
36
|
+
raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
|
37
|
+
"Now, go and add a mapping in #{__FILE__}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
World(HtmlSelectorsHelpers)
|
@@ -82,4 +82,13 @@ Feature: Web steps
|
|
82
82
|
And "visible ümläüt" should be visible
|
83
83
|
And a hidden string with quotes should not be visible
|
84
84
|
And a visible string with quotes should be visible
|
85
|
-
And "hidden ümläüt" should be hidden
|
85
|
+
And "hidden ümläüt" should be hidden
|
86
|
+
|
87
|
+
Scenario: /^I should (not )?see (?:|a|an |the )(.*?) element$/
|
88
|
+
When I go to "/static_pages/see_element"
|
89
|
+
Then I should see a ".panel" element
|
90
|
+
And I should see the ".panel" element
|
91
|
+
And I should see a panel element
|
92
|
+
But I should not see a ".timeline" element
|
93
|
+
And I should not see the ".timeline" element
|
94
|
+
And I should not see the timeline element
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module HtmlSelectorsHelpers
|
2
|
+
# Maps a name to a selector. Used primarily by the
|
3
|
+
#
|
4
|
+
# When /^(.+) within (.+)$/ do |step, scope|
|
5
|
+
#
|
6
|
+
# step definitions in web_steps.rb
|
7
|
+
#
|
8
|
+
def selector_for(locator)
|
9
|
+
case locator
|
10
|
+
|
11
|
+
when /^a panel?$/
|
12
|
+
'.panel'
|
13
|
+
|
14
|
+
when /^the timeline?$/
|
15
|
+
'.timeline'
|
16
|
+
|
17
|
+
# Add more mappings here.
|
18
|
+
# Here is an example that pulls values out of the Regexp:
|
19
|
+
#
|
20
|
+
# when /^the (notice|error|info) flash$/
|
21
|
+
# ".flash.#{$1}"
|
22
|
+
|
23
|
+
# You can also return an array to use a different selector
|
24
|
+
# type, like:
|
25
|
+
#
|
26
|
+
# when /the header/
|
27
|
+
# [:xpath, "//header"]
|
28
|
+
|
29
|
+
# This allows you to provide a quoted selector as the scope
|
30
|
+
# for "within" steps as was previously the default for the
|
31
|
+
# web steps:
|
32
|
+
when /^"(.+)"$/
|
33
|
+
$1
|
34
|
+
|
35
|
+
else
|
36
|
+
raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
|
37
|
+
"Now, go and add a mapping in #{__FILE__}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
World(HtmlSelectorsHelpers)
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreewald
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Kraze
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber-rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: cucumber
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: capybara
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: A collection of cucumber steps we use in our projects, including steps
|
@@ -61,7 +61,7 @@ executables:
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
-
- .gitignore
|
64
|
+
- ".gitignore"
|
65
65
|
- LICENSE
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- tests/rails-2.3/config/routes.rb
|
106
106
|
- tests/rails-2.3/features/support/env.rb
|
107
107
|
- tests/rails-2.3/features/support/paths.rb
|
108
|
+
- tests/rails-2.3/features/support/selectors.rb
|
108
109
|
- tests/rails-2.3/scripts/generate
|
109
110
|
- tests/rails-3.2/.DS_Store
|
110
111
|
- tests/rails-3.2/capybara-1/.firefox-version
|
@@ -124,6 +125,7 @@ files:
|
|
124
125
|
- tests/rails-3.2/capybara-1/config/routes.rb
|
125
126
|
- tests/rails-3.2/capybara-1/features/support/env.rb
|
126
127
|
- tests/rails-3.2/capybara-1/features/support/paths.rb
|
128
|
+
- tests/rails-3.2/capybara-1/features/support/selectors.rb
|
127
129
|
- tests/rails-3.2/capybara-2/.firefox-version
|
128
130
|
- tests/rails-3.2/capybara-2/Gemfile
|
129
131
|
- tests/rails-3.2/capybara-2/Gemfile.lock
|
@@ -145,6 +147,7 @@ files:
|
|
145
147
|
- tests/shared/app/views/static_pages/click_on.html.haml
|
146
148
|
- tests/shared/app/views/static_pages/home.html.haml
|
147
149
|
- tests/shared/app/views/static_pages/link_to_home.html.haml
|
150
|
+
- tests/shared/app/views/static_pages/see_element.html.haml
|
148
151
|
- tests/shared/app/views/static_pages/visibility.html.haml
|
149
152
|
- tests/shared/app/views/tables/table1.html.haml
|
150
153
|
- tests/shared/config/cucumber.yml
|
@@ -155,6 +158,7 @@ files:
|
|
155
158
|
- tests/shared/features/shared/table_steps.feature
|
156
159
|
- tests/shared/features/shared/web_steps.feature
|
157
160
|
- tests/shared/features/support/paths.rb
|
161
|
+
- tests/shared/features/support/selectors.rb
|
158
162
|
- tests/shared/public/favicon.ico
|
159
163
|
- tests/shared/public/javascripts/jquery-1.7.2.min.js
|
160
164
|
homepage: https://github.com/makandra/spreewald
|
@@ -167,12 +171,12 @@ require_paths:
|
|
167
171
|
- lib
|
168
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
169
173
|
requirements:
|
170
|
-
- -
|
174
|
+
- - ">="
|
171
175
|
- !ruby/object:Gem::Version
|
172
176
|
version: '0'
|
173
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
178
|
requirements:
|
175
|
-
- -
|
179
|
+
- - ">="
|
176
180
|
- !ruby/object:Gem::Version
|
177
181
|
version: '0'
|
178
182
|
requirements: []
|
@@ -201,6 +205,7 @@ test_files:
|
|
201
205
|
- tests/rails-2.3/config/routes.rb
|
202
206
|
- tests/rails-2.3/features/support/env.rb
|
203
207
|
- tests/rails-2.3/features/support/paths.rb
|
208
|
+
- tests/rails-2.3/features/support/selectors.rb
|
204
209
|
- tests/rails-2.3/scripts/generate
|
205
210
|
- tests/rails-3.2/.DS_Store
|
206
211
|
- tests/rails-3.2/capybara-1/.firefox-version
|
@@ -220,6 +225,7 @@ test_files:
|
|
220
225
|
- tests/rails-3.2/capybara-1/config/routes.rb
|
221
226
|
- tests/rails-3.2/capybara-1/features/support/env.rb
|
222
227
|
- tests/rails-3.2/capybara-1/features/support/paths.rb
|
228
|
+
- tests/rails-3.2/capybara-1/features/support/selectors.rb
|
223
229
|
- tests/rails-3.2/capybara-2/.firefox-version
|
224
230
|
- tests/rails-3.2/capybara-2/Gemfile
|
225
231
|
- tests/rails-3.2/capybara-2/Gemfile.lock
|
@@ -241,6 +247,7 @@ test_files:
|
|
241
247
|
- tests/shared/app/views/static_pages/click_on.html.haml
|
242
248
|
- tests/shared/app/views/static_pages/home.html.haml
|
243
249
|
- tests/shared/app/views/static_pages/link_to_home.html.haml
|
250
|
+
- tests/shared/app/views/static_pages/see_element.html.haml
|
244
251
|
- tests/shared/app/views/static_pages/visibility.html.haml
|
245
252
|
- tests/shared/app/views/tables/table1.html.haml
|
246
253
|
- tests/shared/config/cucumber.yml
|
@@ -251,5 +258,6 @@ test_files:
|
|
251
258
|
- tests/shared/features/shared/table_steps.feature
|
252
259
|
- tests/shared/features/shared/web_steps.feature
|
253
260
|
- tests/shared/features/support/paths.rb
|
261
|
+
- tests/shared/features/support/selectors.rb
|
254
262
|
- tests/shared/public/favicon.ico
|
255
263
|
- tests/shared/public/javascripts/jquery-1.7.2.min.js
|