spreewald 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -2
- data/README.md +10 -5
- data/examples/paths.rb +36 -0
- data/examples/selectors.rb +28 -0
- data/lib/spreewald/all_steps.rb +4 -1
- data/lib/spreewald/time_steps.rb +102 -0
- data/lib/spreewald/timecop_steps.rb +6 -76
- data/lib/spreewald/web_steps.rb +1 -1
- data/lib/spreewald_support/tolerance_for_selenium_sync_issues.rb +9 -3
- data/lib/spreewald_support/version.rb +1 -1
- data/support/step_definition_file.rb +2 -0
- data/tests/rails-3_capybara-1/Gemfile +2 -1
- data/tests/rails-3_capybara-1/Gemfile.lock +3 -1
- data/tests/rails-3_capybara-2/Gemfile +2 -1
- data/tests/rails-3_capybara-2/Gemfile.lock +3 -1
- data/tests/rails-4_capybara-3/Gemfile.lock +1 -1
- data/tests/rails-4_capybara-3/features/time_steps.feature +1 -0
- data/tests/rails-6_capybara-3/.ruby-version +1 -1
- data/tests/rails-6_capybara-3/Gemfile.lock +1 -1
- data/tests/rails-6_capybara-3/features/time_steps.feature +1 -0
- data/tests/shared/app/views/static_pages/time.html.haml +2 -0
- data/tests/shared/config/routes.rb +1 -0
- data/tests/shared/features/shared/time_steps.feature +31 -0
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 782da77b76273a09876285f8cc37e9855cec78b891ae80fdff94413d0b0747d1
|
4
|
+
data.tar.gz: 3c85f3a589f466b48d2fce57b99a8bdb468c5672628becba955c69ded5cb642d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07de3d07cc658fbbc41f8441d897cbae26f5e2a03de17e159fbad72739f237ac20c3c762e9ab1a56a12d0a61b503a38fc9c49eb16c00481aad63bd267414f3a9
|
7
|
+
data.tar.gz: 22c6e544d8555dc5ef1978a8de23595e183ef3288c2fe90006229db5ded468e89f0308998428ee84d437b7810bdc9f79ba7c081dce3e4ed1677573554b7efa3f
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
5
5
|
|
6
|
+
## 2.6.0
|
7
|
+
- The time steps do now work with the time helpers in ActiveSupport 4.1+ if the timecop gem is not included in the bundle. Please note that the two approaches branch. While ActiveSupport will freeze the time, Timecop will keep it running.
|
8
|
+
- The steps in the file `spreewald/timecop.rb` file were moved to `spreewald/time.rb` and importing `spreewald/timecop` directly is deprecated now.
|
9
|
+
|
10
|
+
|
6
11
|
## 2.5.0
|
7
12
|
- Add a set of steps to control browser tabs (Selenium only):
|
8
13
|
* `I open ... in a new browser tab`
|
@@ -32,7 +37,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
32
37
|
|
33
38
|
## 2.2.4
|
34
39
|
- Fix "..." field should have the error "..." test by removing old should syntax
|
35
|
-
- Add single-line mail step to
|
40
|
+
- Add single-line mail step to README
|
36
41
|
|
37
42
|
## 2.2.3
|
38
43
|
- Fix 'the window should be titled' step - closes: [#102](https://github.com/makandra/spreewald/issues/102)
|
@@ -52,7 +57,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
52
57
|
|
53
58
|
## 2.2.0
|
54
59
|
- Add a new step `I should( not)? see a link labeled "STRING"`.
|
55
|
-
- Refer to Capybara 3's new flag `Capybara.default_normalize_ws = true` in the
|
60
|
+
- Refer to Capybara 3's new flag `Capybara.default_normalize_ws = true` in the README,
|
56
61
|
|
57
62
|
## 2.1.3
|
58
63
|
The `I should(not )? see /REGEXP/` step no longer refuses slashes as part of the regular expression. You can thus match full domains and more.
|
data/README.md
CHANGED
@@ -295,11 +295,14 @@ the step definitions.
|
|
295
295
|
See [this article](https://makandracards.com/makandra/763-cucumber-step-to-match-table-rows-with-capybara) for details.
|
296
296
|
|
297
297
|
|
298
|
-
###
|
298
|
+
### time_steps.rb
|
299
299
|
|
300
|
-
Steps to travel through time
|
300
|
+
Steps to travel through time
|
301
301
|
|
302
|
-
|
302
|
+
This uses [Timecop](https://github.com/jtrupiano/timecop) or Active Support 4.1+ to stub Time.now / Time.current.
|
303
|
+
The user is responsible for including one of the two gems.
|
304
|
+
|
305
|
+
Please note that the two approaches branch. While ActiveSupport will freeze the time, Timecop will keep it running.
|
303
306
|
|
304
307
|
|
305
308
|
* **When the (date|time) is "?(\d{4}-\d{2}-\d{2}( \d{1,2}:\d{2})?)"?**
|
@@ -317,7 +320,7 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
|
|
317
320
|
Given the time is 13:40
|
318
321
|
|
319
322
|
|
320
|
-
* **When it is (\d+|
|
323
|
+
* **When it is (\d+|an?|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)**
|
321
324
|
|
322
325
|
Example:
|
323
326
|
|
@@ -325,6 +328,8 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
|
|
325
328
|
When it is a few hours earlier
|
326
329
|
|
327
330
|
|
331
|
+
|
332
|
+
|
328
333
|
### web_steps.rb
|
329
334
|
|
330
335
|
Most of cucumber-rails' original web steps plus a few of our own.
|
@@ -353,7 +358,7 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
353
358
|
|
354
359
|
* **When ... within ...**
|
355
360
|
|
356
|
-
You can append `within [selector]` to any other web step.
|
361
|
+
You can append `within [selector]` to any other web step, even multiple times.
|
357
362
|
Be aware that within will only look at the first element that matches.
|
358
363
|
If this is a problem for you following links, you might want to have a look
|
359
364
|
at the 'When I follow "..." inside any "..."'-step.
|
data/examples/paths.rb
CHANGED
@@ -13,6 +13,30 @@ module NavigationHelpers
|
|
13
13
|
when /^the home\s?page$/
|
14
14
|
root_path
|
15
15
|
|
16
|
+
when /^the (page|form) for the (.*?) above$/
|
17
|
+
action_prose = Regexp.last_match(1)
|
18
|
+
model_prose = Regexp.last_match(2)
|
19
|
+
route = "#{(action_prose == 'form') ? 'edit_' : ''}#{model_prose_to_route_segment(model_prose)}_path"
|
20
|
+
model = model_prose_to_class(model_prose)
|
21
|
+
send(route, model.reorder(:id).last!)
|
22
|
+
|
23
|
+
when /^the (page|form) for the (.*?) "(.*?)"$/
|
24
|
+
action_prose = Regexp.last_match(1)
|
25
|
+
model_prose = Regexp.last_match(2)
|
26
|
+
identifier = Regexp.last_match(3)
|
27
|
+
path_to_show_or_edit(action_prose, model_prose, identifier)
|
28
|
+
|
29
|
+
when /^the (.*?) (page|form) for "(.*?)"$/
|
30
|
+
model_prose = Regexp.last_match(1)
|
31
|
+
action_prose = Regexp.last_match(2)
|
32
|
+
identifier = Regexp.last_match(3)
|
33
|
+
path_to_show_or_edit(action_prose, model_prose, identifier)
|
34
|
+
|
35
|
+
when /^the (.*?) form$/
|
36
|
+
model_prose = Regexp.last_match(1)
|
37
|
+
route = "new_#{model_prose_to_route_segment(model_prose)}_path"
|
38
|
+
send(route)
|
39
|
+
|
16
40
|
else
|
17
41
|
begin
|
18
42
|
page_name =~ /^the (.*) page$/
|
@@ -24,6 +48,18 @@ module NavigationHelpers
|
|
24
48
|
end
|
25
49
|
end
|
26
50
|
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def model_prose_to_class(model_prose)
|
55
|
+
model_prose.gsub(' ', '_').classify.constantize
|
56
|
+
end
|
57
|
+
|
58
|
+
def model_prose_to_route_segment(model_prose)
|
59
|
+
model_prose = model_prose.downcase
|
60
|
+
model_prose.gsub(/[\ \/]/, '_')
|
61
|
+
end
|
62
|
+
|
27
63
|
end
|
28
64
|
|
29
65
|
World(NavigationHelpers)
|
data/examples/selectors.rb
CHANGED
@@ -12,6 +12,27 @@ module HtmlSelectorsHelpers
|
|
12
12
|
when "the page"
|
13
13
|
"html > body"
|
14
14
|
|
15
|
+
# Auto-mapper for BEM classes and ARIA labels
|
16
|
+
#
|
17
|
+
# Usage examples:
|
18
|
+
# the main menu -> '.main-menu, [aria-label="main menu"]'
|
19
|
+
# the item box's header -> '.item-box--header, [aria-label="item box's header"]'
|
20
|
+
# the slider's item that is current -> '.slider--item.is-current, [aria-label="slider's item that is current"]'
|
21
|
+
when /^the (.*)$/
|
22
|
+
match = Regexp.last_match(1)
|
23
|
+
match =~ /^(.+?)(?:'s (.+?))?(?: that (.+))?$/
|
24
|
+
|
25
|
+
bem_selector = '.'
|
26
|
+
bem_selector << selectorify(Regexp.last_match(1))
|
27
|
+
bem_selector << '--' << selectorify(Regexp.last_match(2)) if Regexp.last_match(2)
|
28
|
+
bem_selector << '.' << selectorify(Regexp.last_match(3)) if Regexp.last_match(3)
|
29
|
+
|
30
|
+
aria_selector = '[aria-label="'
|
31
|
+
aria_selector << match.gsub('"', '\\"')
|
32
|
+
aria_selector << '"]'
|
33
|
+
|
34
|
+
[bem_selector, aria_selector].join(', ')
|
35
|
+
|
15
36
|
# Add more mappings here.
|
16
37
|
# Here is an example that pulls values out of the Regexp:
|
17
38
|
#
|
@@ -35,6 +56,13 @@ module HtmlSelectorsHelpers
|
|
35
56
|
"Now, go and add a mapping in #{__FILE__}"
|
36
57
|
end
|
37
58
|
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def selectorify(string)
|
63
|
+
string.gsub(/ /, '-')
|
64
|
+
end
|
65
|
+
|
38
66
|
end
|
39
67
|
|
40
68
|
World(HtmlSelectorsHelpers)
|
data/lib/spreewald/all_steps.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
require 'rspec/matchers'
|
3
3
|
|
4
|
+
ALREADY_LOADED_FILES = %w[all_steps timecop_steps]
|
5
|
+
|
4
6
|
Dir[File.join(File.dirname(__FILE__), '*_steps.rb')].each do |f|
|
5
7
|
name = File.basename(f, '.rb')
|
6
|
-
|
8
|
+
|
9
|
+
unless ALREADY_LOADED_FILES.include?(name)
|
7
10
|
require "spreewald/#{name}"
|
8
11
|
end
|
9
12
|
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
|
3
|
+
|
4
|
+
# Steps to travel through time
|
5
|
+
#
|
6
|
+
# This uses [Timecop](https://github.com/jtrupiano/timecop) or Active Support 4.1+ to stub Time.now / Time.current.
|
7
|
+
# The user is responsible for including one of the two gems.
|
8
|
+
#
|
9
|
+
# Please note that the two approaches branch. While ActiveSupport will freeze the time, Timecop will keep it running.
|
10
|
+
# FILE_COMMENT_END
|
11
|
+
|
12
|
+
major_minor_rails_version = defined?(ActiveSupport) ? [ActiveSupport::VERSION::MAJOR, ActiveSupport::VERSION::MINOR] : [0, 0]
|
13
|
+
is_at_least_rails_4_1 = (major_minor_rails_version <=> [4, 1]) != -1
|
14
|
+
|
15
|
+
if defined?(Timecop) || is_at_least_rails_4_1
|
16
|
+
|
17
|
+
module TimeHelpers
|
18
|
+
|
19
|
+
# When you have to make your rails app time zone aware you have to go 100%
|
20
|
+
# otherwise you are better off ignoring time zones at all.
|
21
|
+
# https://makandracards.com/makandra/8723-guide-to-localizing-a-rails-application
|
22
|
+
|
23
|
+
def use_timezones?
|
24
|
+
active_record_loaded = defined?(ActiveRecord::Base)
|
25
|
+
(!active_record_loaded || ActiveRecord::Base.default_timezone != :local) && Time.zone
|
26
|
+
end
|
27
|
+
|
28
|
+
def parse_time(str)
|
29
|
+
if use_timezones?
|
30
|
+
Time.zone.parse(str)
|
31
|
+
else
|
32
|
+
Time.parse(str)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def current_time
|
37
|
+
if use_timezones?
|
38
|
+
Time.current
|
39
|
+
else
|
40
|
+
Time.now
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if defined?(Timecop)
|
45
|
+
# Emulate ActiveSupport time helper methods with Timecop - don't rename these methods
|
46
|
+
def travel(duration)
|
47
|
+
Timecop.travel(current_time + duration)
|
48
|
+
end
|
49
|
+
|
50
|
+
def travel_to(date_or_time)
|
51
|
+
Timecop.travel(date_or_time)
|
52
|
+
end
|
53
|
+
|
54
|
+
def travel_back
|
55
|
+
Timecop.return
|
56
|
+
end
|
57
|
+
else
|
58
|
+
require 'active_support/testing/time_helpers'
|
59
|
+
include ActiveSupport::Testing::TimeHelpers
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
World(TimeHelpers)
|
65
|
+
|
66
|
+
# Example:
|
67
|
+
#
|
68
|
+
# Given the date is 2012-02-10
|
69
|
+
# Given the time is 2012-02-10 13:40
|
70
|
+
When /^the (?:date|time) is "?(\d{4}-\d{2}-\d{2}(?: \d{1,2}:\d{2})?)"?$/ do |time|
|
71
|
+
travel_to parse_time(time)
|
72
|
+
end.overridable
|
73
|
+
|
74
|
+
# Example:
|
75
|
+
#
|
76
|
+
# Given the time is 13:40
|
77
|
+
When /^the time is "?(\d{1,2}:\d{2})"?$/ do |time_without_date|
|
78
|
+
travel_to parse_time(time_without_date) # date will be today
|
79
|
+
end.overridable
|
80
|
+
|
81
|
+
# Example:
|
82
|
+
#
|
83
|
+
# When it is 10 minutes later
|
84
|
+
# When it is a few hours earlier
|
85
|
+
When /^it is (\d+|an?|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)$/ do |amount, unit, direction|
|
86
|
+
amount = case amount
|
87
|
+
when 'a', 'an'
|
88
|
+
1
|
89
|
+
when 'some', 'a few'
|
90
|
+
10
|
91
|
+
else
|
92
|
+
amount.to_i
|
93
|
+
end
|
94
|
+
amount = -amount if direction == 'earlier'
|
95
|
+
travel amount.send(unit)
|
96
|
+
end.overridable
|
97
|
+
|
98
|
+
After do
|
99
|
+
travel_back
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
@@ -1,79 +1,9 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
# Steps to travel through time using [Timecop](https://github.com/jtrupiano/timecop).
|
5
|
-
#
|
6
|
-
# See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps-to-travel-through-time-with-timecop) for details.
|
1
|
+
# nodoc
|
7
2
|
# FILE_COMMENT_END
|
8
3
|
|
4
|
+
warn <<-WARNING
|
5
|
+
Warning: The file spreewald/timecop_steps.rb is deprecated. It was moved to
|
6
|
+
spreewald/time_steps.rb. Please require the new file instead.
|
7
|
+
WARNING
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
module TimecopHarness
|
13
|
-
|
14
|
-
# When you have to make your rails app time zone aware you have to go 100%
|
15
|
-
# otherwise you are better off ignoring time zones at all.
|
16
|
-
# https://makandracards.com/makandra/8723-guide-to-localizing-a-rails-application
|
17
|
-
|
18
|
-
def use_timezones?
|
19
|
-
active_record_loaded = defined?(ActiveRecord::Base)
|
20
|
-
(!active_record_loaded || ActiveRecord::Base.default_timezone != :local) && Time.zone
|
21
|
-
end
|
22
|
-
|
23
|
-
def parse_time(str)
|
24
|
-
if use_timezones?
|
25
|
-
Time.zone.parse(str)
|
26
|
-
else
|
27
|
-
Time.parse(str)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def current_time
|
32
|
-
if use_timezones?
|
33
|
-
Time.current
|
34
|
-
else
|
35
|
-
Time.now
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
World(TimecopHarness)
|
42
|
-
|
43
|
-
# Example:
|
44
|
-
#
|
45
|
-
# Given the date is 2012-02-10
|
46
|
-
# Given the time is 2012-02-10 13:40
|
47
|
-
When /^the (?:date|time) is "?(\d{4}-\d{2}-\d{2}(?: \d{1,2}:\d{2})?)"?$/ do |time|
|
48
|
-
Timecop.travel(parse_time(time))
|
49
|
-
end.overridable
|
50
|
-
|
51
|
-
# Example:
|
52
|
-
#
|
53
|
-
# Given the time is 13:40
|
54
|
-
When /^the time is "?(\d{1,2}:\d{2})"?$/ do |time_without_date|
|
55
|
-
Timecop.travel(parse_time(time_without_date)) # date will be today
|
56
|
-
end.overridable
|
57
|
-
|
58
|
-
# Example:
|
59
|
-
#
|
60
|
-
# When it is 10 minutes later
|
61
|
-
# When it is a few hours earlier
|
62
|
-
When /^it is (\d+|a|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)$/ do |amount, unit, direction|
|
63
|
-
amount = case amount
|
64
|
-
when 'a'
|
65
|
-
1
|
66
|
-
when 'some', 'a few'
|
67
|
-
10
|
68
|
-
else
|
69
|
-
amount.to_i
|
70
|
-
end
|
71
|
-
amount = -amount if direction == 'earlier'
|
72
|
-
Timecop.travel(current_time + amount.send(unit))
|
73
|
-
end.overridable
|
74
|
-
|
75
|
-
After do
|
76
|
-
Timecop.return
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
9
|
+
require 'spreewald/time_steps'
|
data/lib/spreewald/web_steps.rb
CHANGED
@@ -35,7 +35,7 @@ require 'uri'
|
|
35
35
|
require 'cgi'
|
36
36
|
|
37
37
|
|
38
|
-
# You can append `within [selector]` to any other web step.
|
38
|
+
# You can append `within [selector]` to any other web step, even multiple times.
|
39
39
|
# Be aware that within will only look at the first element that matches.
|
40
40
|
# If this is a problem for you following links, you might want to have a look
|
41
41
|
# at the 'When I follow "..." inside any "..."'-step.
|
@@ -38,22 +38,28 @@ module ToleranceForSeleniumSyncIssues
|
|
38
38
|
WAIT_PERIOD = 0.05
|
39
39
|
|
40
40
|
def patiently(seconds, &block)
|
41
|
-
started =
|
41
|
+
started = monotonic_time
|
42
42
|
tries = 0
|
43
43
|
begin
|
44
44
|
tries += 1
|
45
45
|
block.call
|
46
46
|
rescue Exception => e
|
47
47
|
raise e unless retryable_error?(e)
|
48
|
-
raise e if (
|
48
|
+
raise e if (monotonic_time - started > seconds && tries >= 2)
|
49
49
|
sleep(WAIT_PERIOD)
|
50
|
-
raise Capybara::FrozenInTime, "time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead" if
|
50
|
+
raise Capybara::FrozenInTime, "time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead" if monotonic_time == started
|
51
51
|
retry
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
private
|
56
56
|
|
57
|
+
def monotonic_time
|
58
|
+
# We use the system clock (i.e. seconds since boot) to calculate the time,
|
59
|
+
# because Time.now may be frozen
|
60
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
61
|
+
end
|
62
|
+
|
57
63
|
def retryable_error?(e)
|
58
64
|
RETRY_ERRORS.include?(e.class.name)
|
59
65
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
spreewald (2.
|
4
|
+
spreewald (2.6.0)
|
5
5
|
cucumber
|
6
6
|
cucumber_priority (>= 0.3.0)
|
7
7
|
rspec (>= 2.13.0)
|
@@ -150,6 +150,7 @@ GEM
|
|
150
150
|
sqlite3 (1.3.8)
|
151
151
|
thor (0.18.1)
|
152
152
|
tilt (1.4.1)
|
153
|
+
timecop (0.9.1)
|
153
154
|
treetop (1.4.12)
|
154
155
|
polyglot
|
155
156
|
polyglot (>= 0.3.1)
|
@@ -175,6 +176,7 @@ DEPENDENCIES
|
|
175
176
|
selenium-webdriver
|
176
177
|
spreewald!
|
177
178
|
sqlite3
|
179
|
+
timecop
|
178
180
|
|
179
181
|
BUNDLED WITH
|
180
182
|
1.17.3
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
spreewald (2.
|
4
|
+
spreewald (2.6.0)
|
5
5
|
cucumber
|
6
6
|
cucumber_priority (>= 0.3.0)
|
7
7
|
rspec (>= 2.13.0)
|
@@ -158,6 +158,7 @@ GEM
|
|
158
158
|
sqlite3 (1.3.8)
|
159
159
|
thor (0.18.1)
|
160
160
|
tilt (1.4.1)
|
161
|
+
timecop (0.9.1)
|
161
162
|
treetop (1.4.12)
|
162
163
|
polyglot
|
163
164
|
polyglot (>= 0.3.1)
|
@@ -184,6 +185,7 @@ DEPENDENCIES
|
|
184
185
|
selenium-webdriver
|
185
186
|
spreewald!
|
186
187
|
sqlite3
|
188
|
+
timecop
|
187
189
|
|
188
190
|
BUNDLED WITH
|
189
191
|
1.17.3
|
@@ -0,0 +1 @@
|
|
1
|
+
../../shared/features/shared/time_steps.feature
|
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.6
|
@@ -0,0 +1 @@
|
|
1
|
+
../../shared/features/shared/time_steps.feature
|
@@ -28,6 +28,7 @@ Rails.application.routes.draw do
|
|
28
28
|
get '/static_pages/tab_1', to: 'static_pages#tab_1'
|
29
29
|
get '/static_pages/tab_2', to: 'static_pages#tab_2'
|
30
30
|
get '/static_pages/tab_3', to: 'static_pages#tab_3'
|
31
|
+
get '/static_pages/time', to: 'static_pages#time'
|
31
32
|
get '/static_pages/visibility', to: 'static_pages#visibility'
|
32
33
|
get '/static_pages/within', to: 'static_pages#within'
|
33
34
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# The time steps use the timecop gem or ActiveSupport 4.1, depending on what is
|
2
|
+
# available.
|
3
|
+
# In order to test both implementations, the rails 3 test projects (Capybara 1 & 2)
|
4
|
+
# use timecop to run this feature, while the rails 4 & 6 test projects (Capybara 6)
|
5
|
+
# use ActiveSupport for this feature.
|
6
|
+
|
7
|
+
Feature: Time steps
|
8
|
+
Scenario: /^the (?:date|time) is "?(\d{4}-\d{2}-\d{2}(?: \d{1,2}:\d{2})?)"?$/
|
9
|
+
Given the time is "2020-02-03 02:12"
|
10
|
+
When I go to "/static_pages/time"
|
11
|
+
Then I should see "The current date is 2020-02-03."
|
12
|
+
And I should see "The current time is 02:12."
|
13
|
+
|
14
|
+
Given the time is 23:24
|
15
|
+
When I go to "/static_pages/time"
|
16
|
+
Then I should see "The current time is 23:24."
|
17
|
+
|
18
|
+
Scenario: Set just the date
|
19
|
+
Given the date is "2020-02-03"
|
20
|
+
When I go to "/static_pages/time"
|
21
|
+
Then I should see "The current date is 2020-02-03."
|
22
|
+
|
23
|
+
Scenario: it is (\d+|an?|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)
|
24
|
+
Given the time is "23:00"
|
25
|
+
When it is 24 minutes later
|
26
|
+
And I go to "/static_pages/time"
|
27
|
+
Then I should see "The current time is 23:24."
|
28
|
+
|
29
|
+
When it is an hour earlier
|
30
|
+
And I go to "/static_pages/time"
|
31
|
+
Then I should see "The current time is 22:24"
|
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: 2.
|
4
|
+
version: 2.6.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: 2020-
|
11
|
+
date: 2020-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/spreewald/email_steps.rb
|
160
160
|
- lib/spreewald/file_attachment_steps.rb
|
161
161
|
- lib/spreewald/table_steps.rb
|
162
|
+
- lib/spreewald/time_steps.rb
|
162
163
|
- lib/spreewald/timecop_steps.rb
|
163
164
|
- lib/spreewald/web_steps.rb
|
164
165
|
- lib/spreewald_support/comparison.rb
|
@@ -259,6 +260,7 @@ files:
|
|
259
260
|
- tests/rails-4_capybara-3/features/support/selectors.rb
|
260
261
|
- tests/rails-4_capybara-3/features/support/selenium.rb
|
261
262
|
- tests/rails-4_capybara-3/features/table_steps.feature
|
263
|
+
- tests/rails-4_capybara-3/features/time_steps.feature
|
262
264
|
- tests/rails-4_capybara-3/features/web_steps.feature
|
263
265
|
- tests/rails-4_capybara-3/lib/tasks/cucumber.rake
|
264
266
|
- tests/rails-4_capybara-3/log/.keep
|
@@ -312,6 +314,7 @@ files:
|
|
312
314
|
- tests/rails-6_capybara-3/features/support/selectors.rb
|
313
315
|
- tests/rails-6_capybara-3/features/support/selenium.rb
|
314
316
|
- tests/rails-6_capybara-3/features/table_steps.feature
|
317
|
+
- tests/rails-6_capybara-3/features/time_steps.feature
|
315
318
|
- tests/rails-6_capybara-3/features/web_steps.feature
|
316
319
|
- tests/rails-6_capybara-3/lib/tasks/.keep
|
317
320
|
- tests/rails-6_capybara-3/lib/tasks/cucumber.rake
|
@@ -353,6 +356,7 @@ files:
|
|
353
356
|
- tests/shared/app/views/static_pages/tab_1.haml
|
354
357
|
- tests/shared/app/views/static_pages/tab_2.haml
|
355
358
|
- tests/shared/app/views/static_pages/tab_3.haml
|
359
|
+
- tests/shared/app/views/static_pages/time.html.haml
|
356
360
|
- tests/shared/app/views/static_pages/visibility.html.haml
|
357
361
|
- tests/shared/app/views/static_pages/within.html.haml
|
358
362
|
- tests/shared/app/views/tables/table1.html.haml
|
@@ -370,6 +374,7 @@ files:
|
|
370
374
|
- tests/shared/features/shared/step_definitions/overriding_steps.rb
|
371
375
|
- tests/shared/features/shared/step_definitions/test_steps.rb
|
372
376
|
- tests/shared/features/shared/table_steps.feature
|
377
|
+
- tests/shared/features/shared/time_steps.feature
|
373
378
|
- tests/shared/features/shared/web_steps.feature
|
374
379
|
- tests/shared/features/support/paths.rb
|
375
380
|
- tests/shared/features/support/selectors.rb
|
@@ -396,7 +401,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
396
401
|
- !ruby/object:Gem::Version
|
397
402
|
version: '0'
|
398
403
|
requirements: []
|
399
|
-
rubygems_version: 3.1.
|
404
|
+
rubygems_version: 3.1.2
|
400
405
|
signing_key:
|
401
406
|
specification_version: 4
|
402
407
|
summary: Collection of useful cucumber steps.
|
@@ -478,6 +483,7 @@ test_files:
|
|
478
483
|
- tests/rails-4_capybara-3/features/support/selectors.rb
|
479
484
|
- tests/rails-4_capybara-3/features/support/selenium.rb
|
480
485
|
- tests/rails-4_capybara-3/features/table_steps.feature
|
486
|
+
- tests/rails-4_capybara-3/features/time_steps.feature
|
481
487
|
- tests/rails-4_capybara-3/features/web_steps.feature
|
482
488
|
- tests/rails-4_capybara-3/lib/tasks/cucumber.rake
|
483
489
|
- tests/rails-4_capybara-3/log/.keep
|
@@ -531,6 +537,7 @@ test_files:
|
|
531
537
|
- tests/rails-6_capybara-3/features/support/selectors.rb
|
532
538
|
- tests/rails-6_capybara-3/features/support/selenium.rb
|
533
539
|
- tests/rails-6_capybara-3/features/table_steps.feature
|
540
|
+
- tests/rails-6_capybara-3/features/time_steps.feature
|
534
541
|
- tests/rails-6_capybara-3/features/web_steps.feature
|
535
542
|
- tests/rails-6_capybara-3/lib/tasks/.keep
|
536
543
|
- tests/rails-6_capybara-3/lib/tasks/cucumber.rake
|
@@ -572,6 +579,7 @@ test_files:
|
|
572
579
|
- tests/shared/app/views/static_pages/tab_1.haml
|
573
580
|
- tests/shared/app/views/static_pages/tab_2.haml
|
574
581
|
- tests/shared/app/views/static_pages/tab_3.haml
|
582
|
+
- tests/shared/app/views/static_pages/time.html.haml
|
575
583
|
- tests/shared/app/views/static_pages/visibility.html.haml
|
576
584
|
- tests/shared/app/views/static_pages/within.html.haml
|
577
585
|
- tests/shared/app/views/tables/table1.html.haml
|
@@ -589,6 +597,7 @@ test_files:
|
|
589
597
|
- tests/shared/features/shared/step_definitions/overriding_steps.rb
|
590
598
|
- tests/shared/features/shared/step_definitions/test_steps.rb
|
591
599
|
- tests/shared/features/shared/table_steps.feature
|
600
|
+
- tests/shared/features/shared/time_steps.feature
|
592
601
|
- tests/shared/features/shared/web_steps.feature
|
593
602
|
- tests/shared/features/support/paths.rb
|
594
603
|
- tests/shared/features/support/selectors.rb
|