symbiont 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +22 -7
- data/HISTORY.md +6 -0
- data/app/public/css/site.css +16 -0
- data/app/public/js/site.js +3 -1
- data/app/views/comics.erb +23 -1
- data/app/views/webobject.erb +1 -1
- data/lib/symbiont/data_setter.rb +7 -3
- data/lib/symbiont/enclosers.rb +24 -27
- data/lib/symbiont/evaluators.rb +52 -23
- data/lib/symbiont/factory.rb +19 -75
- data/lib/symbiont/generators.rb +172 -44
- data/lib/symbiont/platform_watir/platform_object.rb +202 -18
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont/web_objects/button.rb +1 -1
- data/lib/symbiont/web_objects/checkbox.rb +1 -1
- data/lib/symbiont/web_objects/heading.rb +12 -0
- data/lib/symbiont/web_objects/hidden_field.rb +19 -0
- data/lib/symbiont/web_objects/label.rb +15 -0
- data/lib/symbiont/web_objects/list_item.rb +13 -0
- data/lib/symbiont/web_objects/ordered_list.rb +49 -0
- data/lib/symbiont/web_objects/radio.rb +1 -1
- data/lib/symbiont/web_objects/select_list.rb +1 -1
- data/lib/symbiont/web_objects/table.rb +4 -0
- data/lib/symbiont/web_objects/table_row.rb +4 -0
- data/lib/symbiont/web_objects/text_area.rb +26 -0
- data/lib/symbiont/web_objects/unordered_list.rb +49 -0
- data/lib/symbiont.rb +7 -0
- data/lucid.yml +6 -0
- data/spec/spec_helper.rb +70 -16
- data/spec/symbiont/data_setter_spec.rb +65 -62
- data/spec/symbiont/enclosers_spec.rb +76 -57
- data/spec/symbiont/evaluators_spec.rb +95 -75
- data/spec/symbiont/factory_spec.rb +174 -122
- data/spec/symbiont/generators/button_generators_spec.rb +34 -31
- data/spec/symbiont/generators/checkbox_generators_spec.rb +79 -75
- data/spec/symbiont/generators/div_generators_spec.rb +56 -52
- data/spec/symbiont/generators/hidden_field_generators_spec.rb +65 -0
- data/spec/symbiont/generators/link_generators_spec.rb +30 -27
- data/spec/symbiont/generators/paragraph_generators_spec.rb +22 -17
- data/spec/symbiont/generators/radio_generators_spec.rb +76 -77
- data/spec/symbiont/generators/select_list_generators_spec.rb +93 -77
- data/spec/symbiont/generators/span_generators_spec.rb +56 -52
- data/spec/symbiont/generators/{cell_generators_spec.rb → table_cell_generators_spec.rb} +56 -52
- data/spec/symbiont/generators/table_generators_spec.rb +56 -52
- data/spec/symbiont/generators/text_area_generators_spec.rb +72 -0
- data/spec/symbiont/generators/text_field_generators_spec.rb +30 -27
- data/spec/symbiont/generators_spec.rb +38 -28
- data/spec/symbiont/locators_spec.rb +68 -68
- data/spec/symbiont/platform_object_spec.rb +2 -4
- data/spec/symbiont/symbiont_spec.rb +10 -8
- data/spec/symbiont/web_object_spec.rb +194 -194
- data/spec/symbiont/web_objects/button_spec.rb +38 -30
- data/spec/symbiont/web_objects/checkbox_spec.rb +27 -27
- data/spec/symbiont/web_objects/div_spec.rb +18 -11
- data/spec/symbiont/web_objects/heading_spec.rb +22 -0
- data/spec/symbiont/web_objects/hidden_field_spec.rb +18 -0
- data/spec/symbiont/web_objects/label_spec.rb +18 -0
- data/spec/symbiont/web_objects/link_spec.rb +33 -33
- data/spec/symbiont/web_objects/list_item_spec.rb +18 -0
- data/spec/symbiont/web_objects/option_spec.rb +9 -9
- data/spec/symbiont/web_objects/ordered_list_spec.rb +53 -0
- data/spec/symbiont/web_objects/paragraph_spec.rb +9 -2
- data/spec/symbiont/web_objects/radio_spec.rb +27 -27
- data/spec/symbiont/web_objects/select_list_spec.rb +69 -69
- data/spec/symbiont/web_objects/span_spec.rb +18 -11
- data/spec/symbiont/web_objects/table_cell_spec.rb +19 -19
- data/spec/symbiont/web_objects/table_row_spec.rb +58 -58
- data/spec/symbiont/web_objects/table_spec.rb +61 -61
- data/spec/symbiont/web_objects/text_area_spec.rb +18 -0
- data/spec/symbiont/web_objects/text_field_spec.rb +39 -39
- data/spec/symbiont/web_objects/unordered_list_spec.rb +51 -0
- data/specs/common/support/browser.rb +25 -0
- data/specs/common/support/env.rb +6 -0
- data/specs/common/support/events.rb +15 -0
- data/specs/enclosers.feature +9 -0
- data/specs/evaluators.feature +26 -0
- data/specs/pages/characters.rb +22 -0
- data/specs/pages/home.rb +9 -0
- data/specs/pages/stardate.rb +23 -0
- data/specs/pages/web_objects.rb +77 -0
- data/specs/select_list.feature +53 -0
- data/specs/steps/enclosers_steps.rb +17 -0
- data/specs/steps/evaluators_steps.rb +44 -0
- data/specs/steps/navigation_steps.rb +14 -0
- data/specs/steps/select_list_steps.rb +94 -0
- data/specs/steps/table_cell_steps.rb +31 -0
- data/specs/steps/table_steps.rb +87 -0
- data/specs/table.feature +49 -0
- data/specs/table_cell.feature +27 -0
- data/symbiont.gemspec +4 -1
- metadata +72 -6
- data/cucumber.yml +0 -6
@@ -0,0 +1,12 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class Heading < WebObject
|
5
|
+
|
6
|
+
end # class: Heading
|
7
|
+
|
8
|
+
::Symbiont::WebObjects.class_for_tag[:h1] = ::Symbiont::WebObjects::Heading
|
9
|
+
::Symbiont::WebObjects.class_for_tag[:h2] = ::Symbiont::WebObjects::Heading
|
10
|
+
|
11
|
+
end # module: WebObjects
|
12
|
+
end # module: Symbiont
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class HiddenField < WebObject
|
5
|
+
|
6
|
+
def initialize(web_object)
|
7
|
+
@web_object = web_object
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.usable_selectors
|
11
|
+
super + [:text, :value]
|
12
|
+
end
|
13
|
+
|
14
|
+
end # class: HiddenField
|
15
|
+
|
16
|
+
::Symbiont::WebObjects.class_for_tag[:hidden] = ::Symbiont::WebObjects::HiddenField
|
17
|
+
|
18
|
+
end # module: WebObjects
|
19
|
+
end # module: Symbiont
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class Label < WebObject
|
5
|
+
|
6
|
+
def self.usable_selectors
|
7
|
+
super + [:text]
|
8
|
+
end
|
9
|
+
|
10
|
+
end # class: Label
|
11
|
+
|
12
|
+
::Symbiont::WebObjects.class_for_tag[:label] = ::Symbiont::WebObjects::Label
|
13
|
+
|
14
|
+
end # module: WebObjects
|
15
|
+
end # module: Symbiont
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class ListItem < WebObject
|
5
|
+
def self.usable_selectors
|
6
|
+
super + [:text]
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
::Symbiont::WebObjects.class_for_tag[:li] = ::Symbiont::WebObjects::ListItem
|
11
|
+
|
12
|
+
end # module: WebObjects
|
13
|
+
end # module: Symbiont
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class OrderedList < WebObject
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
def initialize(web_object)
|
8
|
+
@web_object = web_object
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Symbiont::WebObjects::ListItem]
|
12
|
+
def [](index)
|
13
|
+
::Symbiont::WebObjects::ListItem.new(children[index])
|
14
|
+
end
|
15
|
+
|
16
|
+
# Return the number of list items contained in the ordered list.
|
17
|
+
def items
|
18
|
+
children.size
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Symbiont::WebObjects::ListItem]
|
22
|
+
def each
|
23
|
+
for index in 1..self.items do
|
24
|
+
yield self[index - 1]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
def list_item_xpath
|
31
|
+
".//child::li"
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def children
|
37
|
+
list_items.find_all { |item| item.parent == web_object }
|
38
|
+
end
|
39
|
+
|
40
|
+
def list_items
|
41
|
+
web_object.ols(:xpath => list_item_xpath)
|
42
|
+
end
|
43
|
+
|
44
|
+
end # class: OrderedList
|
45
|
+
|
46
|
+
::Symbiont::WebObjects.class_for_tag[:ol] = ::Symbiont::WebObjects::OrderedList
|
47
|
+
|
48
|
+
end # module: WebObjects
|
49
|
+
end # module: Symbiont
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class TextArea < WebObject
|
5
|
+
def initialize(web_object)
|
6
|
+
@web_object = web_object
|
7
|
+
end
|
8
|
+
|
9
|
+
def value=(value)
|
10
|
+
web_object.set value
|
11
|
+
end
|
12
|
+
|
13
|
+
def clear
|
14
|
+
web_object.wd.clear
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.usable_selectors
|
18
|
+
super + [:title, :value, :text, :label]
|
19
|
+
end
|
20
|
+
|
21
|
+
end # class: TextArea
|
22
|
+
|
23
|
+
::Symbiont::WebObjects.class_for_tag[:textarea] = ::Symbiont::WebObjects::TextArea
|
24
|
+
|
25
|
+
end # module: WebObjects
|
26
|
+
end # module: Symbiont
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class UnorderedList < WebObject
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
def initialize(web_object)
|
8
|
+
@web_object = web_object
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Symbiont::WebObjects::ListItem]
|
12
|
+
def [](index)
|
13
|
+
::Symbiont::WebObjects::ListItem.new(children[index])
|
14
|
+
end
|
15
|
+
|
16
|
+
# Return the number of list items contained in the ordered list.
|
17
|
+
def items
|
18
|
+
children.size
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Symbiont::WebObjects::ListItem]
|
22
|
+
def each
|
23
|
+
for index in 1..self.items do
|
24
|
+
yield self[index - 1]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
def list_item_xpath
|
31
|
+
".//child::li"
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def children
|
37
|
+
list_items.find_all { |item| item.parent == web_object }
|
38
|
+
end
|
39
|
+
|
40
|
+
def list_items
|
41
|
+
web_object.uls(:xpath => list_item_xpath)
|
42
|
+
end
|
43
|
+
|
44
|
+
end # class: UnorderedList
|
45
|
+
|
46
|
+
::Symbiont::WebObjects.class_for_tag[:ul] = ::Symbiont::WebObjects::UnorderedList
|
47
|
+
|
48
|
+
end # module: WebObjects
|
49
|
+
end # module: Symbiont
|
data/lib/symbiont.rb
CHANGED
@@ -82,4 +82,11 @@ module Symbiont
|
|
82
82
|
@platform = get_platform_for(browser)
|
83
83
|
end
|
84
84
|
|
85
|
+
# This method processes a block with single or multiple parameters.
|
86
|
+
#
|
87
|
+
# @param [Proc] block the block to process
|
88
|
+
def process_block(&block)
|
89
|
+
block.arity == 1 ? block.call(self) : self.instance_eval(&block)
|
90
|
+
end
|
91
|
+
|
85
92
|
end
|
data/lucid.yml
ADDED
data/spec/spec_helper.rb
CHANGED
@@ -14,25 +14,79 @@ require 'symbiont'
|
|
14
14
|
class DefinitionTest
|
15
15
|
include Symbiont
|
16
16
|
|
17
|
-
url_is "http://localhost:
|
18
|
-
begin_at "http://localhost:
|
19
|
-
|
20
|
-
|
21
|
-
look_for :
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
url_is "http://localhost:9292"
|
18
|
+
begin_at "http://localhost:9292"
|
19
|
+
title_is "Symbiote"
|
20
|
+
|
21
|
+
look_for :name
|
22
|
+
|
23
|
+
text_field :name, id: "name"
|
24
|
+
text_field :email do |element|
|
25
|
+
"email"
|
26
|
+
end
|
27
|
+
|
28
|
+
text_area :summary, id: "summary"
|
29
|
+
text_area :description do |element|
|
30
|
+
"description"
|
31
|
+
end
|
32
|
+
|
33
|
+
hidden_field :ssn, id: "ssn"
|
34
|
+
hidden_field :visa do |element|
|
35
|
+
"visa"
|
36
|
+
end
|
37
|
+
|
38
|
+
paragraph :first, id: "first"
|
39
|
+
p :last, id: "last"
|
40
|
+
paragraph :middle do |element|
|
41
|
+
"middle"
|
42
|
+
end
|
43
|
+
|
44
|
+
link :welcome, id: "welcome"
|
45
|
+
link :greetings do |element|
|
46
|
+
"greetings"
|
47
|
+
end
|
48
|
+
|
49
|
+
button :login, id: "login"
|
50
|
+
button :logout do |element|
|
51
|
+
"logout"
|
52
|
+
end
|
53
|
+
|
54
|
+
checkbox :apply_tax, id: "apply_tax"
|
55
|
+
checkbox :apply_fee do |element|
|
56
|
+
"apply_fee"
|
57
|
+
end
|
58
|
+
|
26
59
|
select_list :concepts, id: "concepts"
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
60
|
+
select_list :topics do |element|
|
61
|
+
"topics"
|
62
|
+
end
|
63
|
+
|
64
|
+
radio :include_tax, id: "include_tax"
|
65
|
+
radio :include_fee do |element|
|
66
|
+
"include_fee"
|
67
|
+
end
|
68
|
+
|
32
69
|
div :section, id: "section"
|
70
|
+
div :aside do |element|
|
71
|
+
"aside"
|
72
|
+
end
|
73
|
+
|
33
74
|
span :inline, id: "inline"
|
34
|
-
|
35
|
-
|
75
|
+
span :part do |element|
|
76
|
+
"part"
|
77
|
+
end
|
78
|
+
|
79
|
+
table :accounts, id: "accounts"
|
80
|
+
table :invoices do |element|
|
81
|
+
"invoices"
|
82
|
+
end
|
83
|
+
|
84
|
+
cell :total, id: "total"
|
85
|
+
cell :sum do |element|
|
86
|
+
"sum"
|
87
|
+
end
|
88
|
+
|
89
|
+
frame(id: "frame") do |frame|
|
36
90
|
text_field :framedLoginName, id: "framedLoginName", frame: frame
|
37
91
|
end
|
38
92
|
end
|
@@ -1,62 +1,65 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Symbiont::DataSetter do
|
4
|
-
|
5
|
-
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
watir_definition.should_receive(:object_enabled_for).and_return(true)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
it "should not set data in a non-existent text field" do
|
14
|
-
watir_browser.should_not_receive(:text_field)
|
15
|
-
watir_definition.using('fake_field' => 'fake data')
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should not set data in a disabled text field" do
|
19
|
-
watir_definition.should_not_receive(:
|
20
|
-
watir_definition.should_receive(:
|
21
|
-
watir_browser.should_receive(:enabled?).and_return(false)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
watir_definition.should_receive(:
|
28
|
-
watir_definition.
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
watir_definition.should_receive(:
|
34
|
-
watir_definition.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
watir_definition.should_receive(:
|
40
|
-
watir_definition.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
watir_definition.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
watir_definition.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
watir_definition.
|
61
|
-
|
62
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::DataSetter do
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
|
+
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
+
|
7
|
+
it "should set data in a text field" do
|
8
|
+
watir_definition.should_receive(:name=).with('jnyman')
|
9
|
+
watir_definition.should_receive(:object_enabled_for).and_return(true)
|
10
|
+
watir_definition.using('name' => 'jnyman')
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should not set data in a non-existent text field" do
|
14
|
+
watir_browser.should_not_receive(:text_field)
|
15
|
+
watir_definition.using('fake_field' => 'fake data')
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should not set data in a disabled text field" do
|
19
|
+
watir_definition.should_not_receive(:name=)
|
20
|
+
watir_definition.should_receive(:name_object).twice.and_return(watir_browser)
|
21
|
+
watir_browser.should_receive(:enabled?).and_return(false)
|
22
|
+
watir_browser.should_receive(:tag_name).with(no_args)
|
23
|
+
watir_definition.using('name' => 'test data')
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should set data in a select list field" do
|
27
|
+
watir_definition.should_receive(:concepts=).with('physics')
|
28
|
+
watir_definition.should_receive(:object_enabled_for).and_return(true)
|
29
|
+
watir_definition.using('concepts' => 'physics')
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should check a checkbox field" do
|
33
|
+
watir_definition.should_receive(:check_apply_tax)
|
34
|
+
watir_definition.should_receive(:object_enabled_for).and_return(true)
|
35
|
+
watir_definition.using('apply_tax' => true)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should uncheck a checkbox field" do
|
39
|
+
watir_definition.should_receive(:uncheck_apply_tax)
|
40
|
+
watir_definition.should_receive(:object_enabled_for).and_return(true)
|
41
|
+
watir_definition.using('apply_tax' => false)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should not check data in a disabled checkbox field" do
|
45
|
+
watir_definition.should_not_receive(:check_apply_tax)
|
46
|
+
watir_definition.should_receive(:apply_tax_object).twice.and_return(watir_browser)
|
47
|
+
watir_browser.should_receive(:enabled?).and_return(false)
|
48
|
+
watir_browser.should_receive(:tag_name).with(no_args)
|
49
|
+
watir_definition.using('apply_tax' => true)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should select a radio field" do
|
53
|
+
watir_definition.should_receive(:select_include_tax)
|
54
|
+
watir_definition.should_receive(:object_enabled_for).and_return(true)
|
55
|
+
watir_definition.using('include_tax' => true)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should not select data in a disable radio field" do
|
59
|
+
watir_definition.should_not_receive(:select_include_tax)
|
60
|
+
watir_definition.should_receive(:include_tax_object).twice.and_return(watir_browser)
|
61
|
+
watir_browser.should_receive(:enabled?).and_return(false)
|
62
|
+
watir_browser.should_receive(:tag_name).with(no_args)
|
63
|
+
watir_definition.using('include_tax' => true)
|
64
|
+
end
|
65
|
+
end
|
@@ -1,57 +1,76 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe Symbiont::Enclosers do
|
4
|
-
let(:watir_browser) { mock_browser_for_watir }
|
5
|
-
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
-
|
7
|
-
context "a definition using watir-webdriver" do
|
8
|
-
it "should
|
9
|
-
watir_browser.should_receive(:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should
|
20
|
-
watir_browser.should_receive(:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
watir_browser.should_receive(:
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should
|
32
|
-
watir_browser.should_receive(:
|
33
|
-
watir_browser.should_receive(:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
watir_browser.should_receive(:
|
53
|
-
watir_browser.should_receive(:
|
54
|
-
watir_definition.
|
55
|
-
|
56
|
-
|
57
|
-
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Symbiont::Enclosers do
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
|
+
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
+
|
7
|
+
context "a definition using watir-webdriver" do
|
8
|
+
it "should wait for a condition to be true" do
|
9
|
+
watir_browser.should_receive(:wait_until).with(5, "some condition")
|
10
|
+
watir_definition.wait_for(5, "some condition")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should wait for a condition to be true with any page level timeout" do
|
14
|
+
Symbiont.page_level_wait = 30
|
15
|
+
watir_browser.should_receive(:wait_until).with(30, nil)
|
16
|
+
watir_definition.wait_for
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to attach to a window by using the title" do
|
20
|
+
watir_browser.should_receive(:window).with(:title => /Display\ Results/).and_return(watir_browser)
|
21
|
+
watir_browser.should_receive(:use)
|
22
|
+
watir_definition.within_window(title: "Display Results")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should be able to attach to a window by using the url" do
|
26
|
+
watir_browser.should_receive(:window).with(:url => /results\.html/).and_return(watir_browser)
|
27
|
+
watir_browser.should_receive(:use)
|
28
|
+
watir_definition.within_window(url: "results.html")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should allow frames to act as a context" do
|
32
|
+
watir_browser.should_receive(:frame).with(id: "frame").and_return(watir_browser)
|
33
|
+
watir_browser.should_receive(:text_field).and_return(watir_browser)
|
34
|
+
watir_browser.should_receive(:wd).and_return(watir_browser)
|
35
|
+
watir_browser.should_receive(:switch_to).and_return(watir_browser)
|
36
|
+
watir_browser.should_receive(:default_content).and_return(watir_browser)
|
37
|
+
web_object = watir_definition.framedLoginName_text_field
|
38
|
+
web_object.should_not be_nil
|
39
|
+
web_object.should be_instance_of Symbiont::WebObjects::TextField
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should be able to convert a modal popup to a window" do
|
43
|
+
watir_browser.should_receive(:execute_script)
|
44
|
+
watir_definition.within_modal {}
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should handle alert message boxes" do
|
48
|
+
#watir_browser.should_receive(:wd).twice.and_return(watir_browser)
|
49
|
+
#watir_browser.should_receive(:execute_script).twice
|
50
|
+
watir_browser.should_receive(:alert).exactly(3).times.and_return(watir_browser)
|
51
|
+
watir_browser.should_receive(:exists?).and_return(true)
|
52
|
+
watir_browser.should_receive(:text)
|
53
|
+
watir_browser.should_receive(:ok)
|
54
|
+
watir_definition.will_alert do
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should handle confirmation message boxes" do
|
59
|
+
#watir_browser.should_receive(:wd).twice.and_return(watir_browser)
|
60
|
+
#watir_browser.should_receive(:execute_script).twice
|
61
|
+
watir_browser.should_receive(:alert).exactly(3).times.and_return(watir_browser)
|
62
|
+
watir_browser.should_receive(:exists?).and_return(true)
|
63
|
+
watir_browser.should_receive(:text)
|
64
|
+
watir_browser.should_receive(:ok)
|
65
|
+
watir_definition.will_confirm(true) do
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should handle prompt message boxes" do
|
70
|
+
watir_browser.should_receive(:wd).twice.and_return(watir_browser)
|
71
|
+
watir_browser.should_receive(:execute_script).twice
|
72
|
+
watir_definition.will_prompt("Question") do
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|