cello 0.0.12 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile +5 -2
- data/README.md +44 -39
- data/Rakefile +5 -0
- data/cello.gemspec +6 -1
- data/examples/bugbang/pages/home.rb +1 -1
- data/features/access_element.feature +4 -4
- data/features/browser.feature +25 -0
- data/features/button.feature +4 -0
- data/features/dsl.feature +21 -0
- data/features/element.feature +9 -4
- data/features/get_html_attributes.feature +30 -0
- data/features/pages/firefox.rb +12 -0
- data/features/pages/input_fields.rb +10 -4
- data/features/pages/response_page.rb +17 -0
- data/features/radio.feature +85 -0
- data/features/select.feature +29 -0
- data/features/site/inputs.html +38 -0
- data/features/site/read_page.html +23 -0
- data/features/step_definitions/browser.rb +55 -0
- data/features/step_definitions/common_steps.rb +15 -3
- data/features/step_definitions/element.rb +6 -10
- data/features/step_definitions/html_attributes.rb +13 -0
- data/features/step_definitions/radio.rb +55 -0
- data/features/step_definitions/select.rb +39 -0
- data/features/step_definitions/textarea.rb +33 -8
- data/features/step_definitions/textfield.rb +46 -9
- data/features/textarea.feature +30 -4
- data/features/textfield.feature +36 -6
- data/lib/cello/structure/browser.rb +52 -0
- data/lib/cello/{button_helper.rb → structure/html_elements/button_helper.rb} +0 -0
- data/lib/cello/{Checkbox_helper.rb → structure/html_elements/checkbox_helper.rb} +0 -0
- data/lib/cello/{div_helper.rb → structure/html_elements/div_helper.rb} +0 -0
- data/lib/cello/structure/html_elements/dsl.rb +10 -0
- data/lib/cello/{element_helper.rb → structure/html_elements/element_helper.rb} +8 -3
- data/lib/cello/{hidden_helper.rb → structure/html_elements/hidden_helper.rb} +0 -0
- data/lib/cello/{link_helper.rb → structure/html_elements/link_helper.rb} +0 -0
- data/lib/cello/structure/html_elements/radio_helper.rb +55 -0
- data/lib/cello/structure/html_elements/select_helper.rb +27 -0
- data/lib/cello/{span_helper.rb → structure/html_elements/span_helper.rb} +0 -0
- data/lib/cello/{textarea_helper.rb → structure/html_elements/textarea_helper.rb} +7 -7
- data/lib/cello/{textfield_helper.rb → structure/html_elements/textfield_helper.rb} +6 -6
- data/lib/cello/structure/page.rb +19 -0
- data/lib/cello/version.rb +1 -1
- data/lib/cello.rb +4 -0
- data/spec/button_spec.rb +6 -0
- data/spec/checkbox_spec.rb +14 -0
- data/spec/div_spec.rb +6 -0
- data/spec/element_spec.rb +19 -0
- data/spec/hidden_spec.rb +6 -0
- data/spec/link_spec.rb +6 -0
- data/spec/page_spec.rb +20 -0
- data/spec/radio_spec.rb +18 -0
- data/spec/select_spec.rb +12 -0
- data/spec/span_spec.rb +6 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/textarea_spec.rb +24 -0
- data/spec/textfield_spec.rb +24 -0
- data/travis.yml +7 -0
- metadata +134 -24
- data/features/get_html_atributes.feature +0 -6
- data/lib/cello/config/cucumber_config.rb +0 -13
- data/lib/cello/page.rb +0 -44
- data/lib/cello/radio_helper.rb +0 -11
- data/lib/cello/select_helper.rb +0 -14
@@ -0,0 +1,55 @@
|
|
1
|
+
Dir[File.dirname(__FILE__) + "/../../pages/*.rb"].each do |file|
|
2
|
+
require file
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^I have a browser with no context \(blank page\)$/ do
|
6
|
+
@browser = StaticPages::Site::Firefox.new
|
7
|
+
end
|
8
|
+
|
9
|
+
When /^I ask for the context inputs$/ do
|
10
|
+
@browser.context StaticPages::Site::InputPage
|
11
|
+
end
|
12
|
+
|
13
|
+
When /^and I ask to visit the page$/ do
|
14
|
+
@browser.visit
|
15
|
+
end
|
16
|
+
|
17
|
+
Then /^I should see the page inputs$/ do
|
18
|
+
@browser.title.should == "Inputs page"
|
19
|
+
@browser.close
|
20
|
+
end
|
21
|
+
|
22
|
+
Given /^I am in the inputs context$/ do
|
23
|
+
@browser = StaticPages::Site::Firefox.new
|
24
|
+
@browser.context StaticPages::Site::InputPage
|
25
|
+
@browser.visit
|
26
|
+
@browser.title.should == "Inputs page"
|
27
|
+
end
|
28
|
+
|
29
|
+
When /^I ask for fill the textfield$/ do
|
30
|
+
@browser.text_field_fill_with("It Works!")
|
31
|
+
end
|
32
|
+
|
33
|
+
Then /^I should see the filled textfield$/ do
|
34
|
+
@browser.text_field_get_text.should == "It Works!"
|
35
|
+
end
|
36
|
+
|
37
|
+
Then /^I should be able to close the browser$/ do
|
38
|
+
@browser.close
|
39
|
+
end
|
40
|
+
|
41
|
+
When /^I click on the simple page link$/ do
|
42
|
+
@browser.link_click
|
43
|
+
end
|
44
|
+
|
45
|
+
When /^I ask to use the simple page context$/ do
|
46
|
+
@browser.context StaticPages::Site::ResponsePage
|
47
|
+
end
|
48
|
+
|
49
|
+
Then /^I should fail when try access the old textfield$/ do
|
50
|
+
expect { @browser.text_field_get_text}.should raise_error(NoMethodError)
|
51
|
+
end
|
52
|
+
|
53
|
+
Then /^I should be able to verify the text on the new textfield$/ do
|
54
|
+
@browser.text_get_text.should == "Worked Again!"
|
55
|
+
end
|
@@ -2,16 +2,28 @@ Dir[File.dirname(__FILE__) + "/../../pages/*.rb"].each do |file|
|
|
2
2
|
require file
|
3
3
|
end
|
4
4
|
|
5
|
+
Given /^I am on a page that has a element$/ do
|
6
|
+
@page = StaticPages::Site::Firefox.new
|
7
|
+
@page.context StaticPages::Site::InputPage
|
8
|
+
@page.visit
|
9
|
+
end
|
10
|
+
|
5
11
|
Given /^I am on a page that has a textfield$/ do
|
6
|
-
@page = StaticPages::Site::
|
12
|
+
@page = StaticPages::Site::Firefox.new
|
13
|
+
@page.context StaticPages::Site::InputPage
|
14
|
+
@page.visit
|
7
15
|
end
|
8
16
|
|
9
17
|
Given /^I am on a page that has a textarea$/ do
|
10
|
-
@page = StaticPages::Site::
|
18
|
+
@page = StaticPages::Site::Firefox.new
|
19
|
+
@page.context StaticPages::Site::InputPage
|
20
|
+
@page.visit
|
11
21
|
end
|
12
22
|
|
13
23
|
Given /^I am on a page that has a checkbox$/ do
|
14
|
-
@page = StaticPages::Site::
|
24
|
+
@page = StaticPages::Site::Firefox.new
|
25
|
+
@page.context StaticPages::Site::InputPage
|
26
|
+
@page.visit
|
15
27
|
end
|
16
28
|
|
17
29
|
And /^There is a textfield with the text "(.*?)"$/ do |text|
|
@@ -2,48 +2,44 @@ Dir[File.dirname(__FILE__) + "/../../pages/*.rb"].each do |file|
|
|
2
2
|
require file
|
3
3
|
end
|
4
4
|
|
5
|
-
Given /^I am on a page that has a element$/ do
|
6
|
-
@page = StaticPages::Site::InputPage.new
|
7
|
-
end
|
8
|
-
|
9
5
|
Given /^that element is named as:$/ do |elements|
|
10
6
|
elements.raw.each do |name|
|
11
|
-
@page.send("#{name}_is_real?")
|
7
|
+
@page.send("#{name.first}_is_real?")
|
12
8
|
end
|
13
9
|
@elements = elements
|
14
10
|
end
|
15
11
|
|
16
12
|
Then /^I want click on this element$/ do
|
17
13
|
@elements.raw.each do |name|
|
18
|
-
@page.send("#{name}_click")
|
14
|
+
@page.send("#{name.first}_click")
|
19
15
|
end
|
20
16
|
@page.close
|
21
17
|
end
|
22
18
|
|
23
19
|
Then /^I want know if this element is visible$/ do
|
24
20
|
@elements.raw.each do |name|
|
25
|
-
@page.send("#{name}_is_visible?")
|
21
|
+
@page.send("#{name.first}_is_visible?")
|
26
22
|
end
|
27
23
|
@page.close
|
28
24
|
end
|
29
25
|
|
30
26
|
Then /^I want know if this element is enable$/ do
|
31
27
|
@elements.raw.each do |name|
|
32
|
-
@page.send("#{name}_is_enable?")
|
28
|
+
@page.send("#{name.first}_is_enable?")
|
33
29
|
end
|
34
30
|
@page.close
|
35
31
|
end
|
36
32
|
|
37
33
|
Then /^I want know if this element exists$/ do
|
38
34
|
@elements.raw.each do |name|
|
39
|
-
@page.send("#{name}_is_real?")
|
35
|
+
@page.send("#{name.first}_is_real?")
|
40
36
|
end
|
41
37
|
@page.close
|
42
38
|
end
|
43
39
|
|
44
40
|
Then /^I shoud be able to click with the right button in this element$/ do
|
45
41
|
@elements.raw.each do |name|
|
46
|
-
@page.send("#{name}_right_click")
|
42
|
+
@page.send("#{name.first}_right_click")
|
47
43
|
end
|
48
44
|
@page.close
|
49
45
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Given /^the textfield has the value "(.*?)"$/ do |value|
|
2
|
+
@page.text_field_fill_with(value)
|
3
|
+
@value == value
|
4
|
+
end
|
5
|
+
|
6
|
+
When /^I ask for the "(.*?)" of it element$/ do |att|
|
7
|
+
@text_value == @page.text_field_get(att)
|
8
|
+
end
|
9
|
+
|
10
|
+
Then /^I should see the value of it$/ do
|
11
|
+
@text_value.should == @value
|
12
|
+
@page.close
|
13
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
Dir[File.dirname(__FILE__) + "/../../pages/*.rb"].each do |file|
|
2
|
+
require file
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^I am on a page that has a radio group with the follow opitions:$/ do |radios|
|
6
|
+
@page = StaticPages::Site::Firefox.new
|
7
|
+
@page.context StaticPages::Site::InputPage
|
8
|
+
@page.visit
|
9
|
+
radios.raw.each do |radio|
|
10
|
+
@page.radios_contains(radio)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Given /^the option "(.*?)" is setted$/ do |option|
|
15
|
+
@page.radios_set(option)
|
16
|
+
@page.radios_checked_option_is?(option).should be_true
|
17
|
+
end
|
18
|
+
|
19
|
+
Then /^I should be able to know that the option "(.*?)" is setted$/ do |option|
|
20
|
+
@page.radios_checked_option?.should include(option)
|
21
|
+
end
|
22
|
+
|
23
|
+
Then /^I should be able to know if the option "(.*?)" is not setted$/ do |option|
|
24
|
+
@page.radios_checked_option_is_not?(option).should be_true
|
25
|
+
@page.close
|
26
|
+
end
|
27
|
+
|
28
|
+
Then /^I should fail when ask if the the option "(.*?)" is not setted$/ do |option|
|
29
|
+
@page.radios_checked_option_is_not?(option).should be_false
|
30
|
+
@page.close
|
31
|
+
end
|
32
|
+
|
33
|
+
Then /^I should be able to know if the option "(.*?)" is setted$/ do |option|
|
34
|
+
@page.radios_checked_option_is?(option).should be_true
|
35
|
+
@page.close
|
36
|
+
end
|
37
|
+
|
38
|
+
Then /^I should fail when ask if the option "(.*?)" is setted$/ do |option|
|
39
|
+
@page.radios_checked_option_is?(option).should be_false
|
40
|
+
@page.close
|
41
|
+
end
|
42
|
+
|
43
|
+
Then /^I should be able to know if there is some options setted$/ do
|
44
|
+
@page.radios_has_selected_option?.should be_true
|
45
|
+
@page.close
|
46
|
+
end
|
47
|
+
|
48
|
+
Then /^I should fail when ask if there is some options setted$/ do
|
49
|
+
@page.radios_has_selected_option?.should be_false
|
50
|
+
@page.close
|
51
|
+
end
|
52
|
+
|
53
|
+
Then /^I should be able to select the option "(.*?)"$/ do |option|
|
54
|
+
@page.radios_set(option)
|
55
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Given /^I am on a page that has a select$/ do
|
2
|
+
@page = StaticPages::Site::Firefox.new
|
3
|
+
@page.context StaticPages::Site::InputPage
|
4
|
+
@page.visit
|
5
|
+
end
|
6
|
+
|
7
|
+
Then /^I should be able to get the options available of it$/ do
|
8
|
+
@page.select_get_options.should == ["...","Cello","Cucumber","Ruby","Rspec","QA Rocks!"]
|
9
|
+
@page.close
|
10
|
+
end
|
11
|
+
|
12
|
+
Then /^I should be able to select an option on it$/ do
|
13
|
+
@page.select_select("Cucumber")
|
14
|
+
end
|
15
|
+
|
16
|
+
Then /^be sure that the option setted is the option selected$/ do
|
17
|
+
@page.select_is("Cucumber").should be_true
|
18
|
+
@page.close
|
19
|
+
end
|
20
|
+
|
21
|
+
Given /^the option "(.*?)" is selected$/ do |option|
|
22
|
+
@page.select_select option
|
23
|
+
end
|
24
|
+
|
25
|
+
Then /^I should be able to know the option "(.*?)" is selected$/ do |option|
|
26
|
+
@page.select_selected.should == option
|
27
|
+
@page.close
|
28
|
+
end
|
29
|
+
|
30
|
+
Then /^I should fail when ask if the option "(.*?)" is selected$/ do |option|
|
31
|
+
@page.select_selected.should_not == option
|
32
|
+
@page.close
|
33
|
+
end
|
34
|
+
|
35
|
+
Then /^I should be able to go to the default option of it$/ do
|
36
|
+
@page.select_clear
|
37
|
+
@page.select_selected.should == "..."
|
38
|
+
end
|
39
|
+
|
@@ -3,7 +3,7 @@ Dir[File.dirname(__FILE__) + "/../../pages/*.rb"].each do |file|
|
|
3
3
|
end
|
4
4
|
|
5
5
|
Then /^I should can knows if this page has a textarea$/ do
|
6
|
-
@page.textarea_is_real
|
6
|
+
@page.textarea_is_real?.should be_true
|
7
7
|
@page.close
|
8
8
|
end
|
9
9
|
|
@@ -13,31 +13,56 @@ Then /^I should be able to write a text like "(.*?)" in the textarea$/ do |text|
|
|
13
13
|
end
|
14
14
|
|
15
15
|
Then /^I shoud be able to get the text "(.*?)" from this textarea$/ do |text|
|
16
|
-
@page.textarea_get_text
|
16
|
+
@page.textarea_get_text.should include(text)
|
17
17
|
@page.close
|
18
18
|
end
|
19
19
|
|
20
20
|
Then /^I should be able to know if the text on the textarea does not contais the text "(.*?)"$/ do |text|
|
21
|
-
@page.textarea_dont_contain(text)
|
21
|
+
@page.textarea_dont_contain(text).should be_true
|
22
|
+
@page.close
|
23
|
+
end
|
24
|
+
|
25
|
+
Then /^I should fail when ask if the text on the textarea does not contais the text "(.*?)"$/ do |text|
|
26
|
+
@page.textarea_dont_contain(text).should be_false
|
22
27
|
@page.close
|
23
28
|
end
|
24
29
|
|
25
30
|
Then /^I should be able to know if the text on the textarea contais the text "(.*?)"$/ do |text|
|
26
|
-
@page.textarea_contains(text)
|
31
|
+
@page.textarea_contains(text).should be_true
|
32
|
+
@page.close
|
33
|
+
end
|
34
|
+
|
35
|
+
Then /^I should fail when ask if the text on the textarea contais the text "(.*?)"$/ do |text|
|
36
|
+
@page.textarea_contains(text).should be_false
|
37
|
+
@page.close
|
38
|
+
end
|
39
|
+
|
40
|
+
Then /^I should be able to know if the text on the textarea is exacly the text "(.*?)"$/ do |text|
|
41
|
+
@page.textarea_text_is(text).should be_true
|
27
42
|
@page.close
|
28
43
|
end
|
29
44
|
|
30
|
-
Then /^I should
|
31
|
-
@page.textarea_text_is(text)
|
45
|
+
Then /^I should fail when ask if the text on the textarea is exacly the text "(.*?)"$/ do |text|
|
46
|
+
@page.textarea_text_is(text).should be_false
|
32
47
|
@page.close
|
33
48
|
end
|
34
49
|
|
35
50
|
Then /^I should be able to know if the textarea is empty$/ do
|
36
|
-
@page.textarea_is_empty
|
51
|
+
@page.textarea_is_empty?.should be_true
|
52
|
+
@page.close
|
53
|
+
end
|
54
|
+
|
55
|
+
Then /^I should fail when ask if the textarea is empty$/ do
|
56
|
+
@page.textarea_is_empty?.should be_false
|
37
57
|
@page.close
|
38
58
|
end
|
39
59
|
|
40
60
|
Then /^I should be able to know if the size of the textarea text is "(.*?)"$/ do |size|
|
41
|
-
@page.textarea_text_size == size
|
61
|
+
@page.textarea_text_size.should == size.to_i
|
42
62
|
@page.close
|
43
63
|
end
|
64
|
+
|
65
|
+
Then /^I should fail when ask if the size of the textarea text is "(.*?)"$/ do |size|
|
66
|
+
@page.textarea_text_size.should_not == size.to_i
|
67
|
+
@page.close
|
68
|
+
end
|
@@ -2,42 +2,79 @@ Dir[File.dirname(__FILE__) + "/../../pages/*.rb"].each do |file|
|
|
2
2
|
require file
|
3
3
|
end
|
4
4
|
|
5
|
-
Then /^I should can knows if this page has a textfield$/ do
|
6
|
-
@page.
|
5
|
+
Then /^I should can knows if this page has a textfield named "(.*?)"$/ do |text_field_name|
|
6
|
+
@page.send("#{text_field_name}_is_real?").should be_true
|
7
|
+
@page.close
|
8
|
+
end
|
9
|
+
|
10
|
+
Then /^I should fail when ask if this page has a textfield named "(.*?)"$/ do |text_field_name|
|
11
|
+
@page.send("#{text_field_name}_is_real?").should be_false
|
7
12
|
@page.close
|
8
13
|
end
|
9
14
|
|
10
15
|
Then /^I should be able to write a text like "(.*?)" in the textfield$/ do |text|
|
11
16
|
@page.text_field_fill_with(text)
|
17
|
+
@page.text_field_get_text.should == text
|
12
18
|
@page.close
|
13
19
|
end
|
14
20
|
|
15
21
|
Then /^I shoud be able to get the text "(.*?)" from this textfield$/ do |text|
|
16
|
-
@page.text_field_get_text
|
22
|
+
@page.text_field_get_text.should include(text)
|
23
|
+
@page.close
|
24
|
+
end
|
25
|
+
|
26
|
+
Then /^I shoud fail to try get the text "(.*?)" from this textfield$/ do |text|
|
27
|
+
@page.text_field_get_text.should_not include(text)
|
17
28
|
@page.close
|
18
29
|
end
|
19
30
|
|
20
31
|
Then /^I should be able to know if the text on the textfield does not contais the text "(.*?)"$/ do |text|
|
21
|
-
@page.text_field_dont_contain(text)
|
32
|
+
@page.text_field_dont_contain(text).should be_true
|
33
|
+
@page.close
|
34
|
+
end
|
35
|
+
|
36
|
+
Then /^I should fail when ask if the text on the textfield does not contais the text "(.*?)"$/ do |text|
|
37
|
+
@page.text_field_dont_contain(text).should be_false
|
22
38
|
@page.close
|
23
39
|
end
|
24
40
|
|
25
41
|
Then /^I should be able to know if the text on the textfield contais the text "(.*?)"$/ do |text|
|
26
|
-
@page.text_field_contains(text)
|
42
|
+
@page.text_field_contains(text).should be_true
|
27
43
|
@page.close
|
28
44
|
end
|
29
45
|
|
30
|
-
Then /^I should
|
31
|
-
@page.
|
46
|
+
Then /^I should fail when ask if the text on the textfield contais the text "(.*?)"$/ do |text|
|
47
|
+
@page.text_field_contains(text).should be_false
|
48
|
+
@page.close
|
49
|
+
end
|
50
|
+
|
51
|
+
Then /^I should be able to know if the text on the textfield is exacly the text "(.*?)"$/ do |text|
|
52
|
+
@page.text_field_text_is(text).should be_true
|
53
|
+
@page.close
|
54
|
+
end
|
55
|
+
|
56
|
+
Then /^I should fail when ask if the text on the textfield is exacly the text "(.*?)"$/ do |text|
|
57
|
+
@page.text_field_text_is(text).should be_false
|
32
58
|
@page.close
|
33
59
|
end
|
34
60
|
|
35
61
|
Then /^I should be able to know if the textfield is empty$/ do
|
36
|
-
@page.text_field_is_empty
|
62
|
+
@page.text_field_is_empty?.should be_true
|
63
|
+
@page.close
|
64
|
+
end
|
65
|
+
|
66
|
+
Then /^I should fail when ask if the textfield is empty$/ do
|
67
|
+
@page.text_field_is_empty?.should be_false
|
37
68
|
@page.close
|
38
69
|
end
|
39
70
|
|
40
71
|
Then /^I should be able to know if the size of the textfield text is "(.*?)"$/ do |size|
|
41
|
-
@page.text_field_text_size == size
|
72
|
+
@page.text_field_text_size.should == size.to_i
|
73
|
+
@page.close
|
74
|
+
end
|
75
|
+
|
76
|
+
@wip
|
77
|
+
Then /^I should fail when ask if the size of the textfield text is "(.*?)"$/ do |size|
|
78
|
+
@page.text_field_text_size.should_not == size.to_i
|
42
79
|
@page.close
|
43
80
|
end
|
data/features/textarea.feature
CHANGED
@@ -6,6 +6,12 @@ Feature: Textarea
|
|
6
6
|
Given I am on a page that has a textarea
|
7
7
|
Then I should can knows if this page has a textarea
|
8
8
|
|
9
|
+
#TODO graceful fegradation
|
10
|
+
@pending
|
11
|
+
Scenario: Finding a textarea (counter proof)
|
12
|
+
Given I am on a page that has a textarea
|
13
|
+
Then I should fail when ask if this page has a textarea named "false_field"
|
14
|
+
|
9
15
|
Scenario: Setting a text on a textarea
|
10
16
|
Given I am on a page that has a textarea
|
11
17
|
Then I should be able to write a text like "Testing automation Rockst" in the textarea
|
@@ -23,26 +29,46 @@ Feature: Textarea
|
|
23
29
|
Scenario: The textarea does not contais the text (counter proof)
|
24
30
|
Given I am on a page that has a textarea
|
25
31
|
And There is a textarea with the text "Testing automation rocks"
|
26
|
-
Then I should
|
32
|
+
Then I should fail when ask if the text on the textarea does not contais the text "rocks"
|
27
33
|
|
28
34
|
Scenario: The textarea contains a text
|
29
35
|
Given I am on a page that has a textarea
|
30
36
|
And There is a textarea with the text "Testing automation rocks"
|
31
37
|
Then I should be able to know if the text on the textarea contais the text "rocks"
|
32
38
|
|
39
|
+
Scenario: The textarea contains a text (counter proof)
|
40
|
+
Given I am on a page that has a textarea
|
41
|
+
And There is a textarea with the text "Testing automation rocks"
|
42
|
+
Then I should fail when ask if the text on the textarea contais the text "foo barrrrrr"
|
43
|
+
|
33
44
|
Scenario: The text on a textarea is exactly some text
|
34
45
|
Given I am on a page that has a textarea
|
35
46
|
And There is a textarea with the text "Testing automation rocks"
|
36
|
-
Then I should be able to know if the text on the textarea is the text "Testing automation rocks"
|
47
|
+
Then I should be able to know if the text on the textarea is exacly the text "Testing automation rocks"
|
37
48
|
|
49
|
+
Scenario: The text on a textarea is exactly some text (counter prooF)
|
50
|
+
Given I am on a page that has a textarea
|
51
|
+
And There is a textarea with the text "Testing automation rocks"
|
52
|
+
Then I should fail when ask if the text on the textarea is exacly the text "rocks"
|
53
|
+
|
38
54
|
Scenario: The textarea is empty
|
39
55
|
Given I am on a page that has a textarea
|
40
56
|
Then I should be able to know if the textarea is empty
|
41
57
|
|
58
|
+
Scenario: The textarea is empty (counter proof)
|
59
|
+
Given I am on a page that has a textarea
|
60
|
+
And There is a textarea with the text "Testing automation rocks"
|
61
|
+
Then I should fail when ask if the textarea is empty
|
62
|
+
|
42
63
|
@pending
|
43
|
-
Scenario:
|
64
|
+
Scenario: textarea max lenght
|
44
65
|
|
45
|
-
Scenario: The lenght of a
|
66
|
+
Scenario: The lenght of a textarea text
|
46
67
|
Given I am on a page that has a textarea
|
47
68
|
And There is a textarea with the text "Testing automation rocks"
|
48
69
|
Then I should be able to know if the size of the textarea text is "24"
|
70
|
+
|
71
|
+
Scenario: The lenght of a textarea text (Counter Proof)
|
72
|
+
Given I am on a page that has a textarea
|
73
|
+
And There is a textarea with the text "Testing automation rocks"
|
74
|
+
Then I should fail when ask if the size of the textarea text is "42"
|
data/features/textfield.feature
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
Feature: Textfield
|
2
2
|
As a developer
|
3
3
|
I want to use textfield in different ways
|
4
|
-
|
4
|
+
|
5
5
|
Scenario: Finding a textfield
|
6
6
|
Given I am on a page that has a textfield
|
7
|
-
Then I should can knows if this page has a textfield
|
8
|
-
|
7
|
+
Then I should can knows if this page has a textfield named "text_field"
|
8
|
+
|
9
|
+
#TODO graceful fegradation
|
10
|
+
@pending
|
11
|
+
Scenario: Finding a textfield (counter proof)
|
12
|
+
Given I am on a page that has a textfield
|
13
|
+
Then I should fail when ask if this page has a textfield named "false_field"
|
14
|
+
|
9
15
|
Scenario: Setting a text on a textfield
|
10
16
|
Given I am on a page that has a textfield
|
11
17
|
Then I should be able to write a text like "Testing automation Rockst" in the textfield
|
@@ -15,6 +21,11 @@ Feature: Textfield
|
|
15
21
|
And There is a textfield with the text "Testing automation rocks"
|
16
22
|
Then I shoud be able to get the text "Testing automation rocks" from this textfield
|
17
23
|
|
24
|
+
Scenario: Getting the text from a textfield (counter proof)
|
25
|
+
Given I am on a page that has a textfield
|
26
|
+
And There is a textfield with the text "Testing automation rocks"
|
27
|
+
Then I shoud fail to try get the text "Fooo BAAARRR" from this textfield
|
28
|
+
|
18
29
|
Scenario: The textfield does not contais the text
|
19
30
|
Given I am on a page that has a textfield
|
20
31
|
And There is a textfield with the text "Testing automation rocks"
|
@@ -23,22 +34,37 @@ Feature: Textfield
|
|
23
34
|
Scenario: The textfield does not contais the text (counter proof)
|
24
35
|
Given I am on a page that has a textfield
|
25
36
|
And There is a textfield with the text "Testing automation rocks"
|
26
|
-
Then I should
|
37
|
+
Then I should fail when ask if the text on the textfield does not contais the text "rocks"
|
27
38
|
|
28
39
|
Scenario: The textfield contains a text
|
29
40
|
Given I am on a page that has a textfield
|
30
41
|
And There is a textfield with the text "Testing automation rocks"
|
31
42
|
Then I should be able to know if the text on the textfield contais the text "rocks"
|
32
43
|
|
44
|
+
Scenario: The textfield contains a text (counter proof)
|
45
|
+
Given I am on a page that has a textfield
|
46
|
+
And There is a textfield with the text "Testing automation rocks"
|
47
|
+
Then I should fail when ask if the text on the textfield contais the text "foo barrrrrr"
|
48
|
+
|
33
49
|
Scenario: The text on a textfield is exactly some text
|
34
50
|
Given I am on a page that has a textfield
|
35
51
|
And There is a textfield with the text "Testing automation rocks"
|
36
|
-
Then I should be able to know if the text on the textfield is the text "Testing automation rocks"
|
37
|
-
|
52
|
+
Then I should be able to know if the text on the textfield is exacly the text "Testing automation rocks"
|
53
|
+
|
54
|
+
Scenario: The text on a textfield is exactly some text (counter prooF)
|
55
|
+
Given I am on a page that has a textfield
|
56
|
+
And There is a textfield with the text "Testing automation rocks"
|
57
|
+
Then I should fail when ask if the text on the textfield is exacly the text "rocks"
|
58
|
+
|
38
59
|
Scenario: The textfield is empty
|
39
60
|
Given I am on a page that has a textfield
|
40
61
|
Then I should be able to know if the textfield is empty
|
41
62
|
|
63
|
+
Scenario: The textfield is empty (counter proof)
|
64
|
+
Given I am on a page that has a textfield
|
65
|
+
And There is a textfield with the text "Testing automation rocks"
|
66
|
+
Then I should fail when ask if the textfield is empty
|
67
|
+
|
42
68
|
@pending
|
43
69
|
Scenario: Textfield max lenght
|
44
70
|
|
@@ -47,3 +73,7 @@ Feature: Textfield
|
|
47
73
|
And There is a textfield with the text "Testing automation rocks"
|
48
74
|
Then I should be able to know if the size of the textfield text is "24"
|
49
75
|
|
76
|
+
Scenario: The lenght of a Textfield text (counter proof)
|
77
|
+
Given I am on a page that has a textfield
|
78
|
+
And There is a textfield with the text "Testing automation rocks"
|
79
|
+
Then I should fail when ask if the size of the textfield text is "26"
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "watir-webdriver"
|
3
|
+
require "headless"
|
4
|
+
|
5
|
+
module Cello
|
6
|
+
module Structure
|
7
|
+
class Browser
|
8
|
+
attr_accessor :context
|
9
|
+
attr_reader :browser
|
10
|
+
|
11
|
+
def initialize(browser)
|
12
|
+
@headless = Headless.new
|
13
|
+
@headless.start
|
14
|
+
@browser = Watir::Browser.new browser
|
15
|
+
end
|
16
|
+
|
17
|
+
def visit
|
18
|
+
@browser.goto @context.get_url
|
19
|
+
end
|
20
|
+
|
21
|
+
def context(page)
|
22
|
+
@context = page.new(@browser)
|
23
|
+
end
|
24
|
+
|
25
|
+
def search(text)
|
26
|
+
@browser.text.include? text
|
27
|
+
end
|
28
|
+
|
29
|
+
def close
|
30
|
+
@browser.close
|
31
|
+
@headless.destroy
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_screenshot
|
35
|
+
@browser.driver.save_screenshot 'screenshot.png'
|
36
|
+
end
|
37
|
+
|
38
|
+
def title
|
39
|
+
@browser.title
|
40
|
+
end
|
41
|
+
|
42
|
+
def response_time
|
43
|
+
#pending
|
44
|
+
end
|
45
|
+
|
46
|
+
def method_missing(method_name, *arguments)
|
47
|
+
@context.send(method_name, *arguments)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
File without changes
|
File without changes
|
File without changes
|
@@ -6,18 +6,18 @@ module Cello
|
|
6
6
|
module Structure
|
7
7
|
module ElementHelper
|
8
8
|
|
9
|
+
private
|
10
|
+
|
9
11
|
def element(name, type, *args)
|
10
12
|
class_eval do
|
11
13
|
define_method name do
|
12
|
-
browser.send(type, *args)
|
14
|
+
parent.browser.send(type, *args)
|
13
15
|
end
|
14
16
|
|
15
17
|
define_extras(name, type)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
protected
|
20
|
-
|
21
21
|
def define_extras(name, type)
|
22
22
|
define_method "#{name}_is_real?" do
|
23
23
|
send(name).exists?
|
@@ -35,12 +35,17 @@ module Cello
|
|
35
35
|
send(name).right_click
|
36
36
|
end
|
37
37
|
|
38
|
+
define_method "#{name}_get" do |att|
|
39
|
+
send(name).attribute_value(att)
|
40
|
+
end
|
41
|
+
|
38
42
|
method_name = "define_extras_for_#{type}"
|
39
43
|
send(method_name, name) if respond_to? method_name
|
40
44
|
end
|
41
45
|
|
42
46
|
include CheckboxHelper
|
43
47
|
include TextfieldHelper
|
48
|
+
include TextareaHelper
|
44
49
|
include SelectHelper
|
45
50
|
include DivHelper
|
46
51
|
include RadioHelper
|
File without changes
|
File without changes
|