cello 0.0.17 → 0.0.19
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 +7 -0
- data/.gitignore +1 -3
- data/.ruby-version +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +2 -0
- data/LICENCE +1 -1
- data/README.md +3 -3
- data/Rakefile +7 -1
- data/cello.gemspec +5 -0
- data/features/browser.feature +1 -0
- data/features/element.feature +8 -8
- data/features/get_html_attributes.feature +4 -4
- data/features/pages/firefox.rb +0 -1
- data/features/pages/headless.rb +11 -0
- data/features/pages/input_fields.rb +2 -7
- data/features/step_definitions/access_element.rb +6 -8
- data/features/step_definitions/browser.rb +5 -6
- data/features/step_definitions/checkbox.rb +9 -11
- data/features/step_definitions/common_steps.rb +6 -28
- data/features/step_definitions/element.rb +12 -14
- data/features/step_definitions/html_attributes.rb +4 -3
- data/features/step_definitions/radio.rb +19 -23
- data/features/step_definitions/select.rb +12 -18
- data/features/step_definitions/textarea.rb +27 -29
- data/features/step_definitions/textfield.rb +32 -34
- data/lib/cello/structure/browser.rb +1 -5
- data/lib/cello/structure/html_elements/element_helper.rb +33 -11
- data/lib/cello/structure/html_elements/logger.rb +34 -0
- data/lib/cello/structure/html_elements/select_helper.rb +18 -8
- data/lib/cello/structure/page.rb +11 -4
- data/lib/cello/version.rb +1 -1
- data/lib/cello.rb +1 -1
- data/spec/checkbox_spec.rb +10 -2
- data/spec/element_spec.rb +13 -7
- data/spec/mock/page.rb +25 -0
- data/spec/select_spec.rb +11 -4
- data/spec/textarea_spec.rb +15 -3
- data/spec/textfield_spec.rb +13 -1
- metadata +190 -206
- data/travis.yml +0 -7
|
@@ -1,68 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
require file
|
|
3
|
-
end
|
|
1
|
+
require "cello"
|
|
4
2
|
|
|
5
3
|
Then /^I should can knows if this page has a textarea$/ do
|
|
6
|
-
@
|
|
7
|
-
@
|
|
4
|
+
@browser.textarea_is_real?.should be_true
|
|
5
|
+
@browser.close
|
|
8
6
|
end
|
|
9
7
|
|
|
10
8
|
Then /^I should be able to write a text like "(.*?)" in the textarea$/ do |text|
|
|
11
|
-
@
|
|
12
|
-
@
|
|
9
|
+
@browser.textarea_fill_with(text)
|
|
10
|
+
@browser.close
|
|
13
11
|
end
|
|
14
12
|
|
|
15
13
|
Then /^I shoud be able to get the text "(.*?)" from this textarea$/ do |text|
|
|
16
|
-
@
|
|
17
|
-
@
|
|
14
|
+
@browser.textarea_get_text.should include(text)
|
|
15
|
+
@browser.close
|
|
18
16
|
end
|
|
19
17
|
|
|
20
18
|
Then /^I should be able to know if the text on the textarea does not contais the text "(.*?)"$/ do |text|
|
|
21
|
-
@
|
|
22
|
-
@
|
|
19
|
+
@browser.textarea_dont_contain(text).should be_true
|
|
20
|
+
@browser.close
|
|
23
21
|
end
|
|
24
22
|
|
|
25
23
|
Then /^I should fail when ask if the text on the textarea does not contais the text "(.*?)"$/ do |text|
|
|
26
|
-
@
|
|
27
|
-
@
|
|
24
|
+
@browser.textarea_dont_contain(text).should be_false
|
|
25
|
+
@browser.close
|
|
28
26
|
end
|
|
29
27
|
|
|
30
28
|
Then /^I should be able to know if the text on the textarea contais the text "(.*?)"$/ do |text|
|
|
31
|
-
@
|
|
32
|
-
@
|
|
29
|
+
@browser.textarea_contains(text).should be_true
|
|
30
|
+
@browser.close
|
|
33
31
|
end
|
|
34
32
|
|
|
35
33
|
Then /^I should fail when ask if the text on the textarea contais the text "(.*?)"$/ do |text|
|
|
36
|
-
@
|
|
37
|
-
@
|
|
34
|
+
@browser.textarea_contains(text).should be_false
|
|
35
|
+
@browser.close
|
|
38
36
|
end
|
|
39
37
|
|
|
40
38
|
Then /^I should be able to know if the text on the textarea is exacly the text "(.*?)"$/ do |text|
|
|
41
|
-
@
|
|
42
|
-
@
|
|
39
|
+
@browser.textarea_text_is(text).should be_true
|
|
40
|
+
@browser.close
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
Then /^I should fail when ask if the text on the textarea is exacly the text "(.*?)"$/ do |text|
|
|
46
|
-
@
|
|
47
|
-
@
|
|
44
|
+
@browser.textarea_text_is(text).should be_false
|
|
45
|
+
@browser.close
|
|
48
46
|
end
|
|
49
47
|
|
|
50
48
|
Then /^I should be able to know if the textarea is empty$/ do
|
|
51
|
-
@
|
|
52
|
-
@
|
|
49
|
+
@browser.textarea_is_empty?.should be_true
|
|
50
|
+
@browser.close
|
|
53
51
|
end
|
|
54
52
|
|
|
55
53
|
Then /^I should fail when ask if the textarea is empty$/ do
|
|
56
|
-
@
|
|
57
|
-
@
|
|
54
|
+
@browser.textarea_is_empty?.should be_false
|
|
55
|
+
@browser.close
|
|
58
56
|
end
|
|
59
57
|
|
|
60
58
|
Then /^I should be able to know if the size of the textarea text is "(.*?)"$/ do |size|
|
|
61
|
-
@
|
|
62
|
-
@
|
|
59
|
+
@browser.textarea_text_size.should == size.to_i
|
|
60
|
+
@browser.close
|
|
63
61
|
end
|
|
64
62
|
|
|
65
63
|
Then /^I should fail when ask if the size of the textarea text is "(.*?)"$/ do |size|
|
|
66
|
-
@
|
|
67
|
-
@
|
|
64
|
+
@browser.textarea_text_size.should_not == size.to_i
|
|
65
|
+
@browser.close
|
|
68
66
|
end
|
|
@@ -1,80 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
require file
|
|
3
|
-
end
|
|
1
|
+
require "cello"
|
|
4
2
|
|
|
5
3
|
Then /^I should can knows if this page has a textfield named "(.*?)"$/ do |text_field_name|
|
|
6
|
-
@
|
|
7
|
-
@
|
|
4
|
+
@browser.send("#{text_field_name}_is_real?").should be_true
|
|
5
|
+
@browser.close
|
|
8
6
|
end
|
|
9
7
|
|
|
10
8
|
Then /^I should fail when ask if this page has a textfield named "(.*?)"$/ do |text_field_name|
|
|
11
|
-
@
|
|
12
|
-
@
|
|
9
|
+
@browser.send("#{text_field_name}_is_real?").should be_false
|
|
10
|
+
@browser.close
|
|
13
11
|
end
|
|
14
12
|
|
|
15
13
|
Then /^I should be able to write a text like "(.*?)" in the textfield$/ do |text|
|
|
16
|
-
@
|
|
17
|
-
@
|
|
18
|
-
@
|
|
14
|
+
@browser.text_field_fill_with(text)
|
|
15
|
+
@browser.text_field_get_text.should == text
|
|
16
|
+
@browser.close
|
|
19
17
|
end
|
|
20
18
|
|
|
21
19
|
Then /^I shoud be able to get the text "(.*?)" from this textfield$/ do |text|
|
|
22
|
-
@
|
|
23
|
-
@
|
|
20
|
+
@browser.text_field_get_text.should include(text)
|
|
21
|
+
@browser.close
|
|
24
22
|
end
|
|
25
23
|
|
|
26
24
|
Then /^I shoud fail to try get the text "(.*?)" from this textfield$/ do |text|
|
|
27
|
-
@
|
|
28
|
-
@
|
|
25
|
+
@browser.text_field_get_text.should_not include(text)
|
|
26
|
+
@browser.close
|
|
29
27
|
end
|
|
30
28
|
|
|
31
29
|
Then /^I should be able to know if the text on the textfield does not contais the text "(.*?)"$/ do |text|
|
|
32
|
-
@
|
|
33
|
-
@
|
|
30
|
+
@browser.text_field_dont_contain(text).should be_true
|
|
31
|
+
@browser.close
|
|
34
32
|
end
|
|
35
33
|
|
|
36
34
|
Then /^I should fail when ask if the text on the textfield does not contais the text "(.*?)"$/ do |text|
|
|
37
|
-
@
|
|
38
|
-
@
|
|
35
|
+
@browser.text_field_dont_contain(text).should be_false
|
|
36
|
+
@browser.close
|
|
39
37
|
end
|
|
40
38
|
|
|
41
39
|
Then /^I should be able to know if the text on the textfield contais the text "(.*?)"$/ do |text|
|
|
42
|
-
@
|
|
43
|
-
@
|
|
40
|
+
@browser.text_field_contains(text).should be_true
|
|
41
|
+
@browser.close
|
|
44
42
|
end
|
|
45
43
|
|
|
46
44
|
Then /^I should fail when ask if the text on the textfield contais the text "(.*?)"$/ do |text|
|
|
47
|
-
@
|
|
48
|
-
@
|
|
45
|
+
@browser.text_field_contains(text).should be_false
|
|
46
|
+
@browser.close
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
Then /^I should be able to know if the text on the textfield is exacly the text "(.*?)"$/ do |text|
|
|
52
|
-
@
|
|
53
|
-
@
|
|
50
|
+
@browser.text_field_text_is(text).should be_true
|
|
51
|
+
@browser.close
|
|
54
52
|
end
|
|
55
53
|
|
|
56
54
|
Then /^I should fail when ask if the text on the textfield is exacly the text "(.*?)"$/ do |text|
|
|
57
|
-
@
|
|
58
|
-
@
|
|
55
|
+
@browser.text_field_text_is(text).should be_false
|
|
56
|
+
@browser.close
|
|
59
57
|
end
|
|
60
58
|
|
|
61
59
|
Then /^I should be able to know if the textfield is empty$/ do
|
|
62
|
-
@
|
|
63
|
-
@
|
|
60
|
+
@browser.text_field_is_empty?.should be_true
|
|
61
|
+
@browser.close
|
|
64
62
|
end
|
|
65
63
|
|
|
66
64
|
Then /^I should fail when ask if the textfield is empty$/ do
|
|
67
|
-
@
|
|
68
|
-
@
|
|
65
|
+
@browser.text_field_is_empty?.should be_false
|
|
66
|
+
@browser.close
|
|
69
67
|
end
|
|
70
68
|
|
|
71
69
|
Then /^I should be able to know if the size of the textfield text is "(.*?)"$/ do |size|
|
|
72
|
-
@
|
|
73
|
-
@
|
|
70
|
+
@browser.text_field_text_size.should == size.to_i
|
|
71
|
+
@browser.close
|
|
74
72
|
end
|
|
75
73
|
|
|
76
74
|
@wip
|
|
77
75
|
Then /^I should fail when ask if the size of the textfield text is "(.*?)"$/ do |size|
|
|
78
|
-
@
|
|
79
|
-
@
|
|
76
|
+
@browser.text_field_text_size.should_not == size.to_i
|
|
77
|
+
@browser.close
|
|
80
78
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require "rubygems"
|
|
2
2
|
require "watir-webdriver"
|
|
3
|
-
require "headless"
|
|
4
3
|
|
|
5
4
|
module Cello
|
|
6
5
|
module Structure
|
|
@@ -9,13 +8,11 @@ module Cello
|
|
|
9
8
|
attr_reader :browser
|
|
10
9
|
|
|
11
10
|
def initialize(browser)
|
|
12
|
-
@headless = Headless.new
|
|
13
|
-
@headless.start
|
|
14
11
|
@browser = Watir::Browser.new browser
|
|
15
12
|
end
|
|
16
13
|
|
|
17
14
|
def visit
|
|
18
|
-
@
|
|
15
|
+
@context.visit
|
|
19
16
|
end
|
|
20
17
|
|
|
21
18
|
def context(page)
|
|
@@ -28,7 +25,6 @@ module Cello
|
|
|
28
25
|
|
|
29
26
|
def close
|
|
30
27
|
@browser.close
|
|
31
|
-
@headless.destroy
|
|
32
28
|
end
|
|
33
29
|
|
|
34
30
|
def get_screenshot
|
|
@@ -5,43 +5,65 @@ end
|
|
|
5
5
|
module Cello
|
|
6
6
|
module Structure
|
|
7
7
|
module ElementHelper
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
private
|
|
10
10
|
|
|
11
|
-
def element(name, type, *args)
|
|
11
|
+
def element(name, type, *args)
|
|
12
12
|
class_eval do
|
|
13
13
|
define_method name do
|
|
14
|
-
|
|
14
|
+
engine.browser.send(type, *args)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
#define_extras(name, type)
|
|
17
18
|
define_extras(name, type)
|
|
18
19
|
end
|
|
20
|
+
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
def define_extras(name, type)
|
|
24
|
+
include LogHelper
|
|
25
|
+
|
|
26
|
+
define_method "#{name}_exit_wait?" do
|
|
27
|
+
send(name).visible?
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
define_method "#{name}_is_enable?" do
|
|
31
|
+
logger(name, __method__, type) {
|
|
32
|
+
send(name).enabled?
|
|
33
|
+
}
|
|
34
|
+
end
|
|
22
35
|
define_method "#{name}_is_real?" do
|
|
23
|
-
|
|
36
|
+
logger(name, __method__, type, "Foo") {
|
|
37
|
+
send(name).exists?
|
|
38
|
+
}
|
|
24
39
|
end
|
|
25
40
|
define_method "#{name}_click" do
|
|
26
|
-
|
|
41
|
+
logger(name, __method__, type) {
|
|
42
|
+
# require "pry"; binding.pry
|
|
43
|
+
send(name).click
|
|
44
|
+
}
|
|
27
45
|
end
|
|
28
46
|
define_method "#{name}_is_visible?" do
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
send(name).enabled?
|
|
47
|
+
logger(name, __method__, type) {
|
|
48
|
+
send(name).visible?
|
|
49
|
+
}
|
|
33
50
|
end
|
|
34
51
|
define_method "#{name}_right_click" do
|
|
35
|
-
|
|
52
|
+
logger(name, __method__, type) {
|
|
53
|
+
send(name).right_click
|
|
54
|
+
}
|
|
36
55
|
end
|
|
37
56
|
|
|
38
57
|
define_method "#{name}_get" do |att|
|
|
39
|
-
|
|
58
|
+
logger(name, __method__, type) {
|
|
59
|
+
send(name).attribute_value(att)
|
|
60
|
+
}
|
|
40
61
|
end
|
|
41
62
|
|
|
42
63
|
method_name = "define_extras_for_#{type}"
|
|
43
64
|
send(method_name, name) if respond_to? method_name
|
|
44
65
|
end
|
|
66
|
+
|
|
45
67
|
|
|
46
68
|
include CheckboxHelper
|
|
47
69
|
include TextfieldHelper
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#require 'sourcify'
|
|
2
|
+
|
|
3
|
+
module Cello
|
|
4
|
+
module Structure
|
|
5
|
+
module LogHelper
|
|
6
|
+
|
|
7
|
+
def logger(name, method, type, params=nil)
|
|
8
|
+
ts = Time.now
|
|
9
|
+
# wait_element_helper name
|
|
10
|
+
left = yield
|
|
11
|
+
params = "NONE" if params.nil?
|
|
12
|
+
#binding.pry
|
|
13
|
+
puts "
|
|
14
|
+
Element: #{name}
|
|
15
|
+
Type: #{type}
|
|
16
|
+
Method: #{method}
|
|
17
|
+
Left #{left}
|
|
18
|
+
Params: #{params}
|
|
19
|
+
Code: #{yield}
|
|
20
|
+
=> #{(Time.now - ts).round 4} seconds"
|
|
21
|
+
left
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def wait_element_helper(name)
|
|
25
|
+
timeout = 1
|
|
26
|
+
while !send("#{name}_exit_wait?") && time < timeout do
|
|
27
|
+
sleep 0.1
|
|
28
|
+
time += 0.1
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -2,21 +2,31 @@ module Cello
|
|
|
2
2
|
module Structure
|
|
3
3
|
module SelectHelper
|
|
4
4
|
def define_extras_for_select(name)
|
|
5
|
+
include LogHelper
|
|
6
|
+
|
|
5
7
|
define_method "#{name}_get_options" do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
options.
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
logger(name, __method__, :select) {
|
|
9
|
+
options = Array.new
|
|
10
|
+
send(name).options.each do |option|
|
|
11
|
+
options.push option.text
|
|
12
|
+
end
|
|
13
|
+
options
|
|
14
|
+
}
|
|
11
15
|
end
|
|
12
16
|
define_method "#{name}_select" do |option|
|
|
13
|
-
|
|
17
|
+
logger(name, __method__, :select) {
|
|
18
|
+
send(name).select option
|
|
19
|
+
}
|
|
14
20
|
end
|
|
15
21
|
define_method "#{name}_is" do |option|
|
|
16
|
-
|
|
22
|
+
logger(name, __method__, :select) {
|
|
23
|
+
send(name).selected_options.last.text == option
|
|
24
|
+
}
|
|
17
25
|
end
|
|
18
26
|
define_method "#{name}_selected" do
|
|
19
|
-
|
|
27
|
+
logger(name, __method__, :select) {
|
|
28
|
+
send(name).selected_options.last.text
|
|
29
|
+
}
|
|
20
30
|
end
|
|
21
31
|
# define_method "#{name}_clear" do
|
|
22
32
|
# send(name).clear
|
data/lib/cello/structure/page.rb
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
require File.join(File.dirname(__FILE__), "./html_elements/element_helper")
|
|
2
2
|
require "rubygems"
|
|
3
|
-
require "watir-webdriver"
|
|
4
3
|
require "rspec"
|
|
5
4
|
|
|
6
5
|
module Cello
|
|
7
6
|
module Structure
|
|
8
7
|
class Page
|
|
9
8
|
extend Cello::Structure::ElementHelper
|
|
9
|
+
attr_reader :engine
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
def initialize(engine)
|
|
12
|
+
@engine = engine
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def visit
|
|
16
|
+
@engine.goto @@url
|
|
17
|
+
end
|
|
12
18
|
|
|
13
|
-
def
|
|
14
|
-
|
|
19
|
+
def self.url(url)
|
|
20
|
+
@@url = url
|
|
15
21
|
end
|
|
22
|
+
|
|
16
23
|
end
|
|
17
24
|
end
|
|
18
25
|
end
|
data/lib/cello/version.rb
CHANGED
data/lib/cello.rb
CHANGED
data/spec/checkbox_spec.rb
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'mock/page'
|
|
2
|
+
require "pry"
|
|
2
3
|
|
|
3
4
|
describe Cello::Structure::CheckboxHelper do
|
|
4
5
|
describe "define_extras_for_checkbox" do
|
|
5
|
-
|
|
6
|
+
before(:all) do
|
|
7
|
+
@page = Mock::Site::MockPage.new "foo"
|
|
8
|
+
end
|
|
9
|
+
it "Verify if is checked method exists" do
|
|
10
|
+
(@page.methods.map.include? :checkbox_is_checked?).should be_true
|
|
6
11
|
end
|
|
7
12
|
it "Verify if there it is unchecked" do
|
|
13
|
+
(@page.methods.map.include? :checkbox_is_unchecked?).should be_true
|
|
8
14
|
end
|
|
9
15
|
it "Check a Checkbox" do
|
|
16
|
+
(@page.methods.map.include? :checkbox_check).should be_true
|
|
10
17
|
end
|
|
11
18
|
it "Clear a Checkbox" do
|
|
19
|
+
(@page.methods.map.include? :checkbox_uncheck).should be_true
|
|
12
20
|
end
|
|
13
21
|
end
|
|
14
22
|
end
|
data/spec/element_spec.rb
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'mock/page'
|
|
2
2
|
|
|
3
3
|
describe "Class with element" do
|
|
4
4
|
describe "Element interface" do
|
|
5
|
-
|
|
5
|
+
before(:all) do
|
|
6
|
+
@page = Mock::Site::MockPage.new "foo"
|
|
6
7
|
end
|
|
7
|
-
it "
|
|
8
|
+
it "Verify if the element exists method exists" do
|
|
9
|
+
(@page.methods.map.include? :element_is_real?).should be_true
|
|
8
10
|
end
|
|
9
|
-
it "
|
|
11
|
+
it "Click on the element method exists" do
|
|
12
|
+
(@page.methods.map.include? :element_click).should be_true
|
|
10
13
|
end
|
|
11
|
-
it "Verify if the element is
|
|
14
|
+
it "Verify if the element is visible method exists" do
|
|
15
|
+
(@page.methods.map.include? :element_is_visible?).should be_true
|
|
12
16
|
end
|
|
13
|
-
it "
|
|
17
|
+
it "Verify if the element is enable methods exists" do
|
|
18
|
+
(@page.methods.map.include? :element_is_enable?).should be_true
|
|
14
19
|
end
|
|
15
|
-
it "
|
|
20
|
+
it "Click with the right button on the element method exists" do
|
|
21
|
+
(@page.methods.map.include? :element_right_click).should be_true
|
|
16
22
|
end
|
|
17
23
|
end
|
|
18
24
|
end
|
data/spec/mock/page.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__),"../../lib/cello/structure/page")
|
|
2
|
+
|
|
3
|
+
module Mock
|
|
4
|
+
module Site
|
|
5
|
+
class MockPage < Cello::Structure::Page
|
|
6
|
+
element :element, :element, :id => 'elem1'
|
|
7
|
+
element :text_field, :text_field, :id => 'text1'
|
|
8
|
+
element :text_fieldname, :text_field, :name => 'text1'
|
|
9
|
+
element :text_fieldxpath, :text_field, :xpah, '//*[@id="text1"]'
|
|
10
|
+
element :checkbox, :checkbox, :id => 'check1'
|
|
11
|
+
element :textarea, :textarea, :id => 'area1'
|
|
12
|
+
element :radios, :radios, :name => 'items'
|
|
13
|
+
element :select, :select, :id => 'select1'
|
|
14
|
+
element :link, :link, :id => 'link1'
|
|
15
|
+
|
|
16
|
+
def get_url
|
|
17
|
+
'file://' + File.dirname(__FILE__) + '/../site/inputs.html'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def initialize(teste)
|
|
21
|
+
super(teste)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/spec/select_spec.rb
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "mock/page"
|
|
2
2
|
|
|
3
3
|
describe Cello::Structure::SelectHelper do
|
|
4
4
|
describe "define_extras_for_select" do
|
|
5
|
-
|
|
5
|
+
before(:all) do
|
|
6
|
+
@page = Mock::Site::MockPage.new "foo"
|
|
6
7
|
end
|
|
7
|
-
it "
|
|
8
|
+
it "Select an option method exists" do
|
|
9
|
+
(@page.methods.map.include? :select_select).should be_true
|
|
8
10
|
end
|
|
9
|
-
it "
|
|
11
|
+
it "go to default or empty option method exists" do
|
|
12
|
+
pending
|
|
13
|
+
(@page.methods.map.include? :select_clear).should be_true
|
|
14
|
+
end
|
|
15
|
+
it "return the selected option method exists" do
|
|
16
|
+
(@page.methods.map.include? :select_selected).should be_true
|
|
10
17
|
end
|
|
11
18
|
end
|
|
12
19
|
end
|
data/spec/textarea_spec.rb
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "mock/page"
|
|
2
2
|
|
|
3
3
|
describe Cello::Structure::TextareaHelper do
|
|
4
4
|
describe "define_extras_for_textarea" do
|
|
5
|
-
|
|
5
|
+
before(:all) do
|
|
6
|
+
@page = Mock::Site::MockPage.new "foo"
|
|
6
7
|
end
|
|
7
|
-
it "
|
|
8
|
+
it "Veify if the textarea is enable method exists" do
|
|
9
|
+
(@page.methods.map.include? :textarea_is_enable?).should be_true
|
|
10
|
+
end
|
|
11
|
+
it "Clear the textarea method exists" do
|
|
12
|
+
(@page.methods.map.include? :textarea_clear).should be_true
|
|
8
13
|
end
|
|
9
14
|
it "Get the text from the textarea" do
|
|
15
|
+
(@page.methods.map.include? :textarea_get_text).should be_true
|
|
10
16
|
end
|
|
11
17
|
it "Fill the textarea with some specific text" do
|
|
18
|
+
(@page.methods.map.include? :textarea_fill_with).should be_true
|
|
12
19
|
end
|
|
13
20
|
it "Verify if the textarea does not contain some text" do
|
|
21
|
+
(@page.methods.map.include? :textarea_dont_contain).should be_true
|
|
14
22
|
end
|
|
15
23
|
it "Verify if the textarea contains some text" do
|
|
24
|
+
(@page.methods.map.include? :textarea_contains).should be_true
|
|
16
25
|
end
|
|
17
26
|
it "Verify if the containt of the textarea is exacly some text" do
|
|
27
|
+
(@page.methods.map.include? :textarea_text_is).should be_true
|
|
18
28
|
end
|
|
19
29
|
it "Verify if the textarea is empty" do
|
|
30
|
+
(@page.methods.map.include? :textarea_is_empty?).should be_true
|
|
20
31
|
end
|
|
21
32
|
it "Get the size of the containt of the textarea" do
|
|
33
|
+
(@page.methods.map.include? :textarea_text_size).should be_true
|
|
22
34
|
end
|
|
23
35
|
end
|
|
24
36
|
end
|
data/spec/textfield_spec.rb
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "mock/page"
|
|
2
2
|
|
|
3
3
|
describe Cello::Structure::TextfieldHelper do
|
|
4
4
|
describe "define_extras_for_textfield" do
|
|
5
|
+
before(:all) do
|
|
6
|
+
@page = Mock::Site::MockPage.new "foo"
|
|
7
|
+
end
|
|
5
8
|
it "Veify if the textfield is enabled" do
|
|
9
|
+
(@page.methods.map.include? :text_field_is_enable?).should be_true
|
|
6
10
|
end
|
|
7
11
|
it "Clear the textfield" do
|
|
12
|
+
(@page.methods.map.include? :text_field_clear).should be_true
|
|
8
13
|
end
|
|
9
14
|
it "Get the text from the textfield" do
|
|
15
|
+
(@page.methods.map.include? :text_field_get_text).should be_true
|
|
10
16
|
end
|
|
11
17
|
it "Fill the textfield with some specific text" do
|
|
18
|
+
(@page.methods.map.include? :text_field_fill_with).should be_true
|
|
12
19
|
end
|
|
13
20
|
it "Verify if the textfield does not contain some text" do
|
|
21
|
+
(@page.methods.map.include? :text_field_dont_contain).should be_true
|
|
14
22
|
end
|
|
15
23
|
it "Verify if the textfield contains some text" do
|
|
24
|
+
(@page.methods.map.include? :text_field_contains).should be_true
|
|
16
25
|
end
|
|
17
26
|
it "Verify if the containt of the textfield is exacly some text" do
|
|
27
|
+
(@page.methods.map.include? :text_field_text_is).should be_true
|
|
18
28
|
end
|
|
19
29
|
it "Verify if the textfield is empty" do
|
|
30
|
+
(@page.methods.map.include? :text_field_is_empty?).should be_true
|
|
20
31
|
end
|
|
21
32
|
it "Get the size of the containt of the textfield" do
|
|
33
|
+
(@page.methods.map.include? :text_field_text_size).should be_true
|
|
22
34
|
end
|
|
23
35
|
end
|
|
24
36
|
end
|