cucumber-sammies 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +431 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +20 -0
- data/README.md +0 -1
- data/cucumber-sammies.gemspec +2 -3
- data/lib/cucumber/sammies/step_definitions/all_steps.rb +0 -3
- data/lib/cucumber/sammies/step_definitions/content_steps.rb +8 -4
- data/lib/cucumber/sammies/step_definitions/environment_steps.rb +0 -1
- data/lib/cucumber/sammies/step_definitions/form_steps.rb +17 -7
- data/lib/cucumber/sammies/step_definitions/navigation_steps.rb +44 -5
- data/lib/cucumber/sammies/step_definitions/table_steps.rb +3 -3
- data/lib/cucumber/sammies/step_definitions/time_steps.rb +7 -9
- data/lib/cucumber/sammies/step_definitions/troubleshooting_steps.rb +8 -0
- data/lib/cucumber/sammies/support/resolvers.rb +4 -4
- data/lib/cucumber/sammies/version.rb +1 -1
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8cd14e88d8019ccd11028cc966b0329a6ab2297e5ad6b193e3d6c7a3085cc590
|
4
|
+
data.tar.gz: b4ef8c552e48a80dcb1815530ed8d01642b5f6e71ec02f2a2e073ad223051459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40b75afbe9aaf52ba3021e0db221abd727b8c234daa35ac7ae9b03ff87841642a31d41c73f055c82c29e9d0d724f8d486fc0aee3792df2cd372ededd48c6d048
|
7
|
+
data.tar.gz: ba1465cc585487785b7c8bf9987eb797bc9cf6bc39da3940012a24d1887c3eb62b35432b1bad9633c5b434f6bc3b268dfb6cbf9fdd4782191a888a51c78cacbc
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,431 @@
|
|
1
|
+
# Continue here: https://raw.githubusercontent.com/rubocop-hq/rubocop/master/config/default.yml
|
2
|
+
# TODO: Skipped rails or naming or style
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
Exclude:
|
6
|
+
- 'node_modules/**/*'
|
7
|
+
- 'vendor/**/*'
|
8
|
+
- '.git/**/*'
|
9
|
+
- 'db/**/*'
|
10
|
+
- 'lib/tasks/cucumber.rake'
|
11
|
+
- 'config/routes.rb'
|
12
|
+
- 'features/**/*'
|
13
|
+
EnabledByDefault: false
|
14
|
+
DisabledByDefault: true
|
15
|
+
|
16
|
+
require: rubocop-performance
|
17
|
+
|
18
|
+
Bundler/DuplicatedGem:
|
19
|
+
Enabled: true
|
20
|
+
|
21
|
+
Bundler/InsecureProtocolSource:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Bundler/OrderedGems:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
Gemspec/DuplicatedAssignment:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
Gemspec/OrderedDependencies:
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
Gemspec/RequiredRubyVersion:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
Layout/BlockEndNewline:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
Layout/ClassStructure:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
Layout/ClosingParenthesisIndentation:
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
Layout/ConditionPosition:
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
Layout/DefEndAlignment:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Layout/ElseAlignment:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
Layout/EmptyLineBetweenDefs:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
Layout/EmptyLines:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Layout/EmptyLinesAroundAccessModifier:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Layout/EndAlignment:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Layout/EndOfLine:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Layout/EmptyLinesAroundArguments:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Layout/IndentationWidth:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Layout/InitialIndentation:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Layout/LeadingBlankLines:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Layout/SpaceAfterColon:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Layout/SpaceAfterComma:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
Layout/SpaceAfterNot:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Layout/SpaceAfterSemicolon:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Layout/SpaceAroundKeyword:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Layout/SpaceBeforeComma:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Layout/SpaceInsideStringInterpolation:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
Layout/Tab:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Layout/TrailingBlankLines:
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
Layout/TrailingWhitespace:
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
Lint/AssignmentInCondition:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
Lint/BooleanSymbol:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
Lint/CircularArgumentReference:
|
121
|
+
Enabled: true
|
122
|
+
|
123
|
+
Lint/Debugger:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
Lint/DuplicateCaseCondition:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
Lint/DuplicateMethods:
|
130
|
+
Enabled: true
|
131
|
+
|
132
|
+
Lint/DuplicatedKey:
|
133
|
+
Enabled: true
|
134
|
+
|
135
|
+
Lint/EachWithObjectArgument:
|
136
|
+
Enabled: true
|
137
|
+
|
138
|
+
Lint/ElseLayout:
|
139
|
+
Enabled: true
|
140
|
+
|
141
|
+
Lint/EmptyEnsure:
|
142
|
+
Enabled: true
|
143
|
+
|
144
|
+
Lint/EmptyExpression:
|
145
|
+
Enabled: true
|
146
|
+
|
147
|
+
Lint/EmptyInterpolation:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
Lint/EmptyWhen:
|
151
|
+
Enabled: true
|
152
|
+
|
153
|
+
Lint/EnsureReturn:
|
154
|
+
Enabled: true
|
155
|
+
|
156
|
+
Lint/FloatOutOfRange:
|
157
|
+
Enabled: true
|
158
|
+
|
159
|
+
Lint/FormatParameterMismatch:
|
160
|
+
Enabled: true
|
161
|
+
|
162
|
+
Lint/HandleExceptions:
|
163
|
+
Enabled: true
|
164
|
+
|
165
|
+
Lint/ImplicitStringConcatenation:
|
166
|
+
Enabled: true
|
167
|
+
|
168
|
+
Lint/IneffectiveAccessModifier:
|
169
|
+
Enabled: true
|
170
|
+
|
171
|
+
Lint/InheritException:
|
172
|
+
Enabled: true
|
173
|
+
|
174
|
+
Lint/InterpolationCheck:
|
175
|
+
Enabled: true
|
176
|
+
|
177
|
+
Lint/LiteralAsCondition:
|
178
|
+
Enabled: true
|
179
|
+
|
180
|
+
Lint/LiteralInInterpolation:
|
181
|
+
Enabled: true
|
182
|
+
|
183
|
+
Lint/Loop:
|
184
|
+
Enabled: true
|
185
|
+
|
186
|
+
Lint/MissingCopEnableDirective:
|
187
|
+
Enabled: true
|
188
|
+
|
189
|
+
Lint/MultipleCompare:
|
190
|
+
Enabled: true
|
191
|
+
|
192
|
+
Lint/NestedMethodDefinition:
|
193
|
+
Enabled: true
|
194
|
+
|
195
|
+
Lint/NextWithoutAccumulator:
|
196
|
+
Enabled: true
|
197
|
+
|
198
|
+
Lint/NonLocalExitFromIterator:
|
199
|
+
Enabled: true
|
200
|
+
|
201
|
+
# This caused too much confusion.
|
202
|
+
Lint/NumberConversion:
|
203
|
+
Enabled: false
|
204
|
+
|
205
|
+
Lint/ParenthesesAsGroupedExpression:
|
206
|
+
Enabled: true
|
207
|
+
|
208
|
+
Lint/PercentStringArray:
|
209
|
+
Enabled: true
|
210
|
+
|
211
|
+
Lint/PercentSymbolArray:
|
212
|
+
Enabled: true
|
213
|
+
|
214
|
+
Lint/RandOne:
|
215
|
+
Enabled: true
|
216
|
+
|
217
|
+
Lint/RedundantWithIndex:
|
218
|
+
Enabled: true
|
219
|
+
|
220
|
+
Lint/RedundantWithObject:
|
221
|
+
Enabled: true
|
222
|
+
|
223
|
+
Lint/RegexpAsCondition:
|
224
|
+
Enabled: true
|
225
|
+
|
226
|
+
Lint/RequireParentheses:
|
227
|
+
Enabled: true
|
228
|
+
|
229
|
+
Lint/RescueException:
|
230
|
+
Enabled: true
|
231
|
+
|
232
|
+
Lint/RescueType:
|
233
|
+
Enabled: true
|
234
|
+
|
235
|
+
Lint/ReturnInVoidContext:
|
236
|
+
Enabled: true
|
237
|
+
|
238
|
+
Lint/SafeNavigationChain:
|
239
|
+
Enabled: true
|
240
|
+
|
241
|
+
Lint/SafeNavigationConsistency:
|
242
|
+
Enabled: true
|
243
|
+
|
244
|
+
Lint/ShadowedArgument:
|
245
|
+
Enabled: true
|
246
|
+
|
247
|
+
Lint/ShadowedException:
|
248
|
+
Enabled: true
|
249
|
+
|
250
|
+
Lint/ShadowingOuterLocalVariable:
|
251
|
+
Enabled: true
|
252
|
+
|
253
|
+
Lint/StringConversionInInterpolation:
|
254
|
+
Enabled: true
|
255
|
+
|
256
|
+
Lint/Syntax:
|
257
|
+
Enabled: true
|
258
|
+
|
259
|
+
Lint/UnderscorePrefixedVariableName:
|
260
|
+
Enabled: true
|
261
|
+
|
262
|
+
Lint/UnifiedInteger:
|
263
|
+
Enabled: true
|
264
|
+
|
265
|
+
Lint/UnneededRequireStatement:
|
266
|
+
Enabled: true
|
267
|
+
|
268
|
+
Lint/UnneededSplatExpansion:
|
269
|
+
Enabled: true
|
270
|
+
|
271
|
+
Lint/UnreachableCode:
|
272
|
+
Enabled: true
|
273
|
+
|
274
|
+
Lint/UnusedBlockArgument:
|
275
|
+
Enabled: true
|
276
|
+
|
277
|
+
Lint/UnusedMethodArgument:
|
278
|
+
Enabled: true
|
279
|
+
|
280
|
+
Lint/UselessAccessModifier:
|
281
|
+
Enabled: true
|
282
|
+
|
283
|
+
Lint/UselessAssignment:
|
284
|
+
Enabled: true
|
285
|
+
|
286
|
+
Lint/UselessComparison:
|
287
|
+
Enabled: true
|
288
|
+
|
289
|
+
Lint/UselessElseWithoutRescue:
|
290
|
+
Enabled: true
|
291
|
+
|
292
|
+
Lint/UselessSetterCall:
|
293
|
+
Enabled: true
|
294
|
+
|
295
|
+
Lint/Void:
|
296
|
+
Enabled: true
|
297
|
+
|
298
|
+
Metrics/AbcSize:
|
299
|
+
Enabled: true
|
300
|
+
Max: 150
|
301
|
+
|
302
|
+
Metrics/BlockLength:
|
303
|
+
Enabled: true
|
304
|
+
Max: 50
|
305
|
+
|
306
|
+
Metrics/BlockNesting:
|
307
|
+
Enabled: true
|
308
|
+
Max: 3
|
309
|
+
|
310
|
+
Metrics/ClassLength:
|
311
|
+
Description: 'Avoid long classes'
|
312
|
+
Enabled: true
|
313
|
+
Max: 250
|
314
|
+
|
315
|
+
Metrics/CyclomaticComplexity:
|
316
|
+
Enabled: true
|
317
|
+
Max: 12
|
318
|
+
|
319
|
+
Metrics/LineLength:
|
320
|
+
Enabled: true
|
321
|
+
Max: 200
|
322
|
+
|
323
|
+
Metrics/MethodLength:
|
324
|
+
Description: 'Avoid long methods.'
|
325
|
+
Enabled: true
|
326
|
+
Max: 30
|
327
|
+
|
328
|
+
Metrics/ModuleLength:
|
329
|
+
Description: 'Avoid long modules.'
|
330
|
+
Enabled: true
|
331
|
+
Max: 250
|
332
|
+
|
333
|
+
Metrics/ParameterLists:
|
334
|
+
Description: 'Avoid long parameter lists.'
|
335
|
+
Enabled: true
|
336
|
+
Max: 100
|
337
|
+
|
338
|
+
Metrics/PerceivedComplexity:
|
339
|
+
Enabled: true
|
340
|
+
Max: 10
|
341
|
+
|
342
|
+
Performance/Caller:
|
343
|
+
Enabled: true
|
344
|
+
|
345
|
+
Performance/Casecmp:
|
346
|
+
Enabled: true
|
347
|
+
|
348
|
+
# TODO: Re-enable
|
349
|
+
Performance/ChainArrayAllocation:
|
350
|
+
Enabled: false
|
351
|
+
|
352
|
+
Performance/CompareWithBlock:
|
353
|
+
Enabled: true
|
354
|
+
|
355
|
+
Performance/Count:
|
356
|
+
Enabled: true
|
357
|
+
|
358
|
+
Performance/Detect:
|
359
|
+
Enabled: true
|
360
|
+
|
361
|
+
Performance/DoubleStartEndWith:
|
362
|
+
Enabled: true
|
363
|
+
|
364
|
+
Performance/EndWith:
|
365
|
+
Enabled: true
|
366
|
+
|
367
|
+
Performance/FixedSize:
|
368
|
+
Enabled: true
|
369
|
+
|
370
|
+
Performance/FlatMap:
|
371
|
+
Enabled: true
|
372
|
+
|
373
|
+
Performance/InefficientHashSearch:
|
374
|
+
Enabled: true
|
375
|
+
|
376
|
+
Performance/RangeInclude:
|
377
|
+
Enabled: true
|
378
|
+
|
379
|
+
Performance/RedundantBlockCall:
|
380
|
+
Enabled: true
|
381
|
+
|
382
|
+
Performance/RedundantMatch:
|
383
|
+
Enabled: true
|
384
|
+
|
385
|
+
Performance/RedundantMerge:
|
386
|
+
Enabled: true
|
387
|
+
|
388
|
+
Style/RedundantSortBy:
|
389
|
+
Enabled: true
|
390
|
+
|
391
|
+
Performance/RegexpMatch:
|
392
|
+
Enabled: true
|
393
|
+
|
394
|
+
Performance/ReverseEach:
|
395
|
+
Enabled: true
|
396
|
+
|
397
|
+
Style/Sample:
|
398
|
+
Enabled: true
|
399
|
+
|
400
|
+
Performance/Size:
|
401
|
+
Enabled: true
|
402
|
+
|
403
|
+
Performance/StartWith:
|
404
|
+
Enabled: true
|
405
|
+
|
406
|
+
Performance/StringReplacement:
|
407
|
+
Enabled: true
|
408
|
+
|
409
|
+
Performance/TimesMap:
|
410
|
+
Enabled: true
|
411
|
+
|
412
|
+
Performance/UnfreezeString:
|
413
|
+
Enabled: true
|
414
|
+
|
415
|
+
Style/UnneededSort:
|
416
|
+
Enabled: true
|
417
|
+
|
418
|
+
Security/Eval:
|
419
|
+
Enabled: false
|
420
|
+
|
421
|
+
Security/JSONLoad:
|
422
|
+
Enabled: true
|
423
|
+
|
424
|
+
Security/MarshalLoad:
|
425
|
+
Enabled: true
|
426
|
+
|
427
|
+
Security/Open:
|
428
|
+
Enabled: true
|
429
|
+
|
430
|
+
Security/YAMLLoad:
|
431
|
+
Enabled: true
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.3
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cucumber-sammies (0.1.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
rake (12.3.2)
|
10
|
+
|
11
|
+
PLATFORMS
|
12
|
+
ruby
|
13
|
+
|
14
|
+
DEPENDENCIES
|
15
|
+
bundler (~> 1.17.2)
|
16
|
+
cucumber-sammies!
|
17
|
+
rake (~> 12.3.2)
|
18
|
+
|
19
|
+
BUNDLED WITH
|
20
|
+
1.17.2
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Cucumber::Sammies
|
2
2
|
|
3
3
|
[![Code Climate](https://codeclimate.com/github/starfighterheavy/cucumber-sammies/badges/gpa.svg)](https://codeclimate.com/github/starfighterheavy/cucumber-sammies)
|
4
|
-
[![Dependency Status](https://gemnasium.com/starfighterheavy/cucumber-sammies.svg)](https://gemnasium.com/starfighterheavy/cucumber-sammies)
|
5
4
|
[![Gem Version](https://badge.fury.io/rb/cucumber-sammies.svg)](https://badge.fury.io/rb/cucumber-sammies)
|
6
5
|
|
7
6
|
![Cucumber Sandwhiches](./sammies.jpg)
|
data/cucumber-sammies.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "cucumber/sammies/version"
|
@@ -23,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
23
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
23
|
spec.require_paths = ["lib"]
|
25
24
|
|
26
|
-
spec.add_development_dependency "bundler", "~> 1.
|
27
|
-
spec.add_development_dependency "rake", "~>
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.17.2"
|
26
|
+
spec.add_development_dependency "rake", "~> 12.3.2"
|
28
27
|
end
|
@@ -1,3 +1,7 @@
|
|
1
|
+
Then /^I should see an image with the src "(.*)"$/ do |image_src|
|
2
|
+
expect(page).to have_xpath("//img[contains(@src,'#{image_src}')]")
|
3
|
+
end
|
4
|
+
|
1
5
|
Then /^the page title should be "(.*)"$/ do |title|
|
2
6
|
expect(page.title).to eq(title)
|
3
7
|
end
|
@@ -7,17 +11,17 @@ Then /^the page body should include "(.*)"$/ do |content|
|
|
7
11
|
end
|
8
12
|
|
9
13
|
Then /^I should see "(.*)"$/ do |content|
|
10
|
-
expect(page).to have_content(content)
|
14
|
+
expect(page).to have_content(content, normalize_ws: true)
|
11
15
|
end
|
12
16
|
|
13
17
|
Then /^I should not see "(.*)"$/ do |content|
|
14
|
-
expect(page).not_to have_content(content)
|
18
|
+
expect(page).not_to have_content(content, normalize_ws: true)
|
15
19
|
end
|
16
20
|
|
17
21
|
Then(/^I see the (.*) flash message$/) do |message|
|
18
|
-
|
22
|
+
expect(page).to have_content(resolve_locale(message), normalize_ws: true)
|
19
23
|
end
|
20
24
|
|
21
25
|
Then(/^I (should )?see the localized text for "(.*)"$/) do |_should, message|
|
22
|
-
|
26
|
+
expect(page).to have_content(resolve_locale(message), normalize_ws: true)
|
23
27
|
end
|
@@ -1,5 +1,13 @@
|
|
1
|
-
When(
|
2
|
-
|
1
|
+
When('I confirm') do
|
2
|
+
page.driver.browser.switch_to.alert.accept
|
3
|
+
end
|
4
|
+
|
5
|
+
When('I hit enter on {string}') do |id|
|
6
|
+
page.find("##{id}").send_keys(:return)
|
7
|
+
end
|
8
|
+
|
9
|
+
Then('the {string} field should contain {string}') do |label, value|
|
10
|
+
expect(find_field(label).value).to eq(value)
|
3
11
|
end
|
4
12
|
|
5
13
|
When(/^I click the first "(.*)"$/) do |link|
|
@@ -11,7 +19,7 @@ When(/^I click the "(.*)" submit button$/) do |link|
|
|
11
19
|
end
|
12
20
|
|
13
21
|
When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
|
14
|
-
select(value, :
|
22
|
+
select(value, from: field)
|
15
23
|
end
|
16
24
|
|
17
25
|
When(/^I check the ([^"]+) box$/) do |label|
|
@@ -42,13 +50,13 @@ def select_year_month(year:, month:, day: nil, field:)
|
|
42
50
|
field = find(:xpath, ".//label[contains(.,'#{field}')]")[:for]
|
43
51
|
field.gsub!(/_[1-3]{1}i$/, '')
|
44
52
|
end
|
45
|
-
select year, :
|
46
|
-
select month, :
|
47
|
-
select day, :
|
53
|
+
select year, from: "#{field}_1i"
|
54
|
+
select month, from: "#{field}_2i"
|
55
|
+
select day, from: "#{field}_3i" if day
|
48
56
|
end
|
49
57
|
|
50
58
|
When /^(?:|I )fill in "([^"]*)" (?:with|for) "([^"]*)"$/ do |field, value|
|
51
|
-
fill_in(field, :
|
59
|
+
fill_in(field, with: value)
|
52
60
|
end
|
53
61
|
|
54
62
|
Then /^nothing should be selected for "([^"]*)"$/ do |field|
|
@@ -58,6 +66,7 @@ Then /^nothing should be selected for "([^"]*)"$/ do |field|
|
|
58
66
|
value = selected_option ? selected_option.value : nil
|
59
67
|
value.should be_blank
|
60
68
|
rescue Capybara::ElementNotFound
|
69
|
+
Rails.logger.info "Element not found: #{field}"
|
61
70
|
end
|
62
71
|
end
|
63
72
|
|
@@ -68,6 +77,7 @@ Then /^"([^"]*)" should( not)? be an option for "([^"]*)"$/ do |value, negate, f
|
|
68
77
|
begin
|
69
78
|
field_labeled(field).find(:xpath, xpath).should_not be_present
|
70
79
|
rescue Capybara::ElementNotFound
|
80
|
+
Rails.logger.info "Element not found: #{field}"
|
71
81
|
end
|
72
82
|
else
|
73
83
|
field_labeled(field).find(:xpath, xpath).should be_present
|
@@ -1,12 +1,51 @@
|
|
1
1
|
require_relative '../support/resolvers'
|
2
2
|
|
3
|
+
When('I switch to the new tab') do
|
4
|
+
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
|
5
|
+
end
|
6
|
+
|
7
|
+
Then('the {string} button should be disabled') do |text|
|
8
|
+
expect(page).to have_button(text, disabled: true)
|
9
|
+
end
|
10
|
+
|
11
|
+
When('I hover over {string}') do |el|
|
12
|
+
page.find(el).hover
|
13
|
+
end
|
14
|
+
|
15
|
+
When('I click the {word} {string} icon') do |index, icon|
|
16
|
+
page.all('i', text: icon)[index.to_i - 1].click
|
17
|
+
sleep(1)
|
18
|
+
end
|
19
|
+
|
20
|
+
Then('I should see {int} {string} icons') do |count, icon|
|
21
|
+
expect(page.all('i', text: icon).size).to eq(count)
|
22
|
+
end
|
23
|
+
|
24
|
+
Then('I should not see a {string} icon') do |icon|
|
25
|
+
expect(page.all('i', text: icon).size).to eq(0)
|
26
|
+
end
|
27
|
+
|
28
|
+
When('I click the first {string} button') do |button|
|
29
|
+
first(:button, button).click
|
30
|
+
end
|
31
|
+
|
32
|
+
When('I click the {string} icon') do |icon|
|
33
|
+
page.find('i', text: /#{icon}/i).click
|
34
|
+
end
|
35
|
+
|
36
|
+
When(/^I click "(.*)"$/) do |link|
|
37
|
+
click_on link
|
38
|
+
end
|
39
|
+
|
40
|
+
When 'I reload the page' do
|
41
|
+
visit current_url
|
42
|
+
end
|
43
|
+
|
3
44
|
Then(/^I am taken to (a|an|the) (.*) page$/) do |inclusive, path|
|
4
45
|
path.split(' ').each do |part|
|
5
46
|
expect(current_path.split('/')).to include(part)
|
6
47
|
end
|
7
|
-
unless inclusive == 'the'
|
8
|
-
expect(current_path.split('/').last.to_i).to be > 0
|
9
|
-
end
|
48
|
+
expect(current_path.split('/').last.to_i).to be > 0 unless inclusive == 'the'
|
10
49
|
end
|
11
50
|
|
12
51
|
When(/^I set the subdomain to "(.*)"$/) do |subdomain|
|
@@ -48,8 +87,8 @@ Then /^(?:|I )should be on the (.+) page$/ do |page_name|
|
|
48
87
|
expected_path = resolve_path(page_name)
|
49
88
|
|
50
89
|
# Consider two pages equal if they only differ by a trailing slash.
|
51
|
-
current_path = expected_path if current_path.chomp(
|
52
|
-
current_path = expected_path if current_path.gsub(
|
90
|
+
current_path = expected_path if current_path.chomp('/') == expected_path.chomp('/')
|
91
|
+
current_path = expected_path if current_path.gsub('/#', '#') == expected_path.gsub('/#', '#')
|
53
92
|
|
54
93
|
current_path.should == expected_path
|
55
94
|
end
|
@@ -3,8 +3,8 @@ Then /^I should not see the table "(.*)"$/ do |caption|
|
|
3
3
|
end
|
4
4
|
|
5
5
|
Then /^the table "(.*)" should contain:$/ do |caption, data|
|
6
|
-
table = page.find('caption', text: caption).first(:xpath,
|
7
|
-
tr.all('th,td').map
|
8
|
-
|
6
|
+
table = page.find('caption', text: caption).first(:xpath, './/..').all('tr').map do |tr|
|
7
|
+
tr.all('th,td').map(&:text)
|
8
|
+
end
|
9
9
|
data.diff!(table)
|
10
10
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
if defined?(Timecop)
|
4
4
|
|
5
5
|
module TimecopHarness
|
6
|
-
|
7
6
|
# When you have to make your rails app time zone aware you have to go 100%
|
8
7
|
# otherwise you are better off ignoring time zones at all.
|
9
8
|
# https://makandracards.com/makandra/8723-guide-to-localizing-a-rails-application
|
@@ -28,7 +27,6 @@ if defined?(Timecop)
|
|
28
27
|
Time.now
|
29
28
|
end
|
30
29
|
end
|
31
|
-
|
32
30
|
end
|
33
31
|
|
34
32
|
World(TimecopHarness)
|
@@ -54,13 +52,13 @@ if defined?(Timecop)
|
|
54
52
|
# When it is a few hours earlier
|
55
53
|
When /^it is (\d+|a|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)$/ do |amount, unit, direction|
|
56
54
|
amount = case amount
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
when 'a'
|
56
|
+
1
|
57
|
+
when 'some', 'a few'
|
58
|
+
10
|
59
|
+
else
|
60
|
+
amount.to_i
|
61
|
+
end
|
64
62
|
amount = -amount if direction == 'earlier'
|
65
63
|
Timecop.travel(current_time + amount.send(unit))
|
66
64
|
end
|
@@ -5,21 +5,21 @@ module Resolvers
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def resolve_path(str)
|
8
|
-
send(str.
|
8
|
+
send(str.tr(' ', '_') + '_path')
|
9
9
|
end
|
10
10
|
|
11
11
|
def resolve_ivar(str)
|
12
|
-
model = str.
|
12
|
+
model = str.tr(' ', '_')
|
13
13
|
instance_variable_get("@#{model}")
|
14
14
|
end
|
15
15
|
|
16
16
|
def set_ivar(str, value)
|
17
|
-
model = str.
|
17
|
+
model = str.tr(' ', '_')
|
18
18
|
instance_variable_set("@#{model}", value)
|
19
19
|
end
|
20
20
|
|
21
21
|
def resolve_class(str)
|
22
|
-
str.singularize.titleize.
|
22
|
+
str.singularize.titleize.delete(' ').constantize
|
23
23
|
end
|
24
24
|
end
|
25
25
|
World(Resolvers)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-sammies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Kirst
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.17.2
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.17.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.2
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.2
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
- jskirst@gmail.com
|
@@ -46,8 +46,11 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- ".gitignore"
|
49
|
+
- ".rubocop.yml"
|
50
|
+
- ".ruby-version"
|
49
51
|
- CODE_OF_CONDUCT.md
|
50
52
|
- Gemfile
|
53
|
+
- Gemfile.lock
|
51
54
|
- LICENSE.txt
|
52
55
|
- README.md
|
53
56
|
- Rakefile
|
@@ -87,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
90
|
- !ruby/object:Gem::Version
|
88
91
|
version: '0'
|
89
92
|
requirements: []
|
90
|
-
|
91
|
-
rubygems_version: 2.5.2
|
93
|
+
rubygems_version: 3.0.3
|
92
94
|
signing_key:
|
93
95
|
specification_version: 4
|
94
96
|
summary: Cucumber step definitions for rails applications.
|