spreewald 2.99.3 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +40 -0
  3. data/CHANGELOG.md +45 -4
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +2 -2
  6. data/Gemfile.ruby245 +3 -0
  7. data/Gemfile.ruby245.lock +10 -1
  8. data/Gemfile.ruby266 +3 -0
  9. data/Gemfile.ruby266.lock +12 -2
  10. data/README.md +40 -32
  11. data/Rakefile +34 -19
  12. data/features/binary.feature +2 -2
  13. data/features/support/step_definitions/custom_steps.rb +10 -0
  14. data/lib/spreewald.rb +1 -0
  15. data/lib/spreewald/development_steps.rb +1 -8
  16. data/lib/spreewald/email_steps.rb +3 -43
  17. data/lib/spreewald/frame_steps.rb +77 -0
  18. data/lib/spreewald/web_steps.rb +17 -61
  19. data/lib/spreewald_support/mail_finder.rb +12 -13
  20. data/lib/spreewald_support/mail_to_plaintext_converter.rb +42 -0
  21. data/lib/spreewald_support/unsupported_email_header.rb +22 -0
  22. data/lib/spreewald_support/version.rb +1 -1
  23. data/spec/spreewald_support/mail_to_plaintext_converter_spec.rb +60 -0
  24. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/Gemfile +1 -1
  25. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/Gemfile.lock +14 -16
  26. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/README.rdoc +0 -0
  27. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/Rakefile +0 -0
  28. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/app +0 -0
  29. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/bin/bundle +0 -0
  30. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/bin/rails +0 -0
  31. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/bin/rake +0 -0
  32. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/bin/setup +0 -0
  33. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config.ru +0 -0
  34. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/application.rb +0 -0
  35. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/boot.rb +0 -0
  36. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/cucumber.yml +0 -0
  37. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/database.yml +0 -0
  38. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/environment.rb +0 -0
  39. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/environments/development.rb +0 -0
  40. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/environments/test.rb +0 -0
  41. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/initializers/backtrace_silencers.rb +0 -0
  42. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/initializers/cookies_serializer.rb +0 -0
  43. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/initializers/filter_parameter_logging.rb +0 -0
  44. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/initializers/inflections.rb +0 -0
  45. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/initializers/mime_types.rb +0 -0
  46. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/initializers/session_store.rb +0 -0
  47. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/initializers/silence_deprecation_warnings.rb +0 -0
  48. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/initializers/to_time_preserves_timezone.rb +0 -0
  49. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/initializers/wrap_parameters.rb +0 -0
  50. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/locales/en.yml +0 -0
  51. data/tests/{rails-3_capybara-1 → rails-4_capybara-2}/config/routes.rb +0 -0
  52. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/config/secrets.yml +0 -0
  53. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/db +0 -0
  54. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/browser_tab_steps.feature +0 -0
  55. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/development_steps.feature +0 -0
  56. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/email_steps.feature +0 -0
  57. data/tests/rails-4_capybara-2/features/iframe_steps.feature +1 -0
  58. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/overriding.feature +0 -0
  59. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/session_steps.feature +0 -0
  60. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/step_definitions/overriding_steps.rb +0 -0
  61. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/step_definitions/test_steps.rb +0 -0
  62. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/support/env.rb +0 -0
  63. data/tests/{rails-3_capybara-1 → rails-4_capybara-2}/features/support/paths.rb +0 -0
  64. data/tests/{rails-3_capybara-1 → rails-4_capybara-2}/features/support/selectors.rb +0 -0
  65. data/tests/rails-4_capybara-2/features/support/selenium.rb +1 -0
  66. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/table_steps.feature +0 -0
  67. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/time_steps.feature +0 -0
  68. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/features/web_steps.feature +0 -0
  69. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/lib/tasks/cucumber.rake +0 -0
  70. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/log/.keep +0 -0
  71. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/public/404.html +0 -0
  72. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/public/422.html +0 -0
  73. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/public/500.html +0 -0
  74. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/public/favicon.ico +0 -0
  75. data/tests/{rails-4_capybara-3 → rails-4_capybara-2}/public/fixture_files +0 -0
  76. data/tests/{rails-3_capybara-1 → rails-4_capybara-2}/script/cucumber +0 -0
  77. data/tests/rails-6_capybara-3/Gemfile.lock +2 -2
  78. data/tests/rails-6_capybara-3/app/mailers/spreewald_mailer.rb +16 -0
  79. data/tests/rails-6_capybara-3/features/iframe_steps.feature +1 -0
  80. data/tests/rails-6_capybara-3/features/support/selenium.rb +1 -0
  81. data/tests/shared/app/controllers/emails_controller.rb +20 -0
  82. data/tests/shared/app/controllers/iframes_controller.rb +11 -0
  83. data/tests/shared/app/controllers/static_pages_controller.rb +12 -8
  84. data/tests/shared/app/models/mailer.rb +32 -0
  85. data/tests/shared/app/views/forms/checkbox_form.html.haml +3 -0
  86. data/tests/shared/app/views/forms/disabled_elements.html.haml +1 -0
  87. data/tests/shared/app/views/forms/form1.html.haml +4 -1
  88. data/tests/shared/app/views/forms/invalid_form.html.haml +3 -0
  89. data/tests/shared/app/views/iframes/iframe_1_content.haml +12 -0
  90. data/tests/shared/app/views/iframes/iframe_2_content.haml +12 -0
  91. data/tests/shared/app/views/mailer/html_email_for_failed_test_without_header.haml +5 -0
  92. data/tests/shared/app/views/mailer/html_email_for_successful_test_without_header.haml +7 -0
  93. data/tests/shared/app/views/mailer/text_email_for_failed_test_without_header.text.erb +1 -0
  94. data/tests/shared/app/views/mailer/text_email_for_successful_test_without_header.text.erb +3 -0
  95. data/tests/shared/app/views/static_pages/iframe.haml +3 -0
  96. data/tests/shared/config/routes.rb +8 -0
  97. data/tests/shared/features/shared/email_steps.feature +172 -35
  98. data/tests/shared/features/shared/iframe_steps.feature +38 -0
  99. data/tests/shared/features/shared/step_definitions/test_steps.rb +5 -6
  100. data/tests/shared/features/shared/web_steps.feature +15 -10
  101. data/tests/shared/features/support/selenium.rb +10 -0
  102. metadata +137 -186
  103. data/.travis.yml +0 -29
  104. data/Gemfile.ruby218 +0 -7
  105. data/Gemfile.ruby218.lock +0 -58
  106. data/lib/spreewald/file_attachment_steps.rb +0 -22
  107. data/lib/spreewald/timecop_steps.rb +0 -9
  108. data/tests/rails-3_capybara-1/.ruby-version +0 -1
  109. data/tests/rails-3_capybara-1/Gemfile +0 -20
  110. data/tests/rails-3_capybara-1/Gemfile.lock +0 -182
  111. data/tests/rails-3_capybara-1/Rakefile +0 -18
  112. data/tests/rails-3_capybara-1/app +0 -1
  113. data/tests/rails-3_capybara-1/config.ru +0 -4
  114. data/tests/rails-3_capybara-1/config/application.rb +0 -29
  115. data/tests/rails-3_capybara-1/config/boot.rb +0 -15
  116. data/tests/rails-3_capybara-1/config/cucumber.yml +0 -1
  117. data/tests/rails-3_capybara-1/config/database.yml +0 -1
  118. data/tests/rails-3_capybara-1/config/environment.rb +0 -7
  119. data/tests/rails-3_capybara-1/config/initializers/backtrace_silencers.rb +0 -9
  120. data/tests/rails-3_capybara-1/config/initializers/inflections.rb +0 -12
  121. data/tests/rails-3_capybara-1/config/initializers/mime_types.rb +0 -7
  122. data/tests/rails-3_capybara-1/config/initializers/secret_token.rb +0 -9
  123. data/tests/rails-3_capybara-1/config/initializers/session_store.rb +0 -5
  124. data/tests/rails-3_capybara-1/db +0 -1
  125. data/tests/rails-3_capybara-1/features/shared +0 -1
  126. data/tests/rails-3_capybara-1/features/support/env.rb +0 -65
  127. data/tests/rails-3_capybara-1/features/support/selenium.rb +0 -3
  128. data/tests/rails-3_capybara-1/public +0 -1
  129. data/tests/rails-3_capybara-1/script/rails +0 -6
  130. data/tests/rails-3_capybara-2/.ruby-version +0 -1
  131. data/tests/rails-3_capybara-2/Gemfile +0 -21
  132. data/tests/rails-3_capybara-2/Gemfile.lock +0 -191
  133. data/tests/rails-3_capybara-2/Rakefile +0 -1
  134. data/tests/rails-3_capybara-2/app +0 -1
  135. data/tests/rails-3_capybara-2/config +0 -1
  136. data/tests/rails-3_capybara-2/config.ru +0 -1
  137. data/tests/rails-3_capybara-2/db +0 -1
  138. data/tests/rails-3_capybara-2/features +0 -1
  139. data/tests/rails-3_capybara-2/public +0 -1
  140. data/tests/rails-3_capybara-2/script +0 -1
  141. data/tests/rails-4_capybara-3/config/routes.rb +0 -1
  142. data/tests/rails-4_capybara-3/features/support/paths.rb +0 -1
  143. data/tests/rails-4_capybara-3/features/support/selectors.rb +0 -1
  144. data/tests/rails-4_capybara-3/features/support/selenium.rb +0 -3
  145. data/tests/rails-4_capybara-3/script/cucumber +0 -10
  146. data/tests/rails-6_capybara-3/features/support/selenium.rb +0 -3
