spreewald 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +122 -174
- data/Rakefile +5 -1
- data/lib/spreewald/development_steps.rb +7 -0
- data/lib/spreewald/email_steps.rb +14 -14
- data/lib/spreewald/file_attachment_steps.rb +0 -1
- data/lib/spreewald/timecop_steps.rb +5 -5
- data/lib/spreewald/web_steps.rb +20 -26
- data/lib/spreewald_support/version.rb +1 -1
- data/support/parser.rb +3 -1
- data/support/step_definition.rb +4 -4
- data/support/step_definition_file.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa355b8ab659c4c92bf9bbb82d330c78d3dae334
|
4
|
+
data.tar.gz: 6bdae7b5482fa1db3ff3c1180cd4e21afa976fdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b5b1e7ce0e2c433af02ff362df920076bbfa5e11ea7ff6b28d7bc43a0cc5e5df159638d09fc66daed6506af64cda3665e2aad124e81ec7479dc8b27877a2f8d
|
7
|
+
data.tar.gz: b39e03bad642047b2afd5adb30f805b383675b076306bc99f50233ac0c3944dfda14208094540ac51df04f00dca3918df18b4fa2199d967a7d2527b7f204c721
|
data/README.md
CHANGED
@@ -18,28 +18,36 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install spreewald
|
20
20
|
|
21
|
+
|
21
22
|
## Usage
|
22
23
|
|
23
|
-
|
24
|
+
Require all Spreewald steps by putting
|
24
25
|
|
25
|
-
require 'spreewald/
|
26
|
+
require 'spreewald/all_steps'
|
26
27
|
|
27
28
|
into either your `support/env.rb` or `step_definitions/spreewald_steps.rb`.
|
28
29
|
|
29
|
-
|
30
|
+
Steps are grouped into a number of categories. If you only want to use a subset
|
31
|
+
of Spreewald's steps, you can pick and choose single categories by requiring
|
32
|
+
single files like this:
|
30
33
|
|
31
|
-
require 'spreewald/
|
34
|
+
require 'spreewald/email_steps'
|
35
|
+
require 'spreewald/web_steps'
|
32
36
|
|
33
37
|
|
34
38
|
## Spreewald binary
|
35
39
|
|
36
|
-
Spreewald comes with a binary that prints a list of all
|
40
|
+
Spreewald comes with a binary that prints a list of all Cucumber steps from
|
41
|
+
Spreewald _and your project_. It will filter the list by any string you
|
42
|
+
pass it. Example usage:
|
37
43
|
|
38
44
|
```bash
|
39
45
|
spreewald # lists all steps
|
40
46
|
spreewald mail # lists all steps that contain "mail"
|
41
47
|
```
|
42
48
|
|
49
|
+
The binary also prints paths and selectors; run `spreewald --help` to learn more.
|
50
|
+
|
43
51
|
|
44
52
|
## Waiting for page load
|
45
53
|
|
@@ -92,59 +100,59 @@ If you would like to contribute:
|
|
92
100
|
|
93
101
|
## This README
|
94
102
|
|
95
|
-
The "Steps" section is autogenerated by `rake update_readme` from comments in
|
103
|
+
The "Steps" section is autogenerated by `rake update_readme` from comments in
|
104
|
+
the step definitions.
|
96
105
|
|
97
106
|
|
98
107
|
## Steps
|
99
108
|
|
100
|
-
### development_steps.rb
|
101
|
-
|
102
|
-
|
109
|
+
### development_steps.rb
|
103
110
|
|
104
111
|
* **Then it should work**
|
105
112
|
|
106
|
-
|
113
|
+
Marks scenario as pending
|
107
114
|
|
108
115
|
|
109
116
|
* **Then debugger**
|
110
117
|
|
111
|
-
|
118
|
+
Starts debugger, or Pry if installed
|
112
119
|
|
113
120
|
|
114
|
-
* **
|
121
|
+
* **Then pause**
|
115
122
|
|
116
|
-
|
123
|
+
Pauses Cucumber, but not the application (unlike "Then debugger"). From the
|
124
|
+
test browser, you can interact with your application as you like.
|
117
125
|
|
118
126
|
|
119
|
-
* **AfterStep @
|
127
|
+
* **AfterStep @slow**
|
120
128
|
|
121
|
-
|
129
|
+
Waits 2 seconds after each step
|
122
130
|
|
123
131
|
|
132
|
+
* **AfterStep @single**
|
124
133
|
|
125
|
-
|
134
|
+
Waits for keypress after each step
|
126
135
|
|
127
136
|
|
137
|
+
### email_steps.rb
|
128
138
|
|
129
139
|
* **When I clear my e?mails**
|
130
140
|
|
131
|
-
|
132
|
-
|
133
141
|
|
134
142
|
* **Then (an|no) e?mail should have been sent with:**
|
135
143
|
|
136
|
-
|
144
|
+
Example:
|
137
145
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
146
|
+
Then an email should have been sent with:
|
147
|
+
"""
|
148
|
+
From: max.mustermann@example.com
|
149
|
+
Reply-To: mmuster@gmail.com
|
150
|
+
To: john.doe@example.com
|
151
|
+
Subject: The subject may contain "quotes"
|
152
|
+
Attachments: ...
|
145
153
|
|
146
|
-
|
147
|
-
|
154
|
+
Message body goes here.
|
155
|
+
"""
|
148
156
|
|
149
157
|
You can skip lines, of course. Note that the mail body is only checked for
|
150
158
|
_inclusion_.
|
@@ -152,51 +160,46 @@ The "Steps" section is autogenerated by `rake update_readme` from comments in th
|
|
152
160
|
|
153
161
|
* **When I follow the (first|second|third)? link in the e?mail**
|
154
162
|
|
155
|
-
|
163
|
+
Only works after you have retrieved the mail using "Then an email should have been sent with:"
|
156
164
|
|
157
165
|
|
158
166
|
* **Then no e?mail should have been sent**
|
159
167
|
|
160
|
-
|
161
|
-
|
162
168
|
|
163
169
|
* **Then I should see "..." in the e?mail**
|
164
170
|
|
165
|
-
|
171
|
+
Checks that the last sent email includes some text
|
166
172
|
|
167
173
|
|
168
174
|
* **Then show me the e?mails**
|
169
175
|
|
170
|
-
|
176
|
+
Print all sent emails to STDOUT.
|
171
177
|
|
172
178
|
|
173
179
|
* **Then that e?mail should( not)? have the following lines in the body:**
|
174
180
|
|
175
|
-
|
181
|
+
Only works after you've retrieved the email using "Then an email should have been sent with:"
|
176
182
|
|
177
183
|
Example:
|
178
184
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
185
|
+
And that mail should have the following lines in the body:
|
186
|
+
"""
|
187
|
+
All of these lines
|
188
|
+
need to be present
|
189
|
+
"""
|
184
190
|
|
185
191
|
|
186
192
|
* **Then that e?mail should have the following body:**
|
187
193
|
|
188
|
-
|
194
|
+
Only works after you've retrieved the email using "Then an email should have been sent with:"
|
189
195
|
Checks that the text should be included in the retrieved email
|
190
196
|
|
191
197
|
|
192
|
-
|
193
|
-
### file_attachment_steps.rb
|
194
|
-
|
195
|
-
|
198
|
+
### file_attachment_steps.rb
|
196
199
|
|
197
200
|
* **Given the file "..." was attached( as (.../)?...)? to the ... above( at "...")?**
|
198
201
|
|
199
|
-
|
202
|
+
Attach a file to the given model's last record.
|
200
203
|
|
201
204
|
Example (Company has a `file` attribute):
|
202
205
|
|
@@ -219,21 +222,16 @@ The "Steps" section is autogenerated by `rake update_readme` from comments in th
|
|
219
222
|
Given the file "some_file" was attached to the profile above at "2011-11-11 11:11"
|
220
223
|
|
221
224
|
|
222
|
-
|
223
|
-
|
224
|
-
### table_steps.rb
|
225
|
-
|
226
|
-
|
225
|
+
### table_steps.rb
|
227
226
|
|
228
227
|
* **Then I should( not)? see a table with (exactly )?the following rows( in any order)?:?**
|
229
228
|
|
230
|
-
|
229
|
+
Check the content of tables in your HTML.
|
231
230
|
|
232
231
|
See [this article](https://makandracards.com/makandra/763-cucumber-step-to-match-table-rows-with-capybara) for details.
|
233
232
|
|
234
233
|
|
235
|
-
|
236
|
-
### timecop_steps.rb
|
234
|
+
### timecop_steps.rb
|
237
235
|
|
238
236
|
Steps to travel through time using [Timecop](https://github.com/jtrupiano/timecop).
|
239
237
|
|
@@ -242,29 +240,28 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
|
|
242
240
|
|
243
241
|
* **When the (date|time) is "?(\d{4}-\d{2}-\d{2}( \d{1,2}:\d{2})?)"?**
|
244
242
|
|
245
|
-
|
243
|
+
Example:
|
246
244
|
|
247
|
-
|
248
|
-
|
245
|
+
Given the date is 2012-02-10
|
246
|
+
Given the time is 2012-02-10 13:40
|
249
247
|
|
250
248
|
|
251
249
|
* **When the time is "?(\d{1,2}:\d{2})"?**
|
252
250
|
|
253
|
-
|
251
|
+
Example:
|
254
252
|
|
255
|
-
|
253
|
+
Given the time is 13:40
|
256
254
|
|
257
255
|
|
258
256
|
* **When it is (\d+|a|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)**
|
259
257
|
|
260
|
-
|
258
|
+
Example:
|
261
259
|
|
262
|
-
|
263
|
-
|
264
|
-
|
260
|
+
When it is 10 minutes later
|
261
|
+
When it is a few hours earlier
|
265
262
|
|
266
263
|
|
267
|
-
### web_steps.rb
|
264
|
+
### web_steps.rb
|
268
265
|
|
269
266
|
Most of cucumber-rails' original web steps plus a few of our own.
|
270
267
|
|
@@ -292,183 +289,160 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
292
289
|
|
293
290
|
* **When ... within ...**
|
294
291
|
|
295
|
-
|
292
|
+
You can append `within [selector]` to any other web step.
|
296
293
|
|
297
294
|
Example:
|
298
295
|
|
299
|
-
|
296
|
+
Then I should see "some text" within ".page_body"
|
300
297
|
|
301
298
|
|
302
299
|
* **Given I am on ...**
|
303
300
|
|
304
|
-
|
305
|
-
|
306
301
|
|
307
302
|
* **When I go to ...**
|
308
303
|
|
309
|
-
|
310
|
-
|
311
304
|
|
312
305
|
* **Then I should be on ...**
|
313
306
|
|
314
|
-
|
315
|
-
|
316
307
|
|
317
308
|
* **When I press "..."**
|
318
309
|
|
319
|
-
|
320
|
-
|
321
310
|
|
322
311
|
* **When I follow "..."**
|
323
312
|
|
324
|
-
|
325
|
-
|
326
313
|
|
327
314
|
* **When I fill in "..." (with|for) "..."**
|
328
315
|
|
329
|
-
|
316
|
+
Fill in text field
|
330
317
|
|
331
318
|
|
332
319
|
* **When I fill in "..." (with|for):**
|
333
320
|
|
334
|
-
|
321
|
+
Fill in text field with multi-line block
|
335
322
|
You can use a doc string to supply multi-line text
|
336
323
|
|
337
324
|
Example:
|
338
325
|
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
326
|
+
When I fill in "some field" with:
|
327
|
+
"""
|
328
|
+
Apple
|
329
|
+
Banana
|
330
|
+
Pear
|
331
|
+
"""
|
345
332
|
|
346
333
|
|
347
334
|
* **When I fill in "..." (with|for) '...'**
|
348
335
|
|
349
|
-
|
336
|
+
Fill in text field
|
350
337
|
|
351
338
|
|
352
339
|
* **When I select "..." from "..."**
|
353
340
|
|
354
|
-
|
341
|
+
Select from select box
|
355
342
|
|
356
343
|
|
357
344
|
* **When I check "..."**
|
358
345
|
|
359
|
-
|
346
|
+
Check a checkbox
|
360
347
|
|
361
348
|
|
362
349
|
* **When I uncheck "..."**
|
363
350
|
|
364
|
-
|
351
|
+
Uncheck a checkbox
|
365
352
|
|
366
353
|
|
367
354
|
* **When I choose "..."**
|
368
355
|
|
369
|
-
|
356
|
+
Select a radio button
|
370
357
|
|
371
358
|
|
372
359
|
* **When I attach the file "..." to "..."**
|
373
360
|
|
374
|
-
|
361
|
+
Attach a file to a file upload form field
|
375
362
|
|
376
363
|
|
377
364
|
* **Then I should see "..."**
|
378
365
|
|
379
|
-
|
366
|
+
Checks that some text appears on the page
|
380
367
|
|
381
368
|
Note that this does not detect if the text might be hidden via CSS
|
382
369
|
|
383
370
|
|
384
371
|
* **Then I should see /.../**
|
385
372
|
|
386
|
-
|
373
|
+
Checks that a regexp appears on the page
|
387
374
|
|
388
375
|
Note that this does not detect if the text might be hidden via CSS
|
389
376
|
|
390
377
|
|
391
378
|
* **Then I should not see "..."**
|
392
379
|
|
393
|
-
|
394
|
-
|
395
380
|
|
396
381
|
* **Then I should not see /.../**
|
397
382
|
|
398
|
-
|
399
|
-
|
400
383
|
|
401
384
|
* **Then the "..." field should (not )?contain "..."**
|
402
385
|
|
403
|
-
|
386
|
+
Checks that an input field contains some value (allowing * as wildcard character)
|
404
387
|
|
405
388
|
|
406
389
|
* **Then the "..." field should (not )?contain:**
|
407
390
|
|
408
|
-
|
391
|
+
Checks that a multiline textarea contains some value (allowing * as wildcard character)
|
409
392
|
|
410
393
|
|
411
394
|
* **Then I should see a form with the following values:**
|
412
395
|
|
413
|
-
|
396
|
+
Checks that a list of label/value pairs are visible as control inputs.
|
414
397
|
|
415
398
|
Example:
|
416
399
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
400
|
+
Then I should see a form with the following values:
|
401
|
+
| E-mail | foo@bar.com |
|
402
|
+
| Role | Administrator |
|
421
403
|
|
422
404
|
|
423
405
|
* **Then the "..." field should have the error "..."**
|
424
406
|
|
425
|
-
|
407
|
+
Checks that an input field was wrapped with a validation error
|
426
408
|
|
427
409
|
|
428
410
|
* **Then the "..." field should( not)? have an error**
|
429
411
|
|
430
|
-
|
431
|
-
|
432
412
|
|
433
413
|
* **Then the "..." field should have no error**
|
434
414
|
|
435
|
-
|
436
|
-
|
437
415
|
|
438
416
|
* **Then the "..." checkbox should( not)? be checked**
|
439
417
|
|
440
|
-
|
441
|
-
|
442
418
|
|
443
419
|
* **Then the radio button "..." should( not)? be (checked|selected)**
|
444
420
|
|
445
|
-
|
446
|
-
|
447
421
|
|
448
422
|
* **Then I should have the following query string:**
|
449
423
|
|
450
|
-
|
424
|
+
Example:
|
451
425
|
|
452
|
-
|
453
|
-
|
454
|
-
|
426
|
+
I should have the following query string:
|
427
|
+
| locale | de |
|
428
|
+
| currency_code | EUR |
|
455
429
|
|
456
430
|
Succeeds when the URL contains the given `locale` and `currency_code` params
|
457
431
|
|
458
432
|
|
459
433
|
* **Then show me the page**
|
460
434
|
|
461
|
-
|
435
|
+
Open the current Capybara page using the `launchy` gem
|
462
436
|
|
463
437
|
|
464
438
|
* **Then I should( not)? see a field "..."**
|
465
439
|
|
466
|
-
|
440
|
+
Checks for the existance of an input field (given its id or label)
|
467
441
|
|
468
442
|
|
469
443
|
* **Then I should( not)? see the (number|amount) ([\-\d,\.]+)( ...)?**
|
470
444
|
|
471
|
-
|
445
|
+
Use this step to test for a number or money amount instead of a simple `Then I should see`
|
472
446
|
|
473
447
|
Checks for an unexpected minus sign, correct decimal places etc.
|
474
448
|
|
@@ -477,65 +451,57 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
477
451
|
|
478
452
|
* **Then I should get a response with content-type "..."**
|
479
453
|
|
480
|
-
|
454
|
+
Checks `Content-Type` HTTP header
|
481
455
|
|
482
456
|
|
483
457
|
* **Then I should get a download with filename "..."**
|
484
458
|
|
485
|
-
|
459
|
+
Checks `Content-Disposition` HTTP header
|
486
460
|
|
487
461
|
Attention: Doesn't work with Selenium, see https://github.com/jnicklas/capybara#gotchas
|
488
462
|
|
489
463
|
|
490
464
|
* **Then "..." should be selected for "..."**
|
491
465
|
|
492
|
-
|
466
|
+
Checks that a certain option is selected for a text field
|
493
467
|
|
494
468
|
|
495
469
|
* **Then nothing should be selected for "..."**
|
496
470
|
|
497
|
-
|
498
|
-
|
499
471
|
|
500
472
|
* **Then "..." should( not)? be an option for "..."**
|
501
473
|
|
502
|
-
|
474
|
+
Checks for the presence of an option in a select
|
503
475
|
|
504
476
|
|
505
477
|
* **Then I should see '...'**
|
506
478
|
|
507
|
-
|
479
|
+
Like `Then I should see`, but with single instead of double quotes. In case
|
508
480
|
the expected string contains quotes as well.
|
509
481
|
|
510
482
|
|
511
483
|
* **Then I should see "..." in the HTML**
|
512
484
|
|
513
|
-
|
485
|
+
Check that the raw HTML contains a string
|
514
486
|
|
515
487
|
|
516
488
|
* **Then I should not see "..." in the HTML**
|
517
489
|
|
518
|
-
|
519
|
-
|
520
490
|
|
521
491
|
* **Then I should see an error**
|
522
492
|
|
523
|
-
|
493
|
+
Checks that status code is 400..599
|
524
494
|
|
525
495
|
|
526
496
|
* **Then the window should be titled "..."**
|
527
497
|
|
528
|
-
|
529
|
-
|
530
498
|
|
531
499
|
* **When I reload the page**
|
532
500
|
|
533
|
-
|
534
|
-
|
535
501
|
|
536
502
|
* **Then (the tag )?"..." should( not)? be visible**
|
537
503
|
|
538
|
-
|
504
|
+
Checks that an element is actually present and visible, also considering styles.
|
539
505
|
Within a selenium test, the browser is asked whether the element is really visible
|
540
506
|
In a non-selenium test, we only check for `.hidden`, `.invisible` or `style: display:none`
|
541
507
|
|
@@ -546,14 +512,14 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
546
512
|
|
547
513
|
* **Then (the tag )?"..." should be hidden**
|
548
514
|
|
549
|
-
|
515
|
+
Checks that an element is actually present and hidden, also considering styles.
|
550
516
|
Within a selenium test, the browser is asked whether the element is really hidden.
|
551
517
|
In a non-selenium test, we only check for `.hidden`, `.invisible` or `style: display:none`
|
552
518
|
|
553
519
|
|
554
520
|
* **When I click on "..."**
|
555
521
|
|
556
|
-
|
522
|
+
Click on some text that might not be a link.
|
557
523
|
|
558
524
|
Example:
|
559
525
|
|
@@ -563,7 +529,7 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
563
529
|
|
564
530
|
* **When I click on the element "..."**
|
565
531
|
|
566
|
-
|
532
|
+
Click on an element with the given selector.
|
567
533
|
|
568
534
|
Example:
|
569
535
|
|
@@ -573,7 +539,7 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
573
539
|
|
574
540
|
* **When I click on the element for ...**
|
575
541
|
|
576
|
-
|
542
|
+
Click on the element with the given [selector alias](https://github.com/makandra/spreewald/blob/master/examples/selectors.rb).
|
577
543
|
|
578
544
|
Example:
|
579
545
|
|
@@ -582,7 +548,7 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
582
548
|
|
583
549
|
* **Then "..." should link to "..."**
|
584
550
|
|
585
|
-
|
551
|
+
Use this step to check external links.
|
586
552
|
|
587
553
|
Example:
|
588
554
|
|
@@ -593,10 +559,9 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
593
559
|
got: "http://makandra.com/" (using =~)
|
594
560
|
|
595
561
|
|
596
|
-
|
597
562
|
* **Then I should (not )?see (an|the) element "..."**
|
598
563
|
|
599
|
-
|
564
|
+
Check that an element with the given selector is present on the page.
|
600
565
|
|
601
566
|
Example:
|
602
567
|
|
@@ -606,10 +571,9 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
606
571
|
Then I should not see the element ".sidebar"
|
607
572
|
|
608
573
|
|
609
|
-
|
610
574
|
* **Then I should (not )?see (an|the) element for ...**
|
611
575
|
|
612
|
-
|
576
|
+
Check that an element with the given [selector alias](https://github.com/makandra/spreewald/blob/master/examples/selectors.rb) is present on the page.
|
613
577
|
|
614
578
|
Example:
|
615
579
|
|
@@ -619,98 +583,82 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
619
583
|
Then I should not see the element for the sidebar
|
620
584
|
|
621
585
|
|
622
|
-
|
623
586
|
* **Then I should get a text response**
|
624
587
|
|
625
|
-
|
588
|
+
Checks that the result has content type `text/plain`
|
626
589
|
|
627
590
|
|
628
591
|
* **When I follow "..." inside any "..."**
|
629
592
|
|
630
|
-
|
593
|
+
Click a link within an element matching the given selector. Will try to be clever
|
631
594
|
and disregard elements that don't contain a matching link.
|
632
595
|
|
633
596
|
Example:
|
634
597
|
|
635
|
-
|
636
|
-
|
598
|
+
When I follow "Read more" inside any ".text_snippet"
|
637
599
|
|
638
600
|
|
639
601
|
* **Then I should( not)? see "..." inside any "..."**
|
640
602
|
|
641
|
-
|
642
|
-
|
643
603
|
|
644
604
|
* **When I fill in "..." with "..." inside any "..."**
|
645
605
|
|
646
|
-
|
647
|
-
|
648
606
|
|
649
607
|
* **When I confirm the browser dialog**
|
650
608
|
|
651
|
-
|
652
|
-
|
653
609
|
|
654
610
|
* **When I cancel the browser dialog**
|
655
611
|
|
656
|
-
|
657
|
-
|
658
612
|
|
659
613
|
* **When I enter "..." into the browser dialog**
|
660
614
|
|
661
|
-
|
662
|
-
|
663
615
|
|
664
616
|
* **When I switch to the new tab**
|
665
617
|
|
666
|
-
|
667
|
-
|
668
618
|
|
669
619
|
* **Then I should see in this order:?**
|
670
620
|
|
671
|
-
|
621
|
+
Checks that these strings are rendered in the given order in a single line or in multiple lines
|
672
622
|
|
673
623
|
Example:
|
674
624
|
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
625
|
+
Then I should see in this order:
|
626
|
+
| Alpha Group |
|
627
|
+
| Augsburg |
|
628
|
+
| Berlin |
|
629
|
+
| Beta Group |
|
681
630
|
|
682
631
|
|
683
632
|
* **Then the "..." (field|button) should( not)? be disabled**
|
684
633
|
|
685
|
-
|
634
|
+
Tests that an input or button with the given label is disabled.
|
686
635
|
|
687
636
|
|
688
637
|
* **Then the "..." field should( not)? be visible**
|
689
638
|
|
690
|
-
|
639
|
+
Tests that a field with the given label is visible.
|
691
640
|
|
692
641
|
|
693
642
|
* **When I wait for the page to load**
|
694
643
|
|
695
|
-
|
644
|
+
Waits for the page to finish loading and AJAX requests to finish.
|
696
645
|
|
697
646
|
More details [here](https://makandracards.com/makandra/12139-waiting-for-page-loads-and-ajax-requests-to-finish-with-capybara).
|
698
647
|
|
699
648
|
|
700
649
|
* **When I perform basic authentication as ".../..." and go to ...**
|
701
650
|
|
702
|
-
|
651
|
+
Performs HTTP basic authentication with the given credentials and visits the given path.
|
703
652
|
|
704
653
|
More details [here](https://makandracards.com/makandra/971-perform-http-basic-authentication-in-cucumber).
|
705
654
|
|
706
655
|
|
707
656
|
* **When I go back**
|
708
657
|
|
709
|
-
|
658
|
+
Goes to the previously viewed page.
|
710
659
|
|
711
660
|
|
712
661
|
* **Then the "..." select should( not)? be sorted**
|
713
662
|
|
714
|
-
|
663
|
+
Tests whether a select field is sorted. Uses Array#natural_sort, if defined;
|
715
664
|
Array#sort else.
|
716
|
-
|
data/Rakefile
CHANGED
@@ -6,6 +6,7 @@ task :default => 'all:rubies'
|
|
6
6
|
|
7
7
|
desc 'Update the "Steps" section of the README'
|
8
8
|
task :update_readme do
|
9
|
+
readme_path = 'README.md'
|
9
10
|
if Kernel.respond_to? :require_relative
|
10
11
|
require_relative './support/step_manager'
|
11
12
|
else
|
@@ -16,7 +17,10 @@ task :update_readme do
|
|
16
17
|
start_of_steps_section = readme =~ /^## Steps/
|
17
18
|
length_of_steps_section = (readme[(start_of_steps_section+1)..-1] =~ /^##[^#]/) || readme.size - start_of_steps_section
|
18
19
|
readme[start_of_steps_section, length_of_steps_section] = "## Steps\n\n" + StepManager.new('lib/spreewald').to_markdown
|
19
|
-
File.open(
|
20
|
+
File.open(readme_path, 'w') { |f| f.write(readme) }
|
21
|
+
|
22
|
+
system "git diff #{readme_path}"
|
23
|
+
puts '', '> Done (see diff above).'
|
20
24
|
end
|
21
25
|
|
22
26
|
namespace :all do
|
@@ -16,6 +16,13 @@ Then /^debugger$/ do
|
|
16
16
|
true # Ruby will halt in this line
|
17
17
|
end.overridable
|
18
18
|
|
19
|
+
# Pauses Cucumber, but not the application (unlike "Then debugger"). From the
|
20
|
+
# test browser, you can interact with your application as you like.
|
21
|
+
Then /^pause$/ do
|
22
|
+
print 'Paused. Continue?'
|
23
|
+
STDIN.getc
|
24
|
+
end.overridable
|
25
|
+
|
19
26
|
# Waits 2 seconds after each step
|
20
27
|
AfterStep('@slow-motion') do
|
21
28
|
sleep 2
|
@@ -12,16 +12,16 @@ end.overridable
|
|
12
12
|
|
13
13
|
# Example:
|
14
14
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
15
|
+
# Then an email should have been sent with:
|
16
|
+
# """
|
17
|
+
# From: max.mustermann@example.com
|
18
|
+
# Reply-To: mmuster@gmail.com
|
19
|
+
# To: john.doe@example.com
|
20
|
+
# Subject: The subject may contain "quotes"
|
21
|
+
# Attachments: ...
|
22
22
|
#
|
23
|
-
#
|
24
|
-
#
|
23
|
+
# Message body goes here.
|
24
|
+
# """
|
25
25
|
#
|
26
26
|
# You can skip lines, of course. Note that the mail body is only checked for
|
27
27
|
# _inclusion_.
|
@@ -97,11 +97,11 @@ end.overridable
|
|
97
97
|
#
|
98
98
|
# Example:
|
99
99
|
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
100
|
+
# And that mail should have the following lines in the body:
|
101
|
+
# """
|
102
|
+
# All of these lines
|
103
|
+
# need to be present
|
104
|
+
# """
|
105
105
|
Then /^that e?mail should( not)? have the following lines in the body:$/ do |negate, body|
|
106
106
|
expectation = negate ? 'should_not' : 'should'
|
107
107
|
email_text_body = MailFinder.email_text_body(@mail)
|
@@ -19,7 +19,6 @@
|
|
19
19
|
# To simultaneously set the `updated_at` timestamp:
|
20
20
|
#
|
21
21
|
# Given the file "some_file" was attached to the profile above at "2011-11-11 11:11"
|
22
|
-
#
|
23
22
|
Given /^the file "([^"]*)" was attached(?: as (?:([^"]*)\/)?([^"]*))? to the ([^"]*) above(?: at "([^"]*)")?$/ do
|
24
23
|
|path_to_file, container_name, relation_name, model_name, time_string|
|
25
24
|
|
@@ -42,23 +42,23 @@ if defined?(Timecop)
|
|
42
42
|
|
43
43
|
# Example:
|
44
44
|
#
|
45
|
-
#
|
46
|
-
#
|
45
|
+
# Given the date is 2012-02-10
|
46
|
+
# Given the time is 2012-02-10 13:40
|
47
47
|
When /^the (?:date|time) is "?(\d{4}-\d{2}-\d{2}(?: \d{1,2}:\d{2})?)"?$/ do |time|
|
48
48
|
Timecop.travel(parse_time(time))
|
49
49
|
end.overridable
|
50
50
|
|
51
51
|
# Example:
|
52
52
|
#
|
53
|
-
#
|
53
|
+
# Given the time is 13:40
|
54
54
|
When /^the time is "?(\d{1,2}:\d{2})"?$/ do |time_without_date|
|
55
55
|
Timecop.travel(parse_time(time_without_date)) # date will be today
|
56
56
|
end.overridable
|
57
57
|
|
58
58
|
# Example:
|
59
59
|
#
|
60
|
-
#
|
61
|
-
#
|
60
|
+
# When it is 10 minutes later
|
61
|
+
# When it is a few hours earlier
|
62
62
|
When /^it is (\d+|a|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)$/ do |amount, unit, direction|
|
63
63
|
amount = case amount
|
64
64
|
when 'a'
|
data/lib/spreewald/web_steps.rb
CHANGED
@@ -33,11 +33,11 @@ require 'uri'
|
|
33
33
|
require 'cgi'
|
34
34
|
|
35
35
|
|
36
|
-
# You can append `within [selector]` to any other web step
|
36
|
+
# You can append `within [selector]` to any other web step.
|
37
37
|
#
|
38
38
|
# Example:
|
39
39
|
#
|
40
|
-
#
|
40
|
+
# Then I should see "some text" within ".page_body"
|
41
41
|
When /^(.*) within (.*[^:])$/ do |nested_step, parent|
|
42
42
|
patiently do
|
43
43
|
with_scope(parent) { step(nested_step) }
|
@@ -99,12 +99,12 @@ end.overridable
|
|
99
99
|
#
|
100
100
|
# Example:
|
101
101
|
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
102
|
+
# When I fill in "some field" with:
|
103
|
+
# """
|
104
|
+
# Apple
|
105
|
+
# Banana
|
106
|
+
# Pear
|
107
|
+
# """
|
108
108
|
When /^(?:|I )fill in "([^"]*)" (?:with|for):$/ do |field, value|
|
109
109
|
patiently do
|
110
110
|
fill_in(field, :with => value)
|
@@ -218,10 +218,9 @@ end.overridable
|
|
218
218
|
#
|
219
219
|
# Example:
|
220
220
|
#
|
221
|
-
#
|
222
|
-
#
|
223
|
-
#
|
224
|
-
#
|
221
|
+
# Then I should see a form with the following values:
|
222
|
+
# | E-mail | foo@bar.com |
|
223
|
+
# | Role | Administrator |
|
225
224
|
Then /^I should see a form with the following values:$/ do |table|
|
226
225
|
expectations = table.raw
|
227
226
|
expectations.each do |label, expected_value|
|
@@ -285,9 +284,9 @@ end.overridable
|
|
285
284
|
|
286
285
|
# Example:
|
287
286
|
#
|
288
|
-
#
|
289
|
-
#
|
290
|
-
#
|
287
|
+
# I should have the following query string:
|
288
|
+
# | locale | de |
|
289
|
+
# | currency_code | EUR |
|
291
290
|
#
|
292
291
|
# Succeeds when the URL contains the given `locale` and `currency_code` params
|
293
292
|
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
@@ -496,7 +495,6 @@ end.overridable
|
|
496
495
|
# Don't forget the trailing slash. Otherwise you'll get the error
|
497
496
|
# expected: /http:\/\/makandra.com(\?[^\/]*)?$/
|
498
497
|
# got: "http://makandra.com/" (using =~)
|
499
|
-
#
|
500
498
|
Then /^"([^"]*)" should link to "([^"]*)"$/ do |link_label, target|
|
501
499
|
patiently do
|
502
500
|
link = find_link(link_label)
|
@@ -512,7 +510,6 @@ end.overridable
|
|
512
510
|
# Then I should see the element ".panel"
|
513
511
|
# Then I should not see an element ".sidebar"
|
514
512
|
# Then I should not see the element ".sidebar"
|
515
|
-
#
|
516
513
|
Then /^I should (not )?see (?:an|the) element "([^"]+)"$/ do |negate, selector|
|
517
514
|
expectation = negate ? :should_not : :should
|
518
515
|
patiently do
|
@@ -528,7 +525,6 @@ end.overridable
|
|
528
525
|
# Then I should see the element for the panel
|
529
526
|
# Then I should not see an element for the sidebar
|
530
527
|
# Then I should not see the element for the sidebar
|
531
|
-
#
|
532
528
|
Then /^I should (not )?see (?:an|the) element for (.*?)$/ do |negate, locator|
|
533
529
|
expectation = negate ? :should_not : :should
|
534
530
|
selector = _selector_for(locator)
|
@@ -548,8 +544,7 @@ end.overridable
|
|
548
544
|
#
|
549
545
|
# Example:
|
550
546
|
#
|
551
|
-
#
|
552
|
-
#
|
547
|
+
# When I follow "Read more" inside any ".text_snippet"
|
553
548
|
When /^I follow "([^"]*)" inside any "([^"]*)"$/ do |label, selector|
|
554
549
|
node = find("#{selector} a", :text => label)
|
555
550
|
node.click
|
@@ -602,12 +597,11 @@ end.overridable
|
|
602
597
|
#
|
603
598
|
# Example:
|
604
599
|
#
|
605
|
-
#
|
606
|
-
#
|
607
|
-
#
|
608
|
-
#
|
609
|
-
#
|
610
|
-
#
|
600
|
+
# Then I should see in this order:
|
601
|
+
# | Alpha Group |
|
602
|
+
# | Augsburg |
|
603
|
+
# | Berlin |
|
604
|
+
# | Beta Group |
|
611
605
|
Then /^I should see in this order:?$/ do |text|
|
612
606
|
if text.is_a?(String)
|
613
607
|
lines = text.split(/\n/)
|
data/support/parser.rb
CHANGED
@@ -19,7 +19,9 @@ class Parser
|
|
19
19
|
comment.gsub! /.*coding:.*UTF-8.*/, ''
|
20
20
|
comment.strip!
|
21
21
|
comment_lines = comment.split("\n").take_while { |line| line =~ /^\s*#/ }
|
22
|
-
comment_lines && comment_lines.join("\n").gsub(/^\s*# ?/, '')
|
22
|
+
formatted = comment_lines && comment_lines.join("\n").gsub(/^\s*# ?/, '')
|
23
|
+
|
24
|
+
formatted if formatted and not formatted.empty?
|
23
25
|
end
|
24
26
|
|
25
27
|
end
|
data/support/step_definition.rb
CHANGED
@@ -22,11 +22,11 @@ class StepDefinition
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def to_markdown
|
25
|
-
|
26
|
-
|
25
|
+
spaced_comment = if comment
|
26
|
+
"\n\n" + comment.gsub(/^/, ' ')
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
TEXT
|
29
|
+
%(* **#{kind} #{pretty_step}**#{spaced_comment})
|
30
30
|
end
|
31
31
|
|
32
32
|
def to_s
|
@@ -16,12 +16,12 @@ class StepDefinitionFile
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def to_markdown
|
19
|
-
|
20
|
-
### #{ @filename.split('/').last }
|
19
|
+
spaced_comment = "\n\n" + @comment if @comment
|
21
20
|
|
22
|
-
|
21
|
+
<<-TEXT
|
22
|
+
### #{ @filename.split('/').last } #{spaced_comment}
|
23
23
|
|
24
|
-
#{ steps.collect(&:to_markdown).join("\n\n") }
|
24
|
+
#{ steps.collect(&:to_markdown).join("\n\n\n") }
|
25
25
|
TEXT
|
26
26
|
end
|
27
27
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreewald
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.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: 2016-12-
|
11
|
+
date: 2016-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|