spreewald 4.6.5 → 4.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +9 -3
- data/.ruby-version +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +3 -1
- data/{Gemfile.ruby_3_2_0 → Gemfile.ruby_3_2} +1 -1
- data/{Gemfile.ruby_3_2_0.lock → Gemfile.ruby_3_2.lock} +1 -1
- data/{Gemfile.ruby_3_4_9 → Gemfile.ruby_3_3} +1 -1
- data/{Gemfile.ruby_3_3_10.lock → Gemfile.ruby_3_3.lock} +1 -1
- data/{Gemfile.ruby_3_3_10 → Gemfile.ruby_3_4} +1 -1
- data/{Gemfile.ruby_3_4_9.lock → Gemfile.ruby_3_4.lock} +1 -1
- data/Gemfile.ruby_4_0 +15 -0
- data/Gemfile.ruby_4_0.lock +157 -0
- data/lib/spreewald/browser_tab_steps.rb +6 -6
- data/lib/spreewald/development_steps.rb +1 -1
- data/lib/spreewald/email_steps.rb +7 -7
- data/lib/spreewald/frame_steps.rb +2 -2
- data/lib/spreewald/session_steps.rb +2 -2
- data/lib/spreewald/table_steps.rb +1 -1
- data/lib/spreewald/web_steps.rb +58 -58
- data/lib/spreewald_support/version.rb +1 -1
- data/spec/steps/follow_the_link_spec.rb +2 -2
- data/tests/rails-7_capybara-3/Gemfile.lock +1 -1
- data/tests/rails-8_capybara-3/Gemfile +2 -1
- data/tests/rails-8_capybara-3/Gemfile.lock +32 -25
- metadata +10 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac93f0fef6e2be9998a2b9f1514469dcf25213c0e342d20fafd38e8328b382b5
|
|
4
|
+
data.tar.gz: d1701b593bc278db9c823ad15b9bfe462c3be2baa6fbc976f61807679bfe3f05
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de4329e2f458176854e0750c8e33520369c55085456fdb388e2c8e35c1fca2e623bcdb87851ef61375664303860fb03eaef61576031aa4c878526d4c22014912
|
|
7
|
+
data.tar.gz: a522c0aee98335099fb5ec7fbe4c9837ad31d5cc345696b3e5fdcb581b569c01c94ba981a70fb595efa6b9f87c3ab03ea074d3c6e17735da12e6902833612feb
|
data/.github/workflows/test.yml
CHANGED
|
@@ -20,13 +20,19 @@ jobs:
|
|
|
20
20
|
gemfile: tests/rails-7_capybara-3/Gemfile
|
|
21
21
|
- ruby: 3.3.10
|
|
22
22
|
gemfile: tests/rails-8_capybara-3/Gemfile
|
|
23
|
+
- ruby: 3.4.9
|
|
24
|
+
gemfile: tests/rails-8_capybara-3/Gemfile
|
|
25
|
+
- ruby: 4.0.3
|
|
26
|
+
gemfile: tests/rails-8_capybara-3/Gemfile
|
|
23
27
|
# Used to run rspec and integration tests for spreewald binary:
|
|
24
28
|
- ruby: 3.2.0
|
|
25
|
-
gemfile: Gemfile.
|
|
29
|
+
gemfile: Gemfile.ruby_3_2
|
|
26
30
|
- ruby: 3.3.10
|
|
27
|
-
gemfile: Gemfile.
|
|
31
|
+
gemfile: Gemfile.ruby_3_3
|
|
28
32
|
- ruby: 3.4.9
|
|
29
|
-
gemfile: Gemfile.
|
|
33
|
+
gemfile: Gemfile.ruby_3_4
|
|
34
|
+
- ruby: 4.0.3
|
|
35
|
+
gemfile: Gemfile.ruby_4_0
|
|
30
36
|
env:
|
|
31
37
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
|
32
38
|
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.3
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@ 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
|
+
## 4.6.6
|
|
7
|
+
- Add support for Ruby 4.0
|
|
8
|
+
|
|
9
|
+
## 4.6.5
|
|
10
|
+
- Drop support for Ruby < 3.2
|
|
11
|
+
- Allow Capybara to click on labels instead of inputs for checkboxes
|
|
12
|
+
|
|
6
13
|
## 4.6.4
|
|
7
14
|
- New step `I attach the files ["file1", "file2" and "file3"] to "My Uploads"`
|
|
8
15
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/Gemfile.ruby_4_0
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
spreewald (4.6.6)
|
|
5
|
+
capybara
|
|
6
|
+
cucumber
|
|
7
|
+
cucumber_priority (>= 0.3.0)
|
|
8
|
+
rspec (>= 2.13.0)
|
|
9
|
+
xpath
|
|
10
|
+
|
|
11
|
+
GEM
|
|
12
|
+
remote: https://rubygems.org/
|
|
13
|
+
specs:
|
|
14
|
+
addressable (2.9.0)
|
|
15
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
16
|
+
aruba (2.4.0)
|
|
17
|
+
bundler (>= 1.17)
|
|
18
|
+
contracts (>= 0.16.0, < 0.18.0)
|
|
19
|
+
cucumber (>= 8.0, < 12.0)
|
|
20
|
+
irb (~> 1.16)
|
|
21
|
+
rspec-expectations (>= 3.4, < 5.0)
|
|
22
|
+
thor (~> 1.0)
|
|
23
|
+
base64 (0.3.0)
|
|
24
|
+
bigdecimal (4.1.2)
|
|
25
|
+
builder (3.3.0)
|
|
26
|
+
capybara (3.40.0)
|
|
27
|
+
addressable
|
|
28
|
+
matrix
|
|
29
|
+
mini_mime (>= 0.1.3)
|
|
30
|
+
nokogiri (~> 1.11)
|
|
31
|
+
rack (>= 1.6.0)
|
|
32
|
+
rack-test (>= 0.6.3)
|
|
33
|
+
regexp_parser (>= 1.5, < 3.0)
|
|
34
|
+
xpath (~> 3.2)
|
|
35
|
+
contracts (0.17.3)
|
|
36
|
+
cucumber (11.0.0)
|
|
37
|
+
base64 (~> 0.2)
|
|
38
|
+
builder (~> 3.2)
|
|
39
|
+
cucumber-ci-environment (> 9, < 12)
|
|
40
|
+
cucumber-core (>= 16.2.0, < 17)
|
|
41
|
+
cucumber-cucumber-expressions (> 17, < 20)
|
|
42
|
+
cucumber-html-formatter (> 21, < 24)
|
|
43
|
+
diff-lcs (~> 1.5)
|
|
44
|
+
logger (~> 1.6)
|
|
45
|
+
mini_mime (~> 1.1)
|
|
46
|
+
multi_test (~> 1.1)
|
|
47
|
+
sys-uname (~> 1.5)
|
|
48
|
+
cucumber-ci-environment (11.0.0)
|
|
49
|
+
cucumber-core (16.2.0)
|
|
50
|
+
cucumber-gherkin (> 36, < 40)
|
|
51
|
+
cucumber-messages (> 31, < 33)
|
|
52
|
+
cucumber-tag-expressions (> 6, < 9)
|
|
53
|
+
cucumber-cucumber-expressions (19.0.0)
|
|
54
|
+
bigdecimal
|
|
55
|
+
cucumber-gherkin (39.0.0)
|
|
56
|
+
cucumber-messages (>= 31, < 33)
|
|
57
|
+
cucumber-html-formatter (23.1.0)
|
|
58
|
+
cucumber-messages (> 23, < 33)
|
|
59
|
+
cucumber-messages (32.3.1)
|
|
60
|
+
cucumber-tag-expressions (8.1.0)
|
|
61
|
+
cucumber_priority (1.1.0)
|
|
62
|
+
cucumber
|
|
63
|
+
date (3.5.1)
|
|
64
|
+
diff-lcs (1.6.2)
|
|
65
|
+
erb (6.0.4)
|
|
66
|
+
ffi (1.17.4-x86_64-linux-gnu)
|
|
67
|
+
gemika (2.0.0)
|
|
68
|
+
io-console (0.8.2)
|
|
69
|
+
irb (1.18.0)
|
|
70
|
+
pp (>= 0.6.0)
|
|
71
|
+
prism (>= 1.3.0)
|
|
72
|
+
rdoc (>= 4.0.0)
|
|
73
|
+
reline (>= 0.4.2)
|
|
74
|
+
logger (1.7.0)
|
|
75
|
+
mail (2.8.1)
|
|
76
|
+
mini_mime (>= 0.1.1)
|
|
77
|
+
net-imap
|
|
78
|
+
net-pop
|
|
79
|
+
net-smtp
|
|
80
|
+
matrix (0.4.3)
|
|
81
|
+
memoist3 (1.0.0)
|
|
82
|
+
mini_mime (1.1.5)
|
|
83
|
+
multi_test (1.1.0)
|
|
84
|
+
net-imap (0.6.4)
|
|
85
|
+
date
|
|
86
|
+
net-protocol
|
|
87
|
+
net-pop (0.1.2)
|
|
88
|
+
net-protocol
|
|
89
|
+
net-protocol (0.2.2)
|
|
90
|
+
timeout
|
|
91
|
+
net-smtp (0.5.1)
|
|
92
|
+
net-protocol
|
|
93
|
+
nokogiri (1.19.3-x86_64-linux-gnu)
|
|
94
|
+
racc (~> 1.4)
|
|
95
|
+
ostruct (0.6.3)
|
|
96
|
+
pp (0.6.3)
|
|
97
|
+
prettyprint
|
|
98
|
+
prettyprint (0.2.0)
|
|
99
|
+
prism (1.9.0)
|
|
100
|
+
psych (5.3.1)
|
|
101
|
+
date
|
|
102
|
+
stringio
|
|
103
|
+
public_suffix (7.0.5)
|
|
104
|
+
racc (1.8.1)
|
|
105
|
+
rack (3.2.6)
|
|
106
|
+
rack-test (2.2.0)
|
|
107
|
+
rack (>= 1.3)
|
|
108
|
+
rake (13.4.2)
|
|
109
|
+
rdoc (7.2.0)
|
|
110
|
+
erb
|
|
111
|
+
psych (>= 4.0.0)
|
|
112
|
+
tsort
|
|
113
|
+
regexp_parser (2.12.0)
|
|
114
|
+
reline (0.6.3)
|
|
115
|
+
io-console (~> 0.5)
|
|
116
|
+
rspec (3.13.2)
|
|
117
|
+
rspec-core (~> 3.13.0)
|
|
118
|
+
rspec-expectations (~> 3.13.0)
|
|
119
|
+
rspec-mocks (~> 3.13.0)
|
|
120
|
+
rspec-core (3.13.6)
|
|
121
|
+
rspec-support (~> 3.13.0)
|
|
122
|
+
rspec-expectations (3.13.5)
|
|
123
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
124
|
+
rspec-support (~> 3.13.0)
|
|
125
|
+
rspec-mocks (3.13.8)
|
|
126
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
127
|
+
rspec-support (~> 3.13.0)
|
|
128
|
+
rspec-support (3.13.7)
|
|
129
|
+
stringio (3.2.0)
|
|
130
|
+
sys-uname (1.5.1)
|
|
131
|
+
ffi (~> 1.1)
|
|
132
|
+
memoist3 (~> 1.0.0)
|
|
133
|
+
thor (1.5.0)
|
|
134
|
+
timeout (0.6.1)
|
|
135
|
+
tsort (0.2.0)
|
|
136
|
+
xpath (3.2.0)
|
|
137
|
+
nokogiri (~> 1.8)
|
|
138
|
+
|
|
139
|
+
PLATFORMS
|
|
140
|
+
x86_64-linux
|
|
141
|
+
|
|
142
|
+
DEPENDENCIES
|
|
143
|
+
aruba
|
|
144
|
+
cucumber
|
|
145
|
+
gemika
|
|
146
|
+
mail (~> 2.8.0)
|
|
147
|
+
nokogiri
|
|
148
|
+
ostruct
|
|
149
|
+
rake
|
|
150
|
+
rspec
|
|
151
|
+
spreewald!
|
|
152
|
+
|
|
153
|
+
RUBY VERSION
|
|
154
|
+
ruby 4.0.3
|
|
155
|
+
|
|
156
|
+
BUNDLED WITH
|
|
157
|
+
4.0.11
|
|
@@ -14,7 +14,7 @@ After do
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# Opens [the page](https://github.com/makandra/spreewald/blob/master/examples/paths.rb) in a new browser tab and switches to it.
|
|
17
|
-
When
|
|
17
|
+
When(/^I open (.+?) in a new browser tab$/) do |page_name|
|
|
18
18
|
require_selenium!
|
|
19
19
|
previous_handles_count = browser.window_handles.size
|
|
20
20
|
relative_target_path = path_to(page_name)
|
|
@@ -39,14 +39,14 @@ When 'I close the browser tab' do
|
|
|
39
39
|
end.overridable
|
|
40
40
|
|
|
41
41
|
# Waits for the new browser tab to appear, then switches to it.
|
|
42
|
-
When
|
|
42
|
+
When(/^I switch to the new(?:ly opened)? browser tab$/) do
|
|
43
43
|
require_selenium!
|
|
44
44
|
step 'there should be at least 2 browser tabs'
|
|
45
45
|
browser.switch_to.window(browser.window_handles.last)
|
|
46
46
|
end.overridable
|
|
47
47
|
|
|
48
48
|
# Changes the browser context to the second-last browser tab.
|
|
49
|
-
When
|
|
49
|
+
When(/^I switch(?: back)? to the previous browser tab$/) do
|
|
50
50
|
require_selenium!
|
|
51
51
|
previous_handle = browser.window_handles[-2] # Second last should be the previous browser tab
|
|
52
52
|
previous_handle ||= browser.window_handles.first # Fall back if only one tab is left
|
|
@@ -69,21 +69,21 @@ end.overridable
|
|
|
69
69
|
# When I may open a new browser tab
|
|
70
70
|
# And I click on "Open link in current browser tab"
|
|
71
71
|
# Then I should not have opened a new browser tab
|
|
72
|
-
Then
|
|
72
|
+
Then(/^I should( not)? have opened a new browser tab$/) do |negate|
|
|
73
73
|
raise "you need to use the 'I may open a new tab' step beforehand" unless @previous_browser_tabs_count
|
|
74
74
|
expected_browser_tab_count = negate ? @previous_browser_tabs_count : (@previous_browser_tabs_count + 1)
|
|
75
75
|
|
|
76
76
|
step "there should be #{expected_browser_tab_count} browser tabs"
|
|
77
77
|
end.overridable
|
|
78
78
|
|
|
79
|
-
Then
|
|
79
|
+
Then(/^there should be (\d+) browser tabs?$/) do |expected_browser_tabs|
|
|
80
80
|
patiently do
|
|
81
81
|
actual_browser_tabs = browser.window_handles.size
|
|
82
82
|
expect(actual_browser_tabs).to eq(expected_browser_tabs.to_i), "Expected #{expected_browser_tabs} browser tab to be open, but found #{actual_browser_tabs}"
|
|
83
83
|
end
|
|
84
84
|
end.overridable
|
|
85
85
|
|
|
86
|
-
Then
|
|
86
|
+
Then(/^there should be at least (\d+) browser tabs?$/) do |expected_browser_tabs|
|
|
87
87
|
patiently do
|
|
88
88
|
actual_browser_tabs = browser.window_handles.size
|
|
89
89
|
expect(actual_browser_tabs).to be >= (expected_browser_tabs.to_i), "Expected at least #{expected_browser_tabs} browser tab to be open, but found #{actual_browser_tabs}"
|
|
@@ -8,7 +8,7 @@ Before do
|
|
|
8
8
|
ActionMailer::Base.deliveries.clear
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
When
|
|
11
|
+
When(/^I clear my e?mails$/) do
|
|
12
12
|
ActionMailer::Base.deliveries.clear
|
|
13
13
|
end.overridable
|
|
14
14
|
|
|
@@ -35,7 +35,7 @@ end.overridable
|
|
|
35
35
|
# You may skip lines in the header.
|
|
36
36
|
# Please note: In older versions of Spreewald, unmentioned body lines were skipped.
|
|
37
37
|
# Now you have to use the asterisk explicitly to omit lines in the body.
|
|
38
|
-
Then
|
|
38
|
+
Then(/^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/) do |mode, type, raw_data|
|
|
39
39
|
patiently do
|
|
40
40
|
results = MailFinder.find(raw_data, type.strip)
|
|
41
41
|
|
|
@@ -73,28 +73,28 @@ end.overridable
|
|
|
73
73
|
|
|
74
74
|
# Please note that this step will only follow HTTP and HTTPS links.
|
|
75
75
|
# Other links (such as mailto: or ftp:// links) are ignored.
|
|
76
|
-
When
|
|
76
|
+
When(/^I follow the (first|second|third)? ?link in the e?mail$/) do |index_in_words|
|
|
77
77
|
mail = @mail || ActionMailer::Base.deliveries.last
|
|
78
78
|
Spreewald::Steps::FollowTheLink.new(mail, index_in_words).run
|
|
79
79
|
end.overridable
|
|
80
80
|
|
|
81
|
-
Then
|
|
81
|
+
Then(/^no e?mail should have been sent$/) do
|
|
82
82
|
expect(ActionMailer::Base.deliveries).to be_empty
|
|
83
83
|
end.overridable
|
|
84
84
|
|
|
85
85
|
# Checks that the last sent email includes some text
|
|
86
|
-
Then
|
|
86
|
+
Then(/^I should see "([^\"]*)" in the( HTML| plain-text|) e?mail$/) do |text, type|
|
|
87
87
|
expect(MailFinder.email_text_body(ActionMailer::Base.deliveries.last, type.strip)).to include(text)
|
|
88
88
|
end.overridable
|
|
89
89
|
|
|
90
90
|
# Print all sent emails to STDOUT (optionally only the headers).
|
|
91
|
-
Then
|
|
91
|
+
Then(/^show me the e?mail( header)?s$/) do |only_header|
|
|
92
92
|
Spreewald::Steps::ShowMeTheMails.new(ActionMailer::Base.deliveries, only_header).run
|
|
93
93
|
end.overridable
|
|
94
94
|
|
|
95
95
|
# Print a subset of all sent emails to STDOUT
|
|
96
96
|
# This uses the same syntax as `Then an email should have been sent with:`
|
|
97
|
-
Then
|
|
97
|
+
Then(/^show me the e?mail( header)?s with:$/) do |only_header, raw_data|
|
|
98
98
|
results = MailFinder.find(raw_data)
|
|
99
99
|
if results.empty?
|
|
100
100
|
if results.matching_header.empty?
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# Then I should see "Cherry" inside the fruits iframe
|
|
7
7
|
# When I press "Save" inside the 2nd iframe
|
|
8
8
|
#
|
|
9
|
-
When
|
|
9
|
+
When(/^(.*?) inside the (.*?) iframe$/) do |nested_step, frame_identifier|
|
|
10
10
|
patiently do
|
|
11
11
|
frame = find_frame(frame_identifier)
|
|
12
12
|
page.within_frame(frame) do
|
|
@@ -16,7 +16,7 @@ When /^(.*?) inside the (.*?) iframe$/ do |nested_step, frame_identifier|
|
|
|
16
16
|
end.overridable
|
|
17
17
|
|
|
18
18
|
# nodoc
|
|
19
|
-
When
|
|
19
|
+
When(/^(.*?) inside the (.*?) iframe:$/) do |nested_step, frame_identifier, table_or_string|
|
|
20
20
|
patiently do
|
|
21
21
|
frame = find_frame(frame_identifier)
|
|
22
22
|
page.within_frame(frame) do
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
# You may need to update other steps to allow multiple sessions (e.g. your
|
|
5
5
|
# authentication steps have to support multiple logged in users).
|
|
6
6
|
# More details [here](https://makandracards.com/makandra/474480-how-to-make-a-cucumber-test-work-with-multiple-browser-sessions).
|
|
7
|
-
When
|
|
7
|
+
When(/^(.*) in the browser session "([^"]+)"$/) do |nested_step, session_name|
|
|
8
8
|
Capybara.using_session(session_name) do
|
|
9
9
|
step(nested_step)
|
|
10
10
|
end
|
|
11
11
|
end.overridable(priority: 5)
|
|
12
12
|
|
|
13
13
|
# nodoc
|
|
14
|
-
When
|
|
14
|
+
When(/^(.*) in the browser session "([^"]+)":$/) do |nested_step, session_name, table_or_string|
|
|
15
15
|
Capybara.using_session(session_name) do
|
|
16
16
|
step("#{nested_step}:", table_or_string)
|
|
17
17
|
end
|
|
@@ -120,7 +120,7 @@ World(TableStepsHelper)
|
|
|
120
120
|
# Check the content of tables in your HTML.
|
|
121
121
|
#
|
|
122
122
|
# See [this article](https://makandracards.com/makandra/763-cucumber-step-to-match-table-rows-with-capybara) for details.
|
|
123
|
-
Then
|
|
123
|
+
Then(/^I should( not)? see a table with (exactly )?the following rows( in any order)?:?$/) do |negate, exactly, unordered, expected_table|
|
|
124
124
|
patiently do
|
|
125
125
|
document = Nokogiri::HTML(page.body)
|
|
126
126
|
tables = document.xpath('//table').collect { |table| table.xpath('.//tr').collect { |row| row.xpath('.//th|td') } }
|
data/lib/spreewald/web_steps.rb
CHANGED
|
@@ -44,7 +44,7 @@ require 'cgi'
|
|
|
44
44
|
# Example:
|
|
45
45
|
#
|
|
46
46
|
# Then I should see "some text" within ".page_body"
|
|
47
|
-
When
|
|
47
|
+
When(/^(.*) within (.*[^:])$/) do |nested_step, parent|
|
|
48
48
|
selector = _selector_for(parent)
|
|
49
49
|
if selector.is_a?(String) || selector.is_a?(Array) # could also be a Capybara::Node::Element
|
|
50
50
|
patiently do
|
|
@@ -58,21 +58,21 @@ When /^(.*) within (.*[^:])$/ do |nested_step, parent|
|
|
|
58
58
|
end.overridable(:priority => -1)
|
|
59
59
|
|
|
60
60
|
# nodoc
|
|
61
|
-
When
|
|
61
|
+
When(/^(.*) within (.*[^:]):$/) do |nested_step, parent, table_or_string|
|
|
62
62
|
patiently do
|
|
63
63
|
with_scope(parent) { step("#{nested_step}:", table_or_string) }
|
|
64
64
|
end
|
|
65
65
|
end.overridable(:priority => -1)
|
|
66
66
|
|
|
67
|
-
Given
|
|
67
|
+
Given(/^(?:|I )am on (.+)$/) do |page_name|
|
|
68
68
|
visit _path_to(page_name)
|
|
69
69
|
end.overridable
|
|
70
70
|
|
|
71
|
-
When
|
|
71
|
+
When(/^(?:|I )go to (.+)$/) do |page_name|
|
|
72
72
|
visit _path_to(page_name)
|
|
73
73
|
end.overridable
|
|
74
74
|
|
|
75
|
-
Then
|
|
75
|
+
Then(/^(?:|I )should be on (.+)$/) do |page_name|
|
|
76
76
|
patiently do
|
|
77
77
|
fragment = URI.parse(current_url).fragment
|
|
78
78
|
fragment.sub!(/[#?].*/, '') if fragment # most js frameworks will usually use ? and # for params, we dont care about those
|
|
@@ -88,20 +88,20 @@ Then /^(?:|I )should be on (.+)$/ do |page_name|
|
|
|
88
88
|
end
|
|
89
89
|
end.overridable
|
|
90
90
|
|
|
91
|
-
When
|
|
91
|
+
When(/^(?:|I )press "([^"]*)"$/) do |button|
|
|
92
92
|
patiently do
|
|
93
93
|
click_button(button)
|
|
94
94
|
end
|
|
95
95
|
end.overridable
|
|
96
96
|
|
|
97
|
-
When
|
|
97
|
+
When(/^(?:|I )follow "([^"]*)"$/) do |link|
|
|
98
98
|
patiently do
|
|
99
99
|
click_link(link)
|
|
100
100
|
end
|
|
101
101
|
end.overridable
|
|
102
102
|
|
|
103
103
|
# Fill in text field
|
|
104
|
-
When
|
|
104
|
+
When(/^(?:|I )fill in "([^"]*)" (?:with|for) "([^"]*)"$/) do |field, value|
|
|
105
105
|
patiently do
|
|
106
106
|
fill_in(field, :with => value)
|
|
107
107
|
end
|
|
@@ -118,49 +118,49 @@ end.overridable
|
|
|
118
118
|
# Banana
|
|
119
119
|
# Pear
|
|
120
120
|
# """
|
|
121
|
-
When
|
|
121
|
+
When(/^(?:|I )fill in "([^"]*)" (?:with|for):$/) do |field, value|
|
|
122
122
|
patiently do
|
|
123
123
|
fill_in(field, :with => value)
|
|
124
124
|
end
|
|
125
125
|
end.overridable
|
|
126
126
|
|
|
127
127
|
# Fill in text field
|
|
128
|
-
When
|
|
128
|
+
When(/^(?:|I )fill in "([^"]*)" (?:with|for) '(.*)'$/) do |field, value|
|
|
129
129
|
patiently do
|
|
130
130
|
fill_in(field, :with => value)
|
|
131
131
|
end
|
|
132
132
|
end.overridable
|
|
133
133
|
|
|
134
134
|
# Select from select box
|
|
135
|
-
When
|
|
135
|
+
When(/^(?:|I )select "([^"]*)" from "([^"]*)"$/) do |value, field|
|
|
136
136
|
patiently do
|
|
137
137
|
select(value, :from => field)
|
|
138
138
|
end
|
|
139
139
|
end.overridable
|
|
140
140
|
|
|
141
141
|
# Check a checkbox
|
|
142
|
-
When
|
|
142
|
+
When(/^(?:|I )check "([^"]*)"$/) do |field|
|
|
143
143
|
patiently do
|
|
144
144
|
check(field, allow_label_click: true)
|
|
145
145
|
end
|
|
146
146
|
end.overridable
|
|
147
147
|
|
|
148
148
|
# Uncheck a checkbox
|
|
149
|
-
When
|
|
149
|
+
When(/^(?:|I )uncheck "([^"]*)"$/) do |field|
|
|
150
150
|
patiently do
|
|
151
151
|
uncheck(field, allow_label_click: true)
|
|
152
152
|
end
|
|
153
153
|
end.overridable
|
|
154
154
|
|
|
155
155
|
# Select a radio button
|
|
156
|
-
When
|
|
156
|
+
When(/^(?:|I )choose "([^"]*)"$/) do |field|
|
|
157
157
|
patiently do
|
|
158
158
|
choose(field)
|
|
159
159
|
end
|
|
160
160
|
end.overridable
|
|
161
161
|
|
|
162
162
|
# Attach a file to a file upload form field
|
|
163
|
-
When
|
|
163
|
+
When(/^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/) do |path, field|
|
|
164
164
|
options = {}
|
|
165
165
|
options[:make_visible] = true if javascript_capable?
|
|
166
166
|
|
|
@@ -188,7 +188,7 @@ end.overridable
|
|
|
188
188
|
# Checks that some text appears on the page
|
|
189
189
|
#
|
|
190
190
|
# Note that this does not detect if the text might be hidden via CSS
|
|
191
|
-
Then
|
|
191
|
+
Then(/^(?:|I )should( not)? see "([^"]*)"$/) do |negate, text|
|
|
192
192
|
expectation = negate ? :not_to : :to
|
|
193
193
|
|
|
194
194
|
patiently do
|
|
@@ -199,7 +199,7 @@ end.overridable
|
|
|
199
199
|
# Checks that a regexp appears on the page
|
|
200
200
|
#
|
|
201
201
|
# Note that this does not detect if the text might be hidden via CSS
|
|
202
|
-
Then
|
|
202
|
+
Then(/^(?:|I )should( not)? see \/(.*)\/$/) do |negate, regexp|
|
|
203
203
|
expectation = negate ? :not_to : :to
|
|
204
204
|
regexp = Regexp.new(regexp)
|
|
205
205
|
|
|
@@ -209,7 +209,7 @@ Then /^(?:|I )should( not)? see \/(.*)\/$/ do |negate, regexp|
|
|
|
209
209
|
end.overridable
|
|
210
210
|
|
|
211
211
|
# Checks for the existance of an input field (given its id or label)
|
|
212
|
-
Then
|
|
212
|
+
Then(/^I should( not)? see a field "([^"]*)"$/) do |negate, name|
|
|
213
213
|
if negate
|
|
214
214
|
expect(page).to have_no_field(name)
|
|
215
215
|
else
|
|
@@ -224,7 +224,7 @@ end.overridable
|
|
|
224
224
|
# Checks for an unexpected minus sign, correct decimal places etc.
|
|
225
225
|
#
|
|
226
226
|
# See [here](https://makandracards.com/makandra/1225-test-that-a-number-or-money-amount-is-shown-with-cucumber) for details
|
|
227
|
-
Then
|
|
227
|
+
Then(/^I should( not)? see the (?:number|amount) ([\-\d,\.]+)(?: (.*?))?$/) do |negate, amount, unit|
|
|
228
228
|
expect_to_match = negate ? :not_to : :to
|
|
229
229
|
is_negative = amount.start_with?('-')
|
|
230
230
|
absolute_amount = amount.gsub(/^-/, '')
|
|
@@ -246,7 +246,7 @@ end.overridable(priority: -5) # priority lower than within
|
|
|
246
246
|
|
|
247
247
|
# Like `Then I should see`, but with single instead of double quotes. In case
|
|
248
248
|
# the expected string contains quotes as well.
|
|
249
|
-
Then
|
|
249
|
+
Then(/^(?:|I )should( not)? see '([^']*)'$/) do |negate, text|
|
|
250
250
|
expectation = negate ? :not_to : :to
|
|
251
251
|
|
|
252
252
|
patiently do
|
|
@@ -255,7 +255,7 @@ Then /^(?:|I )should( not)? see '([^']*)'$/ do |negate, text|
|
|
|
255
255
|
end.overridable
|
|
256
256
|
|
|
257
257
|
# Check that the raw HTML contains a string
|
|
258
|
-
Then
|
|
258
|
+
Then(/^I should( not)? see "([^\"]*)" in the HTML$/) do |negate, text|
|
|
259
259
|
expectation = negate ? :not_to : :to
|
|
260
260
|
|
|
261
261
|
patiently do
|
|
@@ -264,7 +264,7 @@ Then /^I should( not)? see "([^\"]*)" in the HTML$/ do |negate, text|
|
|
|
264
264
|
end.overridable
|
|
265
265
|
|
|
266
266
|
# Checks that status code is 400..599
|
|
267
|
-
Then
|
|
267
|
+
Then(/^I should see an error$/) do
|
|
268
268
|
expect((400 .. 599)).to include(page.status_code)
|
|
269
269
|
end.overridable
|
|
270
270
|
|
|
@@ -276,7 +276,7 @@ end.overridable
|
|
|
276
276
|
# Then I should see the element ".panel"
|
|
277
277
|
# Then I should not see an element ".sidebar"
|
|
278
278
|
# Then I should not see the element ".sidebar"
|
|
279
|
-
Then
|
|
279
|
+
Then(/^I should( not)? see (?:an|the) element "([^"]+)"$/) do |negate, selector|
|
|
280
280
|
expectation = negate ? :not_to : :to
|
|
281
281
|
patiently do
|
|
282
282
|
expect(page).send(expectation, have_css(selector))
|
|
@@ -291,7 +291,7 @@ end.overridable
|
|
|
291
291
|
# Then I should see the element for the panel
|
|
292
292
|
# Then I should not see an element for the sidebar
|
|
293
293
|
# Then I should not see the element for the sidebar
|
|
294
|
-
Then
|
|
294
|
+
Then(/^I should( not)? see (?:an|the) element for (.*?)$/) do |negate, locator|
|
|
295
295
|
expectation = negate ? :not_to : :to
|
|
296
296
|
selector = _selector_for(locator)
|
|
297
297
|
patiently do
|
|
@@ -309,7 +309,7 @@ end.overridable(:priority => -5) # priority must be lower than the "within" step
|
|
|
309
309
|
# | Augsburg |
|
|
310
310
|
# | Berlin |
|
|
311
311
|
# | Beta Group |
|
|
312
|
-
Then
|
|
312
|
+
Then(/^I should see in this order:?$/) do |text|
|
|
313
313
|
if text.is_a?(String)
|
|
314
314
|
lines = text.split(/\n/)
|
|
315
315
|
else
|
|
@@ -324,14 +324,14 @@ Then /^I should see in this order:?$/ do |text|
|
|
|
324
324
|
end.overridable
|
|
325
325
|
|
|
326
326
|
# Checks that the page contains a link with a given text or title attribute.
|
|
327
|
-
Then
|
|
327
|
+
Then(/^I should( not)? see a link labeled "([^"]*)"$/) do |negate, label|
|
|
328
328
|
expectation = negate ? :not_to : :to
|
|
329
329
|
link = page.first('a', :text => label, minimum: 0) || page.first(%(a[title="#{label}"]), minimum: 0)
|
|
330
330
|
expect(link).send(expectation, be_present)
|
|
331
331
|
end.overridable
|
|
332
332
|
|
|
333
333
|
# Checks that an input field contains some value (allowing * as wildcard character)
|
|
334
|
-
Then
|
|
334
|
+
Then(/^the "([^"]*)" field should( not)? contain "([^"]*)"$/) do |label, negate, expected_string|
|
|
335
335
|
patiently do
|
|
336
336
|
field = find_with_disabled(:field, label)
|
|
337
337
|
field_value = case field.tag_name
|
|
@@ -365,7 +365,7 @@ end.overridable
|
|
|
365
365
|
# Then I should see a form with the following values:
|
|
366
366
|
# | E-mail | foo@bar.com |
|
|
367
367
|
# | Role | Administrator |
|
|
368
|
-
Then
|
|
368
|
+
Then(/^I should see a form with the following values:$/) do |table|
|
|
369
369
|
expectations = table.raw
|
|
370
370
|
expectations.each do |label, expected_value|
|
|
371
371
|
step %(the "#{label}" field should contain "#{expected_value}")
|
|
@@ -373,7 +373,7 @@ Then /^I should see a form with the following values:$/ do |table|
|
|
|
373
373
|
end.overridable
|
|
374
374
|
|
|
375
375
|
# Checks that an input field was wrapped with a validation error
|
|
376
|
-
Then
|
|
376
|
+
Then(/^the "([^"]*)" field should have the error "([^"]*)"$/) do |field, error_message|
|
|
377
377
|
patiently do
|
|
378
378
|
element = find_with_disabled(:field, field)
|
|
379
379
|
field_error_finder = Spreewald::FieldErrorFinder.new(page, element)
|
|
@@ -404,7 +404,7 @@ Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_me
|
|
|
404
404
|
end
|
|
405
405
|
end.overridable
|
|
406
406
|
|
|
407
|
-
Then
|
|
407
|
+
Then(/^the "([^\"]*)" field should( not)? have an error$/) do |label, negate|
|
|
408
408
|
patiently do
|
|
409
409
|
expectation = negate ? :not_to : :to
|
|
410
410
|
element = find_with_disabled(:field, label)
|
|
@@ -414,7 +414,7 @@ Then /^the "([^\"]*)" field should( not)? have an error$/ do |label, negate|
|
|
|
414
414
|
end
|
|
415
415
|
end.overridable
|
|
416
416
|
|
|
417
|
-
Then
|
|
417
|
+
Then(/^the "([^"]*)" checkbox should( not)? be checked?$/) do |label, negate|
|
|
418
418
|
expectation = negate ? :not_to : :to
|
|
419
419
|
|
|
420
420
|
patiently do
|
|
@@ -423,7 +423,7 @@ Then /^the "([^"]*)" checkbox should( not)? be checked?$/ do |label, negate|
|
|
|
423
423
|
end
|
|
424
424
|
end.overridable
|
|
425
425
|
|
|
426
|
-
Then
|
|
426
|
+
Then(/^the radio button "([^"]*)" should( not)? be (?:checked|selected)$/) do |field, negate|
|
|
427
427
|
patiently do
|
|
428
428
|
expect(page.send((negate ? :has_no_checked_field? : :has_checked_field?), field)).to eq(true)
|
|
429
429
|
end
|
|
@@ -436,7 +436,7 @@ end.overridable
|
|
|
436
436
|
# | currency_code | EUR |
|
|
437
437
|
#
|
|
438
438
|
# Succeeds when the URL contains the given `locale` and `currency_code` params
|
|
439
|
-
Then
|
|
439
|
+
Then(/^(?:|I )should have the following query string:$/) do |expected_pairs|
|
|
440
440
|
patiently do
|
|
441
441
|
query = URI.parse(current_url).query
|
|
442
442
|
actual_params = query ? CGI.parse(query) : {}
|
|
@@ -448,7 +448,7 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
|
|
448
448
|
end.overridable
|
|
449
449
|
|
|
450
450
|
# Open the current Capybara page using the `launchy` or `capybara_screenshot` gem
|
|
451
|
-
Then
|
|
451
|
+
Then(/^show me the page$/) do
|
|
452
452
|
if defined? Capybara::Screenshot
|
|
453
453
|
screenshot_and_save_page
|
|
454
454
|
elsif defined? Launchy
|
|
@@ -460,14 +460,14 @@ end.overridable
|
|
|
460
460
|
|
|
461
461
|
|
|
462
462
|
# Checks `Content-Type` HTTP header
|
|
463
|
-
Then
|
|
463
|
+
Then(/^I should get a response with content-type "([^\"]*)"$/) do |expected_content_type|
|
|
464
464
|
expect(page.response_headers['Content-Type']).to match /\A#{Regexp.quote(expected_content_type)}($|;)/
|
|
465
465
|
end.overridable
|
|
466
466
|
|
|
467
467
|
# Checks `Content-Disposition` HTTP header
|
|
468
468
|
#
|
|
469
469
|
# Attention: Doesn't work with Selenium, see https://github.com/jnicklas/capybara#gotchas
|
|
470
|
-
Then
|
|
470
|
+
Then(/^I should get a download with filename "([^\"]*)"$/) do |filename|
|
|
471
471
|
content_disposition = page.response_headers['Content-Disposition']
|
|
472
472
|
expect(content_disposition).to be_present
|
|
473
473
|
|
|
@@ -483,11 +483,11 @@ Then /^I should get a download with filename "([^\"]*)"$/ do |filename|
|
|
|
483
483
|
end.overridable
|
|
484
484
|
|
|
485
485
|
# Checks that a certain option is selected for a text field
|
|
486
|
-
Then
|
|
486
|
+
Then(/^"([^"]*)" should( not)? be selected for "([^"]*)"$/) do |value, invert, field|
|
|
487
487
|
step %(the "#{field}" field should#{invert} contain "#{value}")
|
|
488
488
|
end.overridable
|
|
489
489
|
|
|
490
|
-
Then
|
|
490
|
+
Then(/^nothing should be selected for "([^"]*)"$/) do |field|
|
|
491
491
|
patiently do
|
|
492
492
|
select = find_with_disabled(:field, field)
|
|
493
493
|
begin
|
|
@@ -500,7 +500,7 @@ Then /^nothing should be selected for "([^"]*)"$/ do |field|
|
|
|
500
500
|
end.overridable
|
|
501
501
|
|
|
502
502
|
# Checks for the presence of an option in a select
|
|
503
|
-
Then
|
|
503
|
+
Then(/^"([^"]*)" should( not)? be an option for "([^"]*)"$/) do |value, negate, field|
|
|
504
504
|
finder_arguments = if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.12")
|
|
505
505
|
{ text: value }
|
|
506
506
|
else
|
|
@@ -518,7 +518,7 @@ Then /^"([^"]*)" should( not)? be an option for "([^"]*)"$/ do |value, negate, f
|
|
|
518
518
|
end
|
|
519
519
|
end.overridable
|
|
520
520
|
|
|
521
|
-
Then
|
|
521
|
+
Then(/^the window should be titled "([^"]*)"$/) do |title|
|
|
522
522
|
patiently do
|
|
523
523
|
if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
|
|
524
524
|
expect(page).to have_selector("title", :content => title)
|
|
@@ -528,7 +528,7 @@ Then /^the window should be titled "([^"]*)"$/ do |title|
|
|
|
528
528
|
end
|
|
529
529
|
end.overridable
|
|
530
530
|
|
|
531
|
-
When
|
|
531
|
+
When(/^I reload the page$/) do
|
|
532
532
|
if javascript_capable?
|
|
533
533
|
page.execute_script(<<-JAVASCRIPT)
|
|
534
534
|
window.location.reload(true);
|
|
@@ -543,7 +543,7 @@ end.overridable
|
|
|
543
543
|
# In a non-selenium test, we only check for `.hidden`, `.invisible` or `style: display:none`
|
|
544
544
|
#
|
|
545
545
|
# More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
|
|
546
|
-
Then
|
|
546
|
+
Then(/^(the tag )?"([^\"]+)" should be visible$/) do |tag, selector_or_text|
|
|
547
547
|
options = {}
|
|
548
548
|
tag ? options.store(:selector, selector_or_text) : options.store(:text, selector_or_text)
|
|
549
549
|
|
|
@@ -553,7 +553,7 @@ end.overridable
|
|
|
553
553
|
# Checks that an element is actually present and hidden, also considering styles.
|
|
554
554
|
# Within a selenium test, the browser is asked whether the element is really hidden.
|
|
555
555
|
# In a non-selenium test, we only check for `.hidden`, `.invisible` or `style: display:none`
|
|
556
|
-
Then
|
|
556
|
+
Then(/^(the tag )?"([^\"]+)" should be hidden$/) do |tag, selector_or_text|
|
|
557
557
|
options = {}
|
|
558
558
|
tag ? options.store(:selector, selector_or_text) : options.store(:text, selector_or_text)
|
|
559
559
|
|
|
@@ -566,7 +566,7 @@ end.overridable
|
|
|
566
566
|
#
|
|
567
567
|
# When I click on "Collapse"
|
|
568
568
|
#
|
|
569
|
-
When
|
|
569
|
+
When(/^I click on "([^\"]+)"$/) do |text|
|
|
570
570
|
patiently do
|
|
571
571
|
contains_text = %{contains(., \"#{text}\")}
|
|
572
572
|
# find the innermost selector that matches
|
|
@@ -581,7 +581,7 @@ end.overridable
|
|
|
581
581
|
#
|
|
582
582
|
# When I click on the element ".sidebar"
|
|
583
583
|
#
|
|
584
|
-
When
|
|
584
|
+
When(/^I click on the element "([^"]+)"$/) do |selector|
|
|
585
585
|
patiently do
|
|
586
586
|
page.find(selector).click
|
|
587
587
|
end
|
|
@@ -592,7 +592,7 @@ end.overridable
|
|
|
592
592
|
# Example:
|
|
593
593
|
#
|
|
594
594
|
# When I click on the element for the sidebar
|
|
595
|
-
When
|
|
595
|
+
When(/^I click on the element for (.+?)$/) do |locator|
|
|
596
596
|
patiently do
|
|
597
597
|
selector = _selector_for(locator)
|
|
598
598
|
args, kwargs = deconstruct_selector(selector)
|
|
@@ -609,7 +609,7 @@ end.overridable(priority: -5) # priority lower than within
|
|
|
609
609
|
# Don't forget the trailing slash. Otherwise you'll get the error
|
|
610
610
|
# expected: /http:\/\/makandra.com(\?[^\/]*)?$/
|
|
611
611
|
# got: "http://makandra.com/" (using =~)
|
|
612
|
-
Then
|
|
612
|
+
Then(/^"([^"]*)" should link to "([^"]*)"$/) do |link_label, target|
|
|
613
613
|
patiently do
|
|
614
614
|
link = find_link(link_label)
|
|
615
615
|
expect(link[:href]).to match(/#{Regexp.escape target}(\?[^\/]*)?$/) # ignore trailing timestamps
|
|
@@ -622,17 +622,17 @@ end.overridable
|
|
|
622
622
|
# Example:
|
|
623
623
|
#
|
|
624
624
|
# When I follow "Read more" inside any ".text_snippet"
|
|
625
|
-
When
|
|
625
|
+
When(/^I follow "([^"]*)" inside any "([^"]*)"$/) do |label, selector|
|
|
626
626
|
node = find("#{selector} a", :text => label)
|
|
627
627
|
node.click
|
|
628
628
|
end.overridable
|
|
629
629
|
|
|
630
|
-
Then
|
|
630
|
+
Then(/^I should( not)? see "([^"]*)" inside any "([^"]*)"$/) do |negate, text, selector|
|
|
631
631
|
expectation = negate ? :not_to : :to
|
|
632
632
|
expect(page).send(expectation, have_css(selector, :text => text))
|
|
633
633
|
end.overridable
|
|
634
634
|
|
|
635
|
-
When
|
|
635
|
+
When(/^I fill in "([^"]*)" with "([^"]*)" inside any "([^"]*)"$/) do |field, value, selector|
|
|
636
636
|
containers = all(:css, selector)
|
|
637
637
|
input = nil
|
|
638
638
|
containers.detect do |container|
|
|
@@ -647,19 +647,19 @@ When /^I fill in "([^"]*)" with "([^"]*)" inside any "([^"]*)"$/ do |field, valu
|
|
|
647
647
|
end
|
|
648
648
|
end.overridable
|
|
649
649
|
|
|
650
|
-
When
|
|
650
|
+
When(/^I confirm the browser dialog$/) do
|
|
651
651
|
patiently do
|
|
652
652
|
browser.switch_to.alert.accept
|
|
653
653
|
end
|
|
654
654
|
end.overridable
|
|
655
655
|
|
|
656
|
-
When
|
|
656
|
+
When(/^I cancel the browser dialog$/) do
|
|
657
657
|
patiently do
|
|
658
658
|
browser.switch_to.alert.dismiss
|
|
659
659
|
end
|
|
660
660
|
end.overridable
|
|
661
661
|
|
|
662
|
-
When
|
|
662
|
+
When(/^I enter "([^"]*)" into the browser dialog$/) do |text|
|
|
663
663
|
patiently do
|
|
664
664
|
alert = browser.switch_to.alert
|
|
665
665
|
alert.send_keys(text)
|
|
@@ -668,7 +668,7 @@ When /^I enter "([^"]*)" into the browser dialog$/ do |text|
|
|
|
668
668
|
end.overridable
|
|
669
669
|
|
|
670
670
|
# Tests that an input, button, checkbox or radio button with the given label is disabled.
|
|
671
|
-
Then
|
|
671
|
+
Then(/^the "([^\"]*)" (field|button|checkbox|radio button) should( not)? be disabled$/) do |label, kind, negate|
|
|
672
672
|
patiently do
|
|
673
673
|
element = if kind == 'button'
|
|
674
674
|
find_with_disabled(:button, label)
|
|
@@ -685,7 +685,7 @@ Then /^the "([^\"]*)" (field|button|checkbox|radio button) should( not)? be disa
|
|
|
685
685
|
end.overridable
|
|
686
686
|
|
|
687
687
|
# Tests that a field with the given label is visible.
|
|
688
|
-
Then
|
|
688
|
+
Then(/^the "([^\"]*)" field should( not)? be visible$/) do |label, hidden|
|
|
689
689
|
if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
|
|
690
690
|
field = find_with_disabled(:field, label)
|
|
691
691
|
else
|
|
@@ -706,7 +706,7 @@ end.overridable
|
|
|
706
706
|
# Performs HTTP basic authentication with the given credentials and visits the given path.
|
|
707
707
|
#
|
|
708
708
|
# More details [here](https://makandracards.com/makandra/971-perform-http-basic-authentication-in-cucumber).
|
|
709
|
-
When
|
|
709
|
+
When(/^I perform basic authentication as "([^\"]*)\/([^\"]*)" and go to (.*)$/) do |user, password, page_name|
|
|
710
710
|
path = _path_to(page_name)
|
|
711
711
|
if javascript_capable?
|
|
712
712
|
server = Capybara.current_session.server rescue Capybara.current_session.driver.rack_server
|
|
@@ -724,7 +724,7 @@ When /^I perform basic authentication as "([^\"]*)\/([^\"]*)" and go to (.*)$/ d
|
|
|
724
724
|
end.overridable
|
|
725
725
|
|
|
726
726
|
# Goes to the previously viewed page.
|
|
727
|
-
When
|
|
727
|
+
When(/^I go back$/) do
|
|
728
728
|
if javascript_capable?
|
|
729
729
|
page.execute_script('window.history.back()')
|
|
730
730
|
else
|
|
@@ -738,7 +738,7 @@ end.overridable
|
|
|
738
738
|
|
|
739
739
|
# Tests whether a select field is sorted. Uses Array#natural_sort, if defined;
|
|
740
740
|
# Array#sort else.
|
|
741
|
-
Then
|
|
741
|
+
Then(/^the "(.*?)" select should( not)? be sorted$/) do |label, negate|
|
|
742
742
|
select = find_with_disabled(:field, label)
|
|
743
743
|
options = select.all('option').reject { |o| o.value.blank? }
|
|
744
744
|
option_texts = options.collect(&:text)
|
|
@@ -12,8 +12,8 @@ describe Spreewald::Steps::FollowTheLink do
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
step =
|
|
16
|
-
expect
|
|
15
|
+
step = Spreewald::Steps::FollowTheLink.new(mail_without_links, "first")
|
|
16
|
+
expect { step.run }.to raise_error Spreewald::Steps::FollowTheLink::NoVisitableLinkFound
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it "finds links in multipart html email" do
|
|
@@ -6,6 +6,7 @@ gem 'sqlite3'
|
|
|
6
6
|
gem 'haml-rails'
|
|
7
7
|
gem 'gemika'
|
|
8
8
|
gem 'rexml'
|
|
9
|
+
gem 'cgi'
|
|
9
10
|
gem 'webrick'
|
|
10
11
|
|
|
11
12
|
group :development, :test do
|
|
@@ -17,7 +18,7 @@ group :test do
|
|
|
17
18
|
gem 'database_cleaner'
|
|
18
19
|
gem 'capybara', "~>3"
|
|
19
20
|
gem 'capybara-screenshot'
|
|
20
|
-
gem 'cucumber-rails', require: false
|
|
21
|
+
gem 'cucumber-rails', '>= 4', require: false
|
|
21
22
|
gem 'cucumber'
|
|
22
23
|
gem 'selenium-webdriver'
|
|
23
24
|
gem 'rspec-rails'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../..
|
|
3
3
|
specs:
|
|
4
|
-
spreewald (4.6.
|
|
4
|
+
spreewald (4.6.6)
|
|
5
5
|
capybara
|
|
6
6
|
cucumber
|
|
7
7
|
cucumber_priority (>= 0.3.0)
|
|
@@ -101,40 +101,41 @@ GEM
|
|
|
101
101
|
capybara-screenshot (1.0.26)
|
|
102
102
|
capybara (>= 1.0, < 4)
|
|
103
103
|
launchy
|
|
104
|
+
cgi (0.5.1)
|
|
104
105
|
childprocess (5.1.0)
|
|
105
106
|
logger (~> 1.5)
|
|
106
107
|
coderay (1.1.3)
|
|
107
108
|
concurrent-ruby (1.3.4)
|
|
108
109
|
connection_pool (2.4.1)
|
|
109
110
|
crass (1.0.6)
|
|
110
|
-
cucumber (
|
|
111
|
+
cucumber (10.2.0)
|
|
112
|
+
base64 (~> 0.2)
|
|
111
113
|
builder (~> 3.2)
|
|
112
|
-
cucumber-ci-environment (> 9, <
|
|
113
|
-
cucumber-core (>
|
|
114
|
-
cucumber-cucumber-expressions (
|
|
115
|
-
cucumber-
|
|
116
|
-
cucumber-html-formatter (> 20.3, < 22)
|
|
117
|
-
cucumber-messages (> 19, < 25)
|
|
114
|
+
cucumber-ci-environment (> 9, < 12)
|
|
115
|
+
cucumber-core (> 15, < 17)
|
|
116
|
+
cucumber-cucumber-expressions (> 17, < 20)
|
|
117
|
+
cucumber-html-formatter (> 21, < 23)
|
|
118
118
|
diff-lcs (~> 1.5)
|
|
119
|
+
logger (~> 1.6)
|
|
119
120
|
mini_mime (~> 1.1)
|
|
120
121
|
multi_test (~> 1.1)
|
|
121
|
-
sys-uname (~> 1.
|
|
122
|
+
sys-uname (~> 1.3)
|
|
122
123
|
cucumber-ci-environment (10.0.1)
|
|
123
|
-
cucumber-core (
|
|
124
|
-
cucumber-gherkin (
|
|
125
|
-
cucumber-messages (
|
|
126
|
-
cucumber-tag-expressions (>
|
|
124
|
+
cucumber-core (16.2.0)
|
|
125
|
+
cucumber-gherkin (> 36, < 40)
|
|
126
|
+
cucumber-messages (> 31, < 33)
|
|
127
|
+
cucumber-tag-expressions (> 6, < 9)
|
|
127
128
|
cucumber-cucumber-expressions (17.1.0)
|
|
128
129
|
bigdecimal
|
|
129
|
-
cucumber-gherkin (
|
|
130
|
-
cucumber-messages (>=
|
|
131
|
-
cucumber-html-formatter (
|
|
132
|
-
cucumber-messages (>
|
|
133
|
-
cucumber-messages (
|
|
134
|
-
cucumber-rails (
|
|
135
|
-
capybara (>= 3.
|
|
136
|
-
cucumber (>=
|
|
137
|
-
railties (>=
|
|
130
|
+
cucumber-gherkin (39.0.0)
|
|
131
|
+
cucumber-messages (>= 31, < 33)
|
|
132
|
+
cucumber-html-formatter (22.3.0)
|
|
133
|
+
cucumber-messages (> 23, < 33)
|
|
134
|
+
cucumber-messages (32.3.1)
|
|
135
|
+
cucumber-rails (4.0.1)
|
|
136
|
+
capybara (>= 3.25, < 4)
|
|
137
|
+
cucumber (>= 7, < 11)
|
|
138
|
+
railties (>= 6.1, < 9)
|
|
138
139
|
cucumber-tag-expressions (6.1.1)
|
|
139
140
|
cucumber_priority (1.1.0)
|
|
140
141
|
cucumber
|
|
@@ -182,10 +183,13 @@ GEM
|
|
|
182
183
|
net-smtp
|
|
183
184
|
marcel (1.0.4)
|
|
184
185
|
matrix (0.4.2)
|
|
186
|
+
memoist3 (1.0.0)
|
|
185
187
|
method_source (1.1.0)
|
|
186
188
|
mini_mime (1.1.5)
|
|
187
189
|
mini_portile2 (2.8.9)
|
|
188
|
-
minitest (
|
|
190
|
+
minitest (6.0.6)
|
|
191
|
+
drb (~> 2.0)
|
|
192
|
+
prism (~> 1.5)
|
|
189
193
|
multi_test (1.1.0)
|
|
190
194
|
net-imap (0.5.1)
|
|
191
195
|
date
|
|
@@ -202,6 +206,7 @@ GEM
|
|
|
202
206
|
racc (~> 1.4)
|
|
203
207
|
nokogiri (1.17.2-x86_64-linux)
|
|
204
208
|
racc (~> 1.4)
|
|
209
|
+
prism (1.9.0)
|
|
205
210
|
pry (0.15.0)
|
|
206
211
|
coderay (~> 1.1)
|
|
207
212
|
method_source (~> 1.0)
|
|
@@ -286,8 +291,9 @@ GEM
|
|
|
286
291
|
mini_portile2 (~> 2.8.0)
|
|
287
292
|
sqlite3 (2.4.1-x86_64-linux-gnu)
|
|
288
293
|
stringio (3.1.2)
|
|
289
|
-
sys-uname (1.
|
|
294
|
+
sys-uname (1.5.1)
|
|
290
295
|
ffi (~> 1.1)
|
|
296
|
+
memoist3 (~> 1.0.0)
|
|
291
297
|
temple (0.10.3)
|
|
292
298
|
thor (1.3.2)
|
|
293
299
|
tilt (2.4.0)
|
|
@@ -312,8 +318,9 @@ DEPENDENCIES
|
|
|
312
318
|
byebug
|
|
313
319
|
capybara (~> 3)
|
|
314
320
|
capybara-screenshot
|
|
321
|
+
cgi
|
|
315
322
|
cucumber
|
|
316
|
-
cucumber-rails
|
|
323
|
+
cucumber-rails (>= 4)
|
|
317
324
|
database_cleaner
|
|
318
325
|
gemika
|
|
319
326
|
haml-rails
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spreewald
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.6.
|
|
4
|
+
version: 4.6.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tobias Kraze
|
|
@@ -95,12 +95,14 @@ files:
|
|
|
95
95
|
- CHANGELOG.md
|
|
96
96
|
- Gemfile
|
|
97
97
|
- Gemfile.lock
|
|
98
|
-
- Gemfile.
|
|
99
|
-
- Gemfile.
|
|
100
|
-
- Gemfile.
|
|
101
|
-
- Gemfile.
|
|
102
|
-
- Gemfile.
|
|
103
|
-
- Gemfile.
|
|
98
|
+
- Gemfile.ruby_3_2
|
|
99
|
+
- Gemfile.ruby_3_2.lock
|
|
100
|
+
- Gemfile.ruby_3_3
|
|
101
|
+
- Gemfile.ruby_3_3.lock
|
|
102
|
+
- Gemfile.ruby_3_4
|
|
103
|
+
- Gemfile.ruby_3_4.lock
|
|
104
|
+
- Gemfile.ruby_4_0
|
|
105
|
+
- Gemfile.ruby_4_0.lock
|
|
104
106
|
- LICENSE
|
|
105
107
|
- README.md
|
|
106
108
|
- Rakefile
|
|
@@ -381,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
381
383
|
- !ruby/object:Gem::Version
|
|
382
384
|
version: '0'
|
|
383
385
|
requirements: []
|
|
384
|
-
rubygems_version:
|
|
386
|
+
rubygems_version: 4.0.6
|
|
385
387
|
specification_version: 4
|
|
386
388
|
summary: Collection of useful cucumber steps.
|
|
387
389
|
test_files:
|