spreewald 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -54,6 +54,7 @@ The "Steps" section is autogenerated by `rake update_readme` from comments in th
54
54
 
55
55
  ### development_steps.rb
56
56
 
57
+ Marks scenario as pending
57
58
 
58
59
  * **Then it should work**
59
60
 
@@ -82,13 +83,13 @@ The "Steps" section is autogenerated by `rake update_readme` from comments in th
82
83
 
83
84
  * **When I clear my e?mails**
84
85
 
85
-
86
+
86
87
 
87
88
 
88
89
  * **Then (an|no) e?mail should have been sent with:**
89
90
 
90
91
  Example:
91
-
92
+
92
93
  Then an email should have been sent with:
93
94
  """
94
95
  From: max.mustermann@example.com
@@ -97,7 +98,7 @@ The "Steps" section is autogenerated by `rake update_readme` from comments in th
97
98
  Body: ...
98
99
  Attachments: ...
99
100
  """
100
-
101
+
101
102
  You can skip lines, of course.
102
103
 
103
104
 
@@ -108,7 +109,7 @@ The "Steps" section is autogenerated by `rake update_readme` from comments in th
108
109
 
109
110
  * **Then no e?mail should have been sent**
110
111
 
111
-
112
+
112
113
 
113
114
 
114
115
  * **Then I should see "..." in the e?mail**
@@ -124,9 +125,9 @@ The "Steps" section is autogenerated by `rake update_readme` from comments in th
124
125
  * **Then that e?mail should have the following lines in the body:**
125
126
 
126
127
  Only works after you've retrieved the email using "Then an email should have been sent with:"
127
-
128
+
128
129
  Example:
129
-
130
+
130
131
  And that mail should have the following lines in the body:
