spreewald 0.3.10 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -0
- data/lib/spreewald/web_steps.rb +31 -0
- data/lib/spreewald_support/version.rb +1 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -487,3 +487,13 @@ deprecation notice. Decide for yourself whether you want to use them:
|
|
487
487
|
| Beta Group |
|
488
488
|
|
489
489
|
|
490
|
+
|
491
|
+
* **Then the "..." (field|button) should( not)? be disabled**
|
492
|
+
|
493
|
+
Tests that an input or button with the given label is disabled.
|
494
|
+
|
495
|
+
|
496
|
+
* **Then the "..." field should( not)? be visible**
|
497
|
+
|
498
|
+
Tests that a field with the given label is visible.
|
499
|
+
|
data/lib/spreewald/web_steps.rb
CHANGED
@@ -528,3 +528,34 @@ Then /^I should see in this order:?$/ do |text|
|
|
528
528
|
pattern = Regexp.compile(pattern)
|
529
529
|
page.find('body').text.gsub(/\s+/, ' ').should =~ pattern
|
530
530
|
end
|
531
|
+
|
532
|
+
# Tests that an input or button with the given label is disabled.
|
533
|
+
Then /^the "([^\"]*)" (field|button) should( not)? be disabled$/ do |label, kind, negate|
|
534
|
+
if kind == 'field'
|
535
|
+
element = find_field(label)
|
536
|
+
else
|
537
|
+
element = find_button(label)
|
538
|
+
end
|
539
|
+
["false", "", nil].send(negate ? :should : :should_not, include(element[:disabled]))
|
540
|
+
end
|
541
|
+
|
542
|
+
# Tests that a field with the given label is visible.
|
543
|
+
Then /^the "([^\"]*)" field should( not)? be visible$/ do |label, negate|
|
544
|
+
field = find_field(label)
|
545
|
+
expectation = negate ? :should_not : :should
|
546
|
+
case Capybara::current_driver
|
547
|
+
when :selenium, :webkit
|
548
|
+
patiently do
|
549
|
+
visibility_detecting_javascript = %[
|
550
|
+
(function(){
|
551
|
+
var field = $('##{field['id']}');
|
552
|
+
return(field.is(':visible'));
|
553
|
+
})();
|
554
|
+
].gsub(/\n/, ' ')
|
555
|
+
page.evaluate_script(visibility_detecting_javascript).send(expectation, be_true)
|
556
|
+
end
|
557
|
+
else
|
558
|
+
field.send(expectation, be_visible)
|
559
|
+
end
|
560
|
+
end
|
561
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreewald
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tobias Kraze
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-01-
|
18
|
+
date: 2013-01-30 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|