dkdeploy-cucumber 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rubocop.yml +18 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTORS.md +16 -0
- data/Gemfile +4 -0
- data/LICENSE +7 -0
- data/README.md +57 -0
- data/Rakefile +1 -0
- data/assets/dkdeploy-logo.png +0 -0
- data/config/cucumber.yml +4 -0
- data/dkdeploy-cucumber.gemspec +35 -0
- data/features/click.feature +52 -0
- data/features/content.feature +95 -0
- data/features/form.feature +136 -0
- data/features/htdocs/click.html +18 -0
- data/features/htdocs/click1.html +20 -0
- data/features/htdocs/click2.html +10 -0
- data/features/htdocs/content.html +17 -0
- data/features/htdocs/content.json +3 -0
- data/features/htdocs/form.html +26 -0
- data/features/htdocs/misc.html +13 -0
- data/features/htdocs/url.html +10 -0
- data/features/misc.feature +18 -0
- data/features/support/env.rb +35 -0
- data/features/url.feature +28 -0
- data/lib/dkdeploy/cucumber.rb +1 -0
- data/lib/dkdeploy/cucumber/step_definitions/click_steps.rb +39 -0
- data/lib/dkdeploy/cucumber/step_definitions/content_steps.rb +88 -0
- data/lib/dkdeploy/cucumber/step_definitions/form_steps.rb +146 -0
- data/lib/dkdeploy/cucumber/step_definitions/images.rb +11 -0
- data/lib/dkdeploy/cucumber/step_definitions/misc_steps.rb +105 -0
- data/lib/dkdeploy/cucumber/step_definitions/url_steps.rb +31 -0
- data/lib/dkdeploy/cucumber/steps.rb +2 -0
- data/lib/dkdeploy/cucumber/support.rb +3 -0
- data/lib/dkdeploy/cucumber/support/path.rb +13 -0
- data/lib/dkdeploy/cucumber/support/selectors.rb +15 -0
- data/lib/dkdeploy/cucumber/support/with.rb +9 -0
- data/lib/dkdeploy/cucumber/version.rb +15 -0
- metadata +257 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head lang="en">
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>Empty html</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<p id="tochange"></p>
|
9
|
+
<p id="tochange2"></p>
|
10
|
+
<button id="b1" onclick="document.getElementById('tochange').textContent='changed'">click</button>
|
11
|
+
<div id="scope">
|
12
|
+
<button id="b2" onclick="document.getElementById('tochange2').textContent='changed2'">click</button>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<p id="tochange3"></p>
|
16
|
+
<p id="clickelement" onclick="document.getElementById('tochange3').textContent='changed3'">clickable</p>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head lang="en">
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>Empty html</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<a href="click2.html" id="link">test</a>
|
9
|
+
<p>link1</p>
|
10
|
+
|
11
|
+
<ul>
|
12
|
+
<li>
|
13
|
+
<p>text</p>
|
14
|
+
</li>
|
15
|
+
<li>
|
16
|
+
<a href="click2.html">other</a>
|
17
|
+
</li>
|
18
|
+
</ul>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head lang="en">
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>Empty html</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<p>something</p>
|
9
|
+
<p id="date">23.03.1718</p>
|
10
|
+
<p id="falsedate">234.93.1718</p>
|
11
|
+
|
12
|
+
<p id="p1"></p>
|
13
|
+
<p id="p2" style="display:none"></p>
|
14
|
+
<p id="p3">before</p>
|
15
|
+
<p id="hover" onmouseover="document.getElementById('p3').textContent='after'">hover</p>
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head lang="en">
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>Empty html</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<form id="f1" action="form.html" method="GET">
|
9
|
+
<input id="developer" type="text" name="developer" value="Timo"/>
|
10
|
+
<input id="manager" type="text" name="manager" value="Alex"/>
|
11
|
+
<select name="selection">
|
12
|
+
<option value="value1">Value 1</option>
|
13
|
+
<option value="value2" selected>Value 2</option>
|
14
|
+
<option value="value3">Value 3</option>
|
15
|
+
</select>
|
16
|
+
<input type="checkbox" name="validation" value="validation"/>
|
17
|
+
|
18
|
+
<input id="radio1" type="radio" name="group" value="radio1"/>
|
19
|
+
<input id="radio2" type="radio" name="group" value="radio2"/>
|
20
|
+
|
21
|
+
<input id="file1" type="file" name="file1" value=""/>
|
22
|
+
|
23
|
+
<input id="blurer" type="text" onblur="this.value='after'" value="before"/>
|
24
|
+
</form>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head lang="en">
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>Empty html</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<p id="p1">before</p>
|
9
|
+
<button id="b1" onclick="setTimeout(function(){document.getElementById('p1').textContent = 'after';},3000)">Try it</button>
|
10
|
+
<p id="p2">before</p>
|
11
|
+
<button id="b2" onclick="setTimeout(function(){document.getElementById('p2').textContent = 'after';},5000)">Try it</button>
|
12
|
+
</body>
|
13
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Content Checks
|
2
|
+
Background:
|
3
|
+
Given I am on "misc.html"
|
4
|
+
|
5
|
+
Scenario: timer
|
6
|
+
Then I should see "before" within "#p1"
|
7
|
+
Then I press "b1"
|
8
|
+
Then I wait for 1 second
|
9
|
+
Then I should see "before" within "#p1"
|
10
|
+
Then I wait for 3 second
|
11
|
+
Then I should see "after" within "#p1"
|
12
|
+
|
13
|
+
@should_fail
|
14
|
+
Scenario: timer fail
|
15
|
+
Then I should see "before" within "#p2"
|
16
|
+
Then I press "b2"
|
17
|
+
Then I wait for 1 second
|
18
|
+
Then I should see "after" within "#p2"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Capybara configuration (using phantomjs)
|
2
|
+
|
3
|
+
require 'capybara/cucumber'
|
4
|
+
require 'phantomjs'
|
5
|
+
require 'capybara/poltergeist'
|
6
|
+
require 'rspec/expectations'
|
7
|
+
|
8
|
+
require 'dkdeploy/cucumber/steps'
|
9
|
+
require 'dkdeploy/cucumber/support'
|
10
|
+
|
11
|
+
Capybara.register_driver :poltergeist do |app|
|
12
|
+
Capybara::Poltergeist::Driver.new(app, phantomjs: Phantomjs.path)
|
13
|
+
end
|
14
|
+
Capybara.default_driver = :poltergeist
|
15
|
+
Capybara.javascript_driver = :poltergeist
|
16
|
+
Capybara.default_selector = :css
|
17
|
+
|
18
|
+
Capybara.app = Rack::Directory.new File.expand_path('../../htdocs', __FILE__)
|
19
|
+
|
20
|
+
# register Capybara
|
21
|
+
World(Capybara)
|
22
|
+
|
23
|
+
# Workaround for Poltergeist
|
24
|
+
#
|
25
|
+
# needs to be deleted when headless browser engine is switched out
|
26
|
+
#
|
27
|
+
# Workaround for a bug, in newer poltergeist versions
|
28
|
+
# see https://github.com/teampoltergeist/poltergeist/issues/754
|
29
|
+
# Page object (capybara session) is fine except for status_code always returning nil when we have multiple
|
30
|
+
# successful page loads in one cucumber run
|
31
|
+
# Return value of page.visit is always {"state":'success'}
|
32
|
+
# Although it has been observed that the status_code is returned properly on a 404 error, this work-around is just to be sure
|
33
|
+
Before do
|
34
|
+
page.driver.clear_memory_cache
|
35
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Feature: URLs
|
2
|
+
|
3
|
+
Scenario: I am on existing page
|
4
|
+
Given I am on "url.html"
|
5
|
+
Then I should be on "/url.html"
|
6
|
+
|
7
|
+
@should_fail
|
8
|
+
Scenario: I should be on fail
|
9
|
+
Given I am on "url.html"
|
10
|
+
Then I should be on "/url2.html"
|
11
|
+
|
12
|
+
@should_fail
|
13
|
+
Scenario: I am on fail
|
14
|
+
Given I am on "not_exists.html"
|
15
|
+
|
16
|
+
Scenario: Query String
|
17
|
+
Given I am on "url.html?test=abbrev&again=abnormally"
|
18
|
+
Then I should be on "/url.html"
|
19
|
+
Then I should have the following query string:
|
20
|
+
| test | abbrev |
|
21
|
+
| again | abnormally |
|
22
|
+
|
23
|
+
@should_fail
|
24
|
+
Scenario: Query String fail
|
25
|
+
Given I am on "url.html?test=abbrev&again=abnormally"
|
26
|
+
Then I should have the following query string:
|
27
|
+
| test | abbrev3 |
|
28
|
+
| again | abnormally3 |
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'dkdeploy/cucumber/version'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Click button.
|
2
|
+
#
|
3
|
+
# @yieldparam button [String] Name of button. Relative to selector.
|
4
|
+
# @yieldparam selector [String] Define scope per css selector.
|
5
|
+
When(/^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/) do |button, selector|
|
6
|
+
with_scope(selector) do
|
7
|
+
click_button(button)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Click link.
|
12
|
+
#
|
13
|
+
# @yieldparam button [String] Name of link. Relative to selector.
|
14
|
+
# @yieldparam selector [String] Define scope per css selector.
|
15
|
+
When(/^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/) do |link, selector|
|
16
|
+
with_scope(selector) do
|
17
|
+
click_link(link)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Click xpath.
|
22
|
+
#
|
23
|
+
# @yieldparam xpath [String] xpath to link. Relative to selector.
|
24
|
+
# @yieldparam selector [String] Define scope per css selector.
|
25
|
+
When(/^(?:|I )click xpath "([^"]*)"(?: within "([^"]*)")?$/) do |xpath, selector|
|
26
|
+
with_scope(selector) do
|
27
|
+
find(:xpath, xpath).click
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Click element.
|
32
|
+
#
|
33
|
+
# @yieldparam element [String] Css selector for element.
|
34
|
+
# @yieldparam selector [String] Define scope per css selector.
|
35
|
+
When(/^I click on element "([^"]*)"(?: within "([^"]*)")?$/) do |element, selector|
|
36
|
+
with_scope(selector) do
|
37
|
+
find(element.to_s).click
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Check json body.
|
2
|
+
#
|
3
|
+
# @yieldparam expected_json [String] Expected json string.
|
4
|
+
Then(/^(?:|I )should see JSON:$/) do |expected_json|
|
5
|
+
require 'json'
|
6
|
+
expected = JSON.pretty_generate(JSON.parse(expected_json))
|
7
|
+
actual = JSON.pretty_generate(JSON.parse(page.text))
|
8
|
+
expect(actual).to eq(expected)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Search text on page.
|
12
|
+
#
|
13
|
+
# @yieldparam text [String] Text to search on page.
|
14
|
+
# @yieldparam selector [String] Define scope per css selector.
|
15
|
+
Then(/^(?:|I )(should|should not) see "([^"]*)"(?: within "([^"]*)")?$/) do |should_or_not, text, selector|
|
16
|
+
should_or_not = should_or_not == 'should'
|
17
|
+
with_scope(selector) do
|
18
|
+
expect(page).to(should_or_not ? have_content(text) : have_no_content(text))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Search regex on page.
|
23
|
+
#
|
24
|
+
# @yieldparam regexp [String] Regex to search on page.
|
25
|
+
# @yieldparam selector [String] Define scope per css selector.
|
26
|
+
Then(%r{^(?:|I )(should|should not) see /([^/]*)/(?: within "([^"]*)")?$}) do |should_or_not, regexp, selector|
|
27
|
+
regexp = Regexp.new(regexp)
|
28
|
+
should_or_not = should_or_not == 'should'
|
29
|
+
with_scope(selector) do
|
30
|
+
expect(page).to(should_or_not ? have_xpath('//*', text: regexp) : have_no_xpath('//*', text: regexp))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Search for xpath existance on page.
|
35
|
+
#
|
36
|
+
# @yieldparam xpath [String] xpath to search on page.
|
37
|
+
# @yieldparam selector [String] Define scope per css selector.
|
38
|
+
Then(/^(?:|I )(should|should not) see xpath "([^"]*)"(?: within "([^"]*)")?$/) do |should_or_not, xpath, selector|
|
39
|
+
should_or_not = should_or_not == 'should'
|
40
|
+
with_scope(selector) do
|
41
|
+
expect(page).to(should_or_not ? have_xpath(xpath) : have_no_xpath(xpath))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Check if ruby can parse content within scope as element.
|
46
|
+
#
|
47
|
+
# @yieldparam selector [String] Define scope per css selector.
|
48
|
+
Then(/^I should see a date within "([^"]*)"$/) do |selector|
|
49
|
+
with_scope(selector) do
|
50
|
+
require 'date'
|
51
|
+
expect(Date.parse(page.text)).not_to be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Check if element is visible.
|
56
|
+
#
|
57
|
+
# @yieldparam element [String] Css selector for element.
|
58
|
+
Then(/^the element "([^"]*)" (should|should not) be visible$/) do |element, should_or_not|
|
59
|
+
should_or_not = should_or_not == 'should'
|
60
|
+
element = find(selector_for(element).to_s, visible: false)
|
61
|
+
expect(element.visible?).to should_or_not ? be_truthy : be_falsey
|
62
|
+
end
|
63
|
+
|
64
|
+
# Check if at least x elements are existant
|
65
|
+
#
|
66
|
+
# @yieldparam number_of_elements [String] Count of elements.
|
67
|
+
# @yieldparam selector [String] Css selector for elements.
|
68
|
+
# @yieldparam parent [String] Define scope per css selector.
|
69
|
+
Then(/^I should have at least (\d+) "([^"]*)" within "([^"]*)"$/) do |number_of_elements, selector, parent|
|
70
|
+
with_scope(parent) do
|
71
|
+
elements = all(selector_for(selector))
|
72
|
+
expect(elements.size).to be >= number_of_elements.to_i
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check if page has a certain title.
|
77
|
+
#
|
78
|
+
# @yieldparam selector [String] Define page title.
|
79
|
+
Then(/^the page should have a title of "([^"]*)"$/) do |title|
|
80
|
+
expect(page).to have_title(title)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Check if page has a certain title.
|
84
|
+
#
|
85
|
+
# @yieldparam selector [String] Define page title.
|
86
|
+
Then(%r{^the page title should match /([^/]*)/$}) do |title_regex|
|
87
|
+
expect(page.title).to match(title_regex)
|
88
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# Fill text into form field
|
2
|
+
#
|
3
|
+
# @yieldparam field [String] Field name.
|
4
|
+
# @yieldparam value [String] Field value.
|
5
|
+
# @yieldparam selector [String] Define scope per css selector.
|
6
|
+
When(/^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/) do |value, field, selector|
|
7
|
+
with_scope selector do
|
8
|
+
fill_in field, with: value
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# Use this to fill in an entire form with data from a table. Example:
|
13
|
+
#
|
14
|
+
# When I fill in the following:
|
15
|
+
# | Account Number | 5002 |
|
16
|
+
# | Expiry date | 2009-11-01 |
|
17
|
+
# | Note | Nice guy |
|
18
|
+
# | Wants Email? | |
|
19
|
+
#
|
20
|
+
# TODO: Add support for checkbox, select og option
|
21
|
+
# based on naming conventions.
|
22
|
+
#
|
23
|
+
# @yieldparam selector [String] Define scope per css selector.
|
24
|
+
# @yieldparam fields [Hash] See above
|
25
|
+
When(/^(?:|I )fill in the following(?: within "([^"]*)")?:$/) do |selector, fields|
|
26
|
+
with_scope selector do
|
27
|
+
fields.rows_hash.each do |name, value|
|
28
|
+
step %(I fill in "#{value}" for "#{name}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Select value with form select box
|
34
|
+
#
|
35
|
+
# @yieldparam value [String] Field value.
|
36
|
+
# @yieldparam field [String] Field name.
|
37
|
+
# @yieldparam selector [String] Define scope per css selector.
|
38
|
+
When(/^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/) do |value, field, selector|
|
39
|
+
with_scope selector do
|
40
|
+
select value, from: field
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Activate checkbox.
|
45
|
+
#
|
46
|
+
# @yieldparam field [String] Field name.
|
47
|
+
# @yieldparam selector [String] Define scope per css selector.
|
48
|
+
When(/^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/) do |field, selector|
|
49
|
+
with_scope selector do
|
50
|
+
check field
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Deactivate checkbox.
|
55
|
+
#
|
56
|
+
# @yieldparam field [String] Field name.
|
57
|
+
# @yieldparam selector [String] Define scope per css selector.
|
58
|
+
When(/^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/) do |field, selector|
|
59
|
+
with_scope selector do
|
60
|
+
uncheck field
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Activate radiobutton
|
65
|
+
#
|
66
|
+
# @yieldparam field [String] Field name.
|
67
|
+
# @yieldparam selector [String] Define scope per css selector.
|
68
|
+
When(/^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/) do |field, selector|
|
69
|
+
with_scope selector do
|
70
|
+
choose field
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Attach file to field.
|
75
|
+
#
|
76
|
+
# @yieldparam path [String] Path to file.
|
77
|
+
# @yieldparam field [String] Field name.
|
78
|
+
# @yieldparam selector [String] Define scope per css selector.
|
79
|
+
When(/^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/) do |path, field, selector|
|
80
|
+
with_scope selector do
|
81
|
+
attach_file field, path
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Check if value of given form field match current value.
|
86
|
+
#
|
87
|
+
# @yieldparam field [String] Field name.
|
88
|
+
# @yieldparam selector [String] Define scope per css selector.
|
89
|
+
# @yieldparam value [String] Value to check.
|
90
|
+
Then(/^"([^"]*)" (should|should not) be contained in field "([^"]*)"(?: within "([^"]*)")?$/) do |value, should_or_not, field, selector|
|
91
|
+
should_or_not = should_or_not.eql? 'should'
|
92
|
+
with_scope selector do
|
93
|
+
field = find_field field
|
94
|
+
field_value = field.tag_name == 'textarea' ? field.text : field.value
|
95
|
+
decision = field_value =~ /#{value}/
|
96
|
+
expect(decision).to(should_or_not ? be_truthy : be_falsey)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Check if value of given form field match exactly the current value or not.
|
101
|
+
#
|
102
|
+
# @yieldparam field [String] Field name.
|
103
|
+
# @yieldparam selector [String] Define scope per css selector.
|
104
|
+
# @yieldparam negate [Boolean] Negative check?
|
105
|
+
# @yieldparam value [String] Value to check.
|
106
|
+
Then(/^"([^"]*)" should( not)? be equal to field "([^"]*)"(?: within "([^"]*)")?$/) do |value, negate, field, selector|
|
107
|
+
expectation = negate ? :not_to : :to
|
108
|
+
with_scope selector do
|
109
|
+
field = find_field(field)
|
110
|
+
field_value = field.tag_name == 'textarea' ? field.text : field.value
|
111
|
+
if value.nil? # Capybara returns nil for empty fields, so we can't test for equality
|
112
|
+
expect(field_value).send(expectation, be_blank)
|
113
|
+
else
|
114
|
+
expect(field_value).send(expectation, eq(value))
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Check if checkbox or radio button is (not) checked.
|
120
|
+
#
|
121
|
+
# @yieldparam field [String] Field name.
|
122
|
+
# @yieldparam selector [String] Define scope per css selector.
|
123
|
+
Then(/^(should|should not) be checked "([^"]*)"(?: within "([^"]*)")?$/) do |should_or_not, field, selector|
|
124
|
+
should_or_not = should_or_not.eql? 'should'
|
125
|
+
with_scope selector do
|
126
|
+
field_checked = find_field(field)['checked']
|
127
|
+
expect(field_checked).to(should_or_not ? be_truthy : be_falsey)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Lost focus of current field. Execute event "blur".
|
132
|
+
#
|
133
|
+
# @yieldparam field [String] Field name.
|
134
|
+
# @yieldparam selector [String] Define scope per css selector.
|
135
|
+
When(/^I leave the field "([^"]*)"(?: within "([^"]*)")?$/) do |field, selector|
|
136
|
+
with_scope selector do
|
137
|
+
field = find_field(field).trigger 'blur'
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# Submit form by id.
|
142
|
+
#
|
143
|
+
# @yieldparam form_id [String] Form id.
|
144
|
+
Then(/^I submit form "([^\"]*)"?$/) do |form_id|
|
145
|
+
page.execute_script "document.forms['#{form_id}'].submit();"
|
146
|
+
end
|