131
132
  """
132
133
  All of these lines
@@ -149,7 +150,7 @@ See [this article](https://makandracards.com/makandra/763-cucumber-step-to-match
149
150
 
150
151
  * **Then I should( not)? see a table with the following rows( in any order)?**
151
152
 
152
-
153
+
153
154
 
154
155
 
155
156
 
@@ -162,7 +163,7 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
162
163
  * **When the (date|time) is "(\d{4}-\d{2}-\d{2}( \d{1,2}:\d{2})?)"**
163
164
 
164
165
  Example:
165
-
166
+
166
167
  Given the date is "2012-02-10"
167
168
  Given the time is "2012-02-10 13:40"
168
169
 
@@ -170,14 +171,14 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
170
171
  * **When the time is "(\d{1,2}:\d{2})"**
171
172
 
172
173
  Example:
173
-
174
+
174
175
  Given the time is "13:40"
175
176
 
176
177
 
177
178
  * **When it is (\d+|a|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)**
178
179
 
179
180
  Example:
180
-
181
+
181
182
  When it is 10 minutes later
182
183
  When it is a few hours earlier
183
184
 
@@ -185,7 +186,7 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
185
186
 
186
187
  ### web_steps.rb
187
188
 
188
- Most of cucumber-rails' original web steps plus a few of our own.
189
+ Most of cucumber-rails' original web steps plus a few of our own.
189
190
 
190
191
  Note that cucumber-rails deprecated all its steps quite a while ago with the following
191
192
  deprecation notice. Decide for yourself whether you want to use them:
@@ -210,31 +211,30 @@ deprecation notice. Decide for yourself whether you want to use them:
210
211
 
211
212
  * **When ... within (.*[^:])**
212
213
 
213
- You can append 'within [selector]' to any other web step.
214
-
214
+ You can append 'within [selector]' to any other web step
215
215
  Example:
216
-
216
+
217
217
  Then I should see "some text" within ".page_body"
218
218
 
219
219
 
220
220
  * **Given I am on ...**
221
221
 
222
-
222
+
223
223
 
224
224
 
225
225
  * **When I go to ...**
226
226
 
227
-
227
+
228
228
 
229
229
 
230
230
  * **When I press "..."**
231
231
 
232
-
232
+
233
233
 
234
234
 
235
235
  * **When I follow "..."**
236
236
 
237
-
237
+
238
238
 
239
239
 
240
240
  * **When I fill in "..." (with|for) "..."**
@@ -269,31 +269,31 @@ deprecation notice. Decide for yourself whether you want to use them:
269
269
 
270
270
  * **When I attach the file "..." to "..."**
271
271
 
272
-
272
+
273
273
 
274
274
 
275
275
  * **Then I should see "..."**
276
276
 
277
277
  Checks that some text appears on the page
278
-
278
+
279
279
  Note that this does not detect if the text might be hidden via CSS
280
280
 
281
281
 
282
282
  * **Then I should see \/([^\/]*)\/**
283
283
 
284
284
  Checks that a regexp appears on the page
285
-
285
+
286
286
  Note that this does not detect if the text might be hidden via CSS
287
287
 
288
288
 
289
289
  * **Then I should not see "..."**
290
290
 
291
-
291
+
292
292
 
293
293
 
294
294
  * **Then I should not see \/([^\/]*)\/**
295
295
 
296
-
296
+
297
297
 
298
298
 
299
299
  * **Then the "..." field( within ...)? should contain "..."**
@@ -303,7 +303,7 @@ deprecation notice. Decide for yourself whether you want to use them:
303
303
 
304
304
  * **Then the "..." field( within ...)? should not contain "..."**
305
305
 
306
-
306
+
307
307
 
308
308
 
309
309
  * **Then the "..." field should have the error "..."**
@@ -313,32 +313,32 @@ deprecation notice. Decide for yourself whether you want to use them:
313
313
 
314
314
  * **Then the "..." field should( not)? have an error**
315
315
 
316
-
316
+
317
317
 
318
318
 
319
319
  * **Then the "..." field should have no error**
320
320
 
321
-
321
+
322
322
 
323
323
 
324
324
  * **Then the radio button "..." should( not)? be (checked|selected)**
325
325
 
326
-
326
+
327
327
 
328
328
 
329
329
  * **Then I should be on ...**
330
330
 
331
-
331
+
332
332
 
333
333
 
334
334
  * **Then I should have the following query string:**
335
335
 
336
336
  Example:
337
-
337
+
338
338
  I should have the following query string:
339
339
  | locale | de |
340
340
  | currency_code | EUR |
341
-
341
+
342
342
  Succeeds when the URL contains the given "locale" and "currency_code" params
343
343
 
344
344
 
@@ -355,9 +355,9 @@ deprecation notice. Decide for yourself whether you want to use them:
355
355
  * **Then I should( not)? see the (number|amount) ([\-\d,\.]+)( (.*?))?**
356
356
 
357
357
  Better way to test for a number of money amount than a `Then I should see`
358
-
358
+
359
359
  Checks that there is unexpected minus sign, decimal places etc.
360
-
360
+
361
361
  See [here](https://makandracards.com/makandra/1225-test-that-a-number-or-money-amount-is-shown-with-cucumber) for details
362
362
 
363
363
 
@@ -378,7 +378,7 @@ deprecation notice. Decide for yourself whether you want to use them:
378
378
 
379
379
  * **Then nothing should be selected for "..."?**
380
380
 
381
-
381
+
382
382
 
383
383
 
384
384
  * **Then "..." should( not)? be an option for "..."**
@@ -398,7 +398,7 @@ deprecation notice. Decide for yourself whether you want to use them:
398
398
 
399
399
  * **Then I should not see "..." in the HTML**
400
400
 
401
-
401
+
402
402
 
403
403
 
404
404
  * **Then I should see an error**
@@ -408,15 +408,15 @@ deprecation notice. Decide for yourself whether you want to use them:
408
408
 
409
409
  * **When I reload the page**
410
410
 
411
+
411
412
 
412
413
 
413
-
414
- * **Then "..." should( not)? be visible**
414
+ * **Then (the tag )?"..." should( not)? be visible**
415
415
 
416
416
  Checks that an element is actually visible, also considering styles
417
417
  Within a selenium test, the browser is asked whether the element is really visible
418
418
  In a non-selenium test, we only check for ".hidden", ".invisible" or "style: display:none"
419
-
419
+
420
420
  More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
421
421
 
422
422
 
@@ -428,7 +428,7 @@ deprecation notice. Decide for yourself whether you want to use them:
428
428
  * **Then I should (not )?see an element "..."**
429
429
 
430
430
  Example:
431
-
431
+
432
432
  Then I should see an element ".page .container"
433
433
 
434
434
 
@@ -442,44 +442,44 @@ deprecation notice. Decide for yourself whether you want to use them:
442
442
 
443
443
  Click a link within an element matching the given selector. Will try to be clever
444
444
  and disregard elements that don't contain a matching link.
445
-
445
+
446
446
  Example:
447
-
447
+
448
448
  When I follow "Read more" inside any ".text_snippet"
449
449
 
450
450
 
451
451
 
452
452
  * **Then I should( not)? see "..." inside any "..."**
453
453
 
454
-
454
+
455
455
 
456
456
 
457
457
  * **When I fill in "..." with "..." inside any "..."**
458
458
 
459
-
459
+
460
460
 
461
461
 
462
462
  * **When I confirm the browser dialog**
463
463
 
464
-
464
+
465
465
 
466
466
 
467
467
  * **When I cancel the browser dialog**
468
468
 
469
-
469
+
470
470
 
471
471
 
472
472
  * **When I enter "..." into the browser dialog**
473
473
 
474
-
474
+
475
475
 
476
476
 
477
477
  * **Then I should see in this order:?**
478
478
 
479
479
  Checks that these strings are rendered in the given order in a single line or in multiple lines
480
-
480
+
481
481
  Example:
482
-
482
+
483
483
  Then I should see in this order:
484
484
  | Alpha Group |
485
485
  | Augsburg |
@@ -362,7 +362,12 @@ Then /^the window should be titled "([^"]*)"$/ do |title|
362
362
  end
363
363
 
364
364
  When /^I reload the page$/ do
365
- visit current_path
365
+ case Capybara::current_driver
366
+ when :selenium
367
+ visit page.driver.browser.current_url
368
+ else
369
+ visit [ current_path, page.driver.last_request.env['QUERY_STRING'] ].reject(&:blank?).join('?')
370
+ end
366
371
  end
367
372
 
368
373
  # Checks that an element is actually visible, also considering styles
@@ -370,29 +375,29 @@ end
370
375
  # In a non-selenium test, we only check for ".hidden", ".invisible" or "style: display:none"
371
376
  #
372
377
  # More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
373
- Then /^"([^\"]+)" should( not)? be visible$/ do |text, negate|
378
+ Then /^(the tag )?"([^\"]+)" should( not)? be visible$/ do |tag, selector_or_text, negate|
374
379
  case Capybara::current_driver
375
380
  when :selenium, :webkit
376
381
  patiently do
377
382
  visibility_detecting_javascript = %[
378
383
  (function() {
379
384
 
380
- var containsSelector = ':contains(#{text.to_json})';
385
+ var selector = #{tag ? selector_or_text.to_json : "':contains(#{selector_or_text.to_json})'"};
381
386
  var jqueryLoaded = (typeof jQuery != 'undefined');
382
387
 
383
388
  function findCandidates() {
384
389
  if (jqueryLoaded) {
385
- return $(containsSelector);
390
+ return $(selector);
386
391
  } else {
387
- return $$(containsSelector);
392
+ return $$(selector);
388
393
  }
389
394
  }
390
395
 
391
396
  function isExactCandidate(candidate) {
392
397
  if (jqueryLoaded) {
393
- return $(candidate).find(containsSelector).length == 0;
398
+ return $(candidate).find(selector).length == 0;
394
399
  } else {
395
- return candidate.select(containsSelector).length == 0;
400
+ return candidate.select(selector).length == 0;
396
401
  }
397
402
  }
398
403
 
@@ -420,7 +425,11 @@ Then /^"([^\"]+)" should( not)? be visible$/ do |text, negate|
420
425
  page.evaluate_script(visibility_detecting_javascript).should matcher
421
426
  end
422
427
  else
423
- invisibility_detecting_matcher = have_css('.hidden, .invisible, [style~="display: none"]', :text => text)
428
+ invisibility_detecting_matcher = if tag
429
+ have_css(".hidden, .invisible, [style~=\"display: none\"] #{selector_or_text}")
430
+ else
431
+ have_css('.hidden, .invisible, [style~="display: none"]', :text => selector_or_text)
432
+ end
424
433
  expectation = negate ? :should : :should_not # sic
425
434
  page.send(expectation, invisibility_detecting_matcher)
426
435
  end
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module Spreewald
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.5"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreewald
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 4
10
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Kraze
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-21 00:00:00 +01:00
18
+ date: 2012-11-23 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  requirements: []
123
123
 
124
124
  rubyforge_project:
125
- rubygems_version: 1.3.9.4
125
+ rubygems_version: 1.3.9.5
126
126
  signing_key:
127
127
  specification_version: 3
128
128
  summary: Collection of useful cucumber steps.