@@ -4,6 +4,9 @@
4
4
  = label_tag 'checked_name', 'Checked'
5
5
  = check_box_tag 'checked_name', 'value', checked
6
6
 
7
+ = label_tag 'checked_disabled_name', 'Checked disabled'
8
+ = check_box_tag 'checked_disabled_name', 'value', checked, disabled: true
9
+
7
10
  - checked = false
8
11
  = label_tag 'unchecked_name', 'Unchecked'
9
12
  = check_box_tag 'unchecked_name', 'value', checked
@@ -69,3 +69,4 @@
69
69
 
70
70
  = label_tag 'enabled_radio_2', 'Enabled radio button #2'
71
71
  = radio_button_tag 'enabled_radio', '2', selected
72
+
@@ -3,6 +3,9 @@
3
3
  = label_tag 'text_control', 'Text control'
4
4
  = text_field_tag 'text_control', 'Text control value'
5
5
 
6
+ = label_tag 'disabled_text_control', 'Disabled text control'
7
+ = text_field_tag 'disabled_text_control', 'Disabled text control value', disabled: true
8
+
6
9
  = label_tag 'select_control', 'Select control'
7
10
  = select_tag 'select_control', options_for_select([['Label 1', 'value1'], ['Label 2', 'value2'], ['Label 3', 'value3']], 'value2')
8
11
 
@@ -26,4 +29,4 @@
26
29
  = label_tag 'radio_button_control_radio1', 'Radio 1'
27
30
  = radio_button_tag 'radio_button_control', 'radio1'
28
31
  = label_tag 'radio_button_control_radio2', 'Radio 2'
29
- = radio_button_tag 'radio_button_control', 'radio2'
32
+ = radio_button_tag 'radio_button_control', 'radio2'
@@ -5,6 +5,9 @@
5
5
  .form-group.field_with_errors
6
6
  = label_tag 'textarea_control_1', 'B is invalid'
7
7
  = text_area_tag 'textarea_control_1', "Textarea control line 1\nTextarea control line 2\n"
8
+ .form-group.field_with_errors
9
+ = label_tag 'disabled_control', 'Disabled is invalid'
10
+ = text_field_tag 'disabled_control', "Disabled control value", disabled: true
8
11
  .form-group
9
12
  = label_tag 'textarea_control_2', 'C'
10
13
  = text_area_tag 'textarea_control_2', "Textarea control line 1\nTextarea control line 2\n"
@@ -0,0 +1,12 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %body
5
+ Iframe content
6
+ %table
7
+ %tr
8
+ %th Color
9
+ %th Fruit
10
+ %tr
11
+ %td Green
12
+ %td Kiwi
@@ -0,0 +1,12 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %body
5
+ Iframe content
6
+ %table
7
+ %tr
8
+ %th Color
9
+ %th Fruit
10
+ %tr
11
+ %td Red
12
+ %td Cherry
@@ -0,0 +1,5 @@
1
+ !!!
2
+ %html(lang="en" xmlns="http://www.w3.org/1999/xhtml")
3
+ %body
4
+ %p
5
+ Bye
@@ -0,0 +1,7 @@
1
+ !!!
2
+ %html(lang="en" xmlns="http://www.w3.org/1999/xhtml")
3
+ %body
4
+ %p
5
+ Hello
6
+ %p
7
+ Bye
@@ -0,0 +1,3 @@
1
+ Content on main page
2
+ %iframe(src='/iframes/iframe_1_content' name='colors_1')
3
+ %iframe(src='/iframes/iframe_2_content' name='colors_2')
@@ -13,6 +13,10 @@ Rails.application.routes.draw do
13
13
  get '/emails/send_html_email_with_linebreaks', to: 'emails#send_html_email_with_linebreaks'
14
14
  get '/emails/send_html_email_with_specific_line', to: 'emails#send_html_email_with_specific_line'
15
15
  get '/emails/send_text_email_with_specific_line', to: 'emails#send_text_email_with_specific_line'
16
+ get '/emails/send_html_email_for_successful_test_without_header', to: 'emails#send_html_email_for_successful_test_without_header'
17
+ get '/emails/send_text_email_for_successful_test_without_header', to: 'emails#send_text_email_for_successful_test_without_header'
18
+ get '/emails/send_html_email_for_failed_test_without_header', to: 'emails#send_html_email_for_failed_test_without_header'
19
+ get '/emails/send_text_email_for_failed_test_without_header', to: 'emails#send_text_email_for_failed_test_without_header'
16
20
 
17
21
  get '/forms/checkbox_form', to: 'forms#checkbox_form'
18
22
  get '/forms/disabled_elements', to: 'forms#disabled_elements'
@@ -21,8 +25,12 @@ Rails.application.routes.draw do
21
25
  get '/forms/select_fields', to: 'forms#select_fields'
22
26
  get '/forms/invalid_form', to: 'forms#invalid_form'
23
27
 
28
+ get '/iframes/iframe_1_content', to: 'iframes#iframe_1_content'
29
+ get '/iframes/iframe_2_content', to: 'iframes#iframe_2_content'
30
+
24
31
  get '/static_pages/click_on', to: 'static_pages#click_on'
25
32
  get '/static_pages/home', to: 'static_pages#home'
33
+ get '/static_pages/iframe', to: 'static_pages#iframe'
26
34
  get '/static_pages/link_target', to: 'static_pages#link_target'
27
35
  get '/static_pages/link_to_home', to: 'static_pages#link_to_home'
28
36
  get '/static_pages/links', to: 'static_pages#links'
@@ -33,6 +33,70 @@ Feature: Test Spreewald's email steps
33
33
  '''
34
34
  """
35
35
 
36
+ # Test with invalid header
37
+ Then the step with an unsupported email header should raise:
38
+ """
39
+ Then an email should have been sent with:
40
+ '''
41
+ From: from@example.com
42
+ Reply-To: reply-to@example.com
43
+ Invalid-Header: reply-to@example.com
44
+ To: to@example.com
45
+ Subject: SUBJECT
46
+ '''
47
+ """
48
+
49
+ # Test with indented header lines
50
+ Then the following multiline step should succeed:
51
+ """
52
+ Then an email should have been sent with:
53
+ '''
54
+ From: from@example.com
55
+ Reply-To: reply-to@example.com
56
+ To: to@example.com
57
+ Subject: SUBJECT
58
+
59
+ Body
60
+ with
61
+ line
62
+ breaks
63
+ '''
64
+ """
65
+
66
+ # Test with indented step lines
67
+ Then the following multiline step should succeed:
68
+ """
69
+ Then an email should have been sent with:
70
+ '''
71
+ From: from@example.com
72
+ Reply-To: reply-to@example.com
73
+ To: to@example.com
74
+ Subject: SUBJECT
75
+
76
+ Body
77
+ with
78
+ line
79
+ breaks
80
+ '''
81
+ """
82
+
83
+ # Test with indented body lines
84
+ Then the following multiline step should succeed:
85
+ """
86
+ Then an email should have been sent with:
87
+ '''
88
+ From: from@example.com
89
+ Reply-To: reply-to@example.com
90
+ To: to@example.com
91
+ Subject: SUBJECT
92
+
93
+ Body
94
+ with
95
+ line
96
+ breaks
97
+ '''
98
+ """
99
+
36
100
  # Test with body
37
101
  Then the following multiline step should succeed:
38
102
  """
@@ -130,7 +194,6 @@ Feature: Test Spreewald's email steps
130
194
  breaks
131
195
  '''
132
196
  """
133
-
134
197
  # Test with incorrect To header
135
198
  Then the following multiline step should fail:
136
199
  """
@@ -201,6 +264,22 @@ Feature: Test Spreewald's email steps
201
264
  '''
202
265
  """
203
266
 
267
+ # Test body with to few paragraphs
268
+ Then the following multiline step should fail:
269
+ """
270
+ Then an email should have been sent with:
271
+ '''
272
+ From: from@example.com
273
+ Reply-To: reply-to@example.com
274
+ To: to@example.com
275
+ Subject: SUBJECT
276
+
277
+ Body
278
+ with
279
+ line
280
+ '''
281
+ """
282
+
204
283
  # Test body with wildcard not at the end of a line
205
284
  Then the following multiline step should fail:
206
285
  """
@@ -212,7 +291,7 @@ Feature: Test Spreewald's email steps
212
291
  Subject: SUBJECT
213
292
 
214
293
  Body
215
- t*e
294
+ *th
216
295
  line
217
296
  break
218
297
  '''
@@ -271,7 +350,6 @@ Feature: Test Spreewald's email steps
271
350
  '''
272
351
  """
273
352
 
274
- # Test body with wildcard at the begin of a line
275
353
  When I clear my emails
276
354
  And I go to "/emails/send_html_email_with_specific_line"
277
355
 
@@ -310,67 +388,126 @@ Feature: Test Spreewald's email steps
310
388
  '''
311
389
  """
312
390
 
313
- Scenario: Scenario: /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/
314
- When I go to "/emails/send_email"
315
-
316
- # Test with correct conditions
391
+ # Tests without header
392
+ When I clear my emails
393
+ And I go to "/emails/send_text_email_for_successful_test_without_header"
317
394
  Then the following multiline step should succeed:
318
395
  """
319
- Then an email should have been sent from "from@example.com" to "to@example.com" cc "cc@example.com" bcc "bcc@example.com" and the subject "SUBJECT" and the attachments "attached_file.pdf"
320
- """
396
+ Then an email should have been sent with:
397
+ '''
398
+ Hello
321
399
 
322
- # Test with wrong conditions
323
- Then the following multiline step should fail:
324
- """
325
- Then an email should have been sent from "from@example.com" to "to@example.com" cc "cc@example.com" bcc "wrong_bcc@example.com" and the subject "SUBJECT" and the attachments "attached_file.pdf"
400
+ Bye
401
+ '''
326
402
  """
403
+ And the following multiline step should succeed:
404
+ """
405
+ Then an email should have been sent with:
406
+ '''
407
+ To: to@example.com
327
408
 
328
- Scenario: /^that e?mail should have the following lines in the body:$/
329
- When I go to "/emails/send_email"
409
+ Hello
330
410
 
331
- # Test with correct body lines
332
- Then the following multiline step should succeed:
411
+ Bye
412
+ '''
413
+ """
414
+ But the following multiline step should fail:
333
415
  """
334
- Then that email should have the following lines in the body:
416
+ Then an email should have been sent with:
335
417
  '''
336
- with
337
- line
418
+ To: wrong-guy@example.com
419
+
420
+ Hello
421
+
422
+ Bye
338
423
  '''
339
424
  """
340
425
 
341
- # Test with wrong body lines
426
+ When I clear my emails
427
+ And I go to "/emails/send_text_email_for_failed_test_without_header"
342
428
  Then the following multiline step should fail:
343
429
  """
344
- Then that email should have the following lines in the body:
430
+ Then an email should have been sent with:
345
431
  '''
346
- wrong
347
- line
432
+ Hello
433
+
434
+ Bye
348
435
  '''
349
436
  """
437
+ But the following multiline step should succeed:
438
+ """
439
+ Then an email should have been sent with:
440
+ '''
441
+ Bye
442
+ '''
443
+ """
444
+ And the following multiline step should succeed:
445
+ """
446
+ Then an email should have been sent with:
447
+ '''
448
+ To: to@example.com
350
449
 
450
+ Bye
451
+ '''
452
+ """
351
453
 
352
- Scenario: /^that e?mail should have the following( content in the)? body$/
353
- When I go to "/emails/send_email"
354
-
355
- # Test with correct body lines
454
+ When I clear my emails
455
+ And I go to "/emails/send_html_email_for_successful_test_without_header"
356
456
  Then the following multiline step should succeed:
357
457
  """
358
- Then that email should have the following content in the body:
458
+ Then an email should have been sent with:
359
459
  '''
360
- with
361
- line
460
+ Hello
461
+ Bye
462
+ '''
463
+ """
464
+ And the following multiline step should succeed:
465
+ """
466
+ Then an email should have been sent with:
467
+ '''
468
+ To: to@example.com
469
+
470
+ Hello
471
+ Bye
472
+ '''
473
+ """
474
+ But the following multiline step should fail:
475
+ """
476
+ Then an email should have been sent with:
477
+ '''
478
+ To: wrong-guy@example.com
479
+
480
+ Hello
481
+ Bye
362
482
  '''
363
483
  """
364
484
 
365
- # Test with wrong body lines
485
+ When I clear my emails
486
+ And I go to "/emails/send_html_email_for_failed_test_without_header"
366
487
  Then the following multiline step should fail:
367
488
  """
368
- Then that email should have the following body:
489
+ Then an email should have been sent with:
369
490
  '''
370
- wrong
371
- line
491
+ Hello
492
+ Bye
372
493
  '''
373
494
  """
495
+ But the following multiline step should succeed:
496
+ """
497
+ Then an email should have been sent with:
498
+ '''
499
+ Bye
500
+ '''
501
+ """
502
+ And the following multiline step should succeed:
503
+ """
504
+ Then an email should have been sent with:
505
+ '''
506
+ To: to@example.com
507
+
508
+ Bye
509
+ '''
510
+ """
374
511
 
375
512
  Scenario: /^I follow the (first|second|third)? ?link in the e?mail$/ (HTML e-mail body)
376
513
  When I go to "/emails/send_html_email_with_links"
@@ -0,0 +1,38 @@
1
+ @javascript
2
+ Feature: iframe Steps
3
+
4
+ @not-capybara-2
5
+ Scenario: Switch between iframes
6
+ Given I go to "/static_pages/iframe"
7
+ Then I should not see "Kiwi"
8
+ And I should not see "Cherry"
9
+
10
+ When I switch to the 1st iframe
11
+ Then I should see "Kiwi"
12
+ But I should not see "Cherry"
13
+
14
+ When I switch back to the whole page
15
+ Then I should not see "Kiwi"
16
+ And I should not see "Cherry"
17
+
18
+ When I switch to the colors_2 iframe
19
+ Then I should see "Cherry"
20
+ But I should not see "Kiwi"
21
+ # Unfortunately, manual reset for next test is necessary
22
+ When I switch back to the whole page
23
+
24
+
25
+ Scenario: Accesssing contents of iframes with the "inside the ... frame" step fragment
26
+ Given I go to "/static_pages/iframe"
27
+ Then I should see "Content on main page"
28
+ But I should not see "Fruit"
29
+
30
+ Then I should see "Kiwi" inside the 1st iframe
31
+ And I should see "Cherry" inside the colors_2 iframe
32
+ And I should see a table with the following rows inside the colors_1 iframe:
33
+ | Color | Fruit |
34
+ | Green | Kiwi |
35
+ And I should see a table with the following rows inside the 2nd iframe:
36
+ | Color | Fruit |
37
+ | Red | Cherry |
38
+ But I should not see "Content on main page" inside the 1st iframe
@@ -24,6 +24,11 @@ When /^I run the following steps?:$/ do |steps_table|
24
24
  end
25
25
  end
26
26
 
27
+ Then /^the step with an unsupported email header should raise:$/ do |step_string|
28
+ multiline_step = step_string.gsub(%{'''}, %{"""})
29
+ expect { steps(multiline_step) }.to raise_error(Spreewald::UnsupportedEmailHeader)
30
+ end
31
+
27
32
  Then /^the following multiline step should (fail|succeed):$/ do |expectation, multiline_step|
28
33
  multiline_step = multiline_step.gsub(%{'''}, %{"""})
29
34
  if expectation == 'fail'
@@ -45,12 +50,6 @@ Then(/^a visible string with quotes should be visible$/) do
45
50
  end
46
51
 
47
52
  Then(/^'show me the page' should open the page or take a screenshot$/) do
48
- # Projects with Capybara 1 & 2 use the launchy gem
49
- if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "3.0")
50
- expect(Launchy).to receive(:open)
51
- step 'show me the page'
52
- else
53
53
  expect_any_instance_of(Capybara::Screenshot::Saver).to receive(:save)
54
54
  step 'show me the page'
55
- end
56
55
  end