symbiont 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +22 -22
- data/.travis.yml +25 -14
- data/Gemfile +4 -2
- data/{LICENSE → LICENSE.txt} +22 -22
- data/README.md +57 -65
- data/Rakefile +28 -34
- data/lib/symbiont/accessor.rb +7 -0
- data/lib/symbiont/assertions.rb +33 -0
- data/lib/symbiont/elements.rb +69 -0
- data/lib/symbiont/errors.rb +7 -0
- data/lib/symbiont/factory.rb +75 -46
- data/lib/symbiont/helpers.rb +49 -0
- data/lib/symbiont/logging.rb +5 -0
- data/lib/symbiont/pages.rb +32 -0
- data/lib/symbiont/platform.rb +12 -0
- data/lib/symbiont/version.rb +3 -3
- data/lib/symbiont.rb +34 -92
- data/spec/fixtures/element_definitions.rb +32 -0
- data/spec/fixtures/mock_drivers.rb +8 -0
- data/spec/fixtures/page_definitions.rb +36 -0
- data/spec/spec_helper.rb +31 -80
- data/spec/symbiont/assertion_spec.rb +88 -0
- data/spec/symbiont/driver_spec.rb +41 -0
- data/spec/symbiont/element_spec.rb +8 -0
- data/spec/symbiont/factory_spec.rb +70 -130
- data/spec/symbiont/page_spec.rb +50 -0
- data/symbiont.gemspec +52 -27
- data/test/symbiont-script.rb +97 -0
- metadata +89 -230
- data/Gemfile.lock +0 -44
- data/HISTORY.md +0 -99
- data/app/app.rb +0 -48
- data/app/public/css/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_flat_15_cd0a0a_40x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_glass_50_3baae3_1x400.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_3d80b3_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/public/css/cupertino/jquery-ui-1.8.16.custom.css +0 -290
- data/app/public/css/demo_table_jui.css +0 -471
- data/app/public/css/font/ColabLig-webfont.eot +0 -0
- data/app/public/css/font/ColabLig-webfont.svg +0 -149
- data/app/public/css/font/ColabLig-webfont.ttf +0 -0
- data/app/public/css/font/ColabLig-webfont.woff +0 -0
- data/app/public/css/font/ColabMed-webfont.eot +0 -0
- data/app/public/css/font/ColabMed-webfont.svg +0 -149
- data/app/public/css/font/ColabMed-webfont.ttf +0 -0
- data/app/public/css/font/ColabMed-webfont.woff +0 -0
- data/app/public/css/font/ColabReg-webfont.eot +0 -0
- data/app/public/css/font/ColabReg-webfont.svg +0 -149
- data/app/public/css/font/ColabReg-webfont.ttf +0 -0
- data/app/public/css/font/ColabReg-webfont.woff +0 -0
- data/app/public/css/font/ColabThi-webfont.eot +0 -0
- data/app/public/css/font/ColabThi-webfont.svg +0 -149
- data/app/public/css/font/ColabThi-webfont.ttf +0 -0
- data/app/public/css/font/ColabThi-webfont.woff +0 -0
- data/app/public/css/normalize.css +0 -376
- data/app/public/css/site.css +0 -446
- data/app/public/fancybox/blank.gif +0 -0
- data/app/public/fancybox/fancy_close.png +0 -0
- data/app/public/fancybox/fancy_loading.png +0 -0
- data/app/public/fancybox/fancy_nav_left.png +0 -0
- data/app/public/fancybox/fancy_nav_right.png +0 -0
- data/app/public/fancybox/fancy_shadow_e.png +0 -0
- data/app/public/fancybox/fancy_shadow_n.png +0 -0
- data/app/public/fancybox/fancy_shadow_ne.png +0 -0
- data/app/public/fancybox/fancy_shadow_nw.png +0 -0
- data/app/public/fancybox/fancy_shadow_s.png +0 -0
- data/app/public/fancybox/fancy_shadow_se.png +0 -0
- data/app/public/fancybox/fancy_shadow_sw.png +0 -0
- data/app/public/fancybox/fancy_shadow_w.png +0 -0
- data/app/public/fancybox/fancy_title_left.png +0 -0
- data/app/public/fancybox/fancy_title_main.png +0 -0
- data/app/public/fancybox/fancy_title_over.png +0 -0
- data/app/public/fancybox/fancy_title_right.png +0 -0
- data/app/public/fancybox/fancybox-x.png +0 -0
- data/app/public/fancybox/fancybox-y.png +0 -0
- data/app/public/fancybox/fancybox.png +0 -0
- data/app/public/fancybox/jquery.fancybox-1.3.4.css +0 -359
- data/app/public/fancybox/jquery.fancybox-1.3.4.js +0 -1156
- data/app/public/fancybox/jquery.fancybox-1.3.4.min.js +0 -1
- data/app/public/img/Sorting icons.psd +0 -0
- data/app/public/img/back_disabled.png +0 -0
- data/app/public/img/back_enabled.png +0 -0
- data/app/public/img/back_enabled_hover.png +0 -0
- data/app/public/img/close.png +0 -0
- data/app/public/img/favicon.ico +0 -0
- data/app/public/img/forward_disabled.png +0 -0
- data/app/public/img/forward_enabled.png +0 -0
- data/app/public/img/forward_enabled_hover.png +0 -0
- data/app/public/img/lucid-bg.png +0 -0
- data/app/public/img/lucid-ft.png +0 -0
- data/app/public/img/open.png +0 -0
- data/app/public/img/sort_asc.png +0 -0
- data/app/public/img/sort_asc_disabled.png +0 -0
- data/app/public/img/sort_both.png +0 -0
- data/app/public/img/sort_desc.png +0 -0
- data/app/public/img/sort_desc_disabled.png +0 -0
- data/app/public/js/comics.js +0 -11
- data/app/public/js/signup.js +0 -141
- data/app/public/js/site.js +0 -42
- data/app/public/js/stardate.js +0 -35
- data/app/public/js/vendor/html5shiv.js +0 -5
- data/app/public/js/vendor/jquery-1.8.3.min.js +0 -2
- data/app/public/js/vendor/jquery.dataTables.min.js +0 -151
- data/app/public/js/vendor/jquery.validate.min.js +0 -4
- data/app/views/comics.erb +0 -344
- data/app/views/index.erb +0 -7
- data/app/views/layout.erb +0 -72
- data/app/views/layout_small.erb +0 -21
- data/app/views/stardate.erb +0 -5
- data/app/views/stardate_calc.erb +0 -30
- data/app/views/webobject.erb +0 -147
- data/lib/symbiont/data_setter.rb +0 -53
- data/lib/symbiont/enclosers.rb +0 -118
- data/lib/symbiont/evaluators.rb +0 -92
- data/lib/symbiont/generators.rb +0 -331
- data/lib/symbiont/locators.rb +0 -43
- data/lib/symbiont/logger.rb +0 -5
- data/lib/symbiont/platform_watir/platform_object.rb +0 -466
- data/lib/symbiont/platform_watir.rb +0 -9
- data/lib/symbiont/platforms.rb +0 -23
- data/lib/symbiont/web_objects/_common.rb +0 -174
- data/lib/symbiont/web_objects/button.rb +0 -22
- data/lib/symbiont/web_objects/checkbox.rb +0 -31
- data/lib/symbiont/web_objects/div.rb +0 -15
- data/lib/symbiont/web_objects/heading.rb +0 -12
- data/lib/symbiont/web_objects/hidden_field.rb +0 -19
- data/lib/symbiont/web_objects/label.rb +0 -15
- data/lib/symbiont/web_objects/link.rb +0 -23
- data/lib/symbiont/web_objects/list_item.rb +0 -13
- data/lib/symbiont/web_objects/option.rb +0 -10
- data/lib/symbiont/web_objects/ordered_list.rb +0 -49
- data/lib/symbiont/web_objects/paragraph.rb +0 -11
- data/lib/symbiont/web_objects/radio.rb +0 -31
- data/lib/symbiont/web_objects/select_list.rb +0 -82
- data/lib/symbiont/web_objects/span.rb +0 -15
- data/lib/symbiont/web_objects/table.rb +0 -71
- data/lib/symbiont/web_objects/table_cell.rb +0 -24
- data/lib/symbiont/web_objects/table_row.rb +0 -59
- data/lib/symbiont/web_objects/text_area.rb +0 -26
- data/lib/symbiont/web_objects/text_field.rb +0 -31
- data/lib/symbiont/web_objects/unordered_list.rb +0 -49
- data/lib/symbiont/web_objects.rb +0 -22
- data/lucid.yml +0 -6
- data/spec/symbiont/data_setter_spec.rb +0 -65
- data/spec/symbiont/enclosers_spec.rb +0 -76
- data/spec/symbiont/evaluators_spec.rb +0 -95
- data/spec/symbiont/generators/button_generators_spec.rb +0 -72
- data/spec/symbiont/generators/checkbox_generators_spec.rb +0 -79
- data/spec/symbiont/generators/div_generators_spec.rb +0 -56
- data/spec/symbiont/generators/hidden_field_generators_spec.rb +0 -65
- data/spec/symbiont/generators/link_generators_spec.rb +0 -62
- data/spec/symbiont/generators/paragraph_generators_spec.rb +0 -57
- data/spec/symbiont/generators/radio_generators_spec.rb +0 -76
- data/spec/symbiont/generators/select_list_generators_spec.rb +0 -93
- data/spec/symbiont/generators/span_generators_spec.rb +0 -56
- data/spec/symbiont/generators/table_cell_generators_spec.rb +0 -56
- data/spec/symbiont/generators/table_generators_spec.rb +0 -56
- data/spec/symbiont/generators/text_area_generators_spec.rb +0 -72
- data/spec/symbiont/generators/text_field_generators_spec.rb +0 -72
- data/spec/symbiont/generators_spec.rb +0 -59
- data/spec/symbiont/locators_spec.rb +0 -68
- data/spec/symbiont/platform_object_spec.rb +0 -18
- data/spec/symbiont/symbiont_spec.rb +0 -29
- data/spec/symbiont/web_object_spec.rb +0 -194
- data/spec/symbiont/web_objects/button_spec.rb +0 -38
- data/spec/symbiont/web_objects/checkbox_spec.rb +0 -27
- data/spec/symbiont/web_objects/div_spec.rb +0 -18
- data/spec/symbiont/web_objects/heading_spec.rb +0 -22
- data/spec/symbiont/web_objects/hidden_field_spec.rb +0 -18
- data/spec/symbiont/web_objects/label_spec.rb +0 -18
- data/spec/symbiont/web_objects/link_spec.rb +0 -33
- data/spec/symbiont/web_objects/list_item_spec.rb +0 -18
- data/spec/symbiont/web_objects/option_spec.rb +0 -9
- data/spec/symbiont/web_objects/ordered_list_spec.rb +0 -53
- data/spec/symbiont/web_objects/paragraph_spec.rb +0 -18
- data/spec/symbiont/web_objects/radio_spec.rb +0 -27
- data/spec/symbiont/web_objects/select_list_spec.rb +0 -69
- data/spec/symbiont/web_objects/span_spec.rb +0 -18
- data/spec/symbiont/web_objects/table_cell_spec.rb +0 -19
- data/spec/symbiont/web_objects/table_row_spec.rb +0 -58
- data/spec/symbiont/web_objects/table_spec.rb +0 -61
- data/spec/symbiont/web_objects/text_area_spec.rb +0 -18
- data/spec/symbiont/web_objects/text_field_spec.rb +0 -39
- data/spec/symbiont/web_objects/unordered_list_spec.rb +0 -51
- data/specs/common/support/browser.rb +0 -25
- data/specs/common/support/env.rb +0 -6
- data/specs/common/support/events.rb +0 -15
- data/specs/enclosers.feature +0 -9
- data/specs/evaluators.feature +0 -26
- data/specs/pages/characters.rb +0 -22
- data/specs/pages/home.rb +0 -9
- data/specs/pages/stardate.rb +0 -23
- data/specs/pages/web_objects.rb +0 -77
- data/specs/select_list.feature +0 -53
- data/specs/steps/enclosers_steps.rb +0 -17
- data/specs/steps/evaluators_steps.rb +0 -44
- data/specs/steps/navigation_steps.rb +0 -14
- data/specs/steps/select_list_steps.rb +0 -94
- data/specs/steps/table_cell_steps.rb +0 -31
- data/specs/steps/table_steps.rb +0 -87
- data/specs/table.feature +0 -49
- data/specs/table_cell.feature +0 -27
@@ -1,174 +1,114 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'symbiont/factory'
|
3
|
-
|
4
|
-
module AppModule
|
5
|
-
class TestDefinitionInModule
|
6
|
-
include Symbiont
|
7
|
-
url_is "http://localhost:9292"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class TestFactory
|
12
|
-
include Symbiont::Factory
|
13
|
-
|
14
|
-
attr_accessor :browser
|
15
|
-
attr_accessor :active
|
16
|
-
end
|
17
|
-
|
18
|
-
class TestFactoryPage
|
19
|
-
include Symbiont
|
20
|
-
|
21
|
-
url_is "http://localhost:9292"
|
22
|
-
end
|
23
|
-
|
24
|
-
class TestFactoryWithURL
|
25
|
-
include Symbiont
|
26
|
-
|
27
|
-
url_is "http://localhost:9292"
|
28
|
-
end
|
29
|
-
|
30
|
-
class TestFactorySecond
|
31
|
-
include Symbiont
|
32
|
-
end
|
33
|
-
|
34
|
-
class TestFactoryThird
|
35
|
-
include Symbiont
|
36
|
-
end
|
37
2
|
|
38
3
|
describe Symbiont::Factory do
|
39
4
|
before(:each) do
|
40
5
|
@factory = TestFactory.new
|
41
|
-
@factory.
|
6
|
+
@factory.driver = mock_browser_for_watir
|
42
7
|
end
|
43
8
|
|
44
|
-
it
|
45
|
-
@factory.
|
46
|
-
@factory.
|
47
|
-
page.should be_instance_of DefinitionTest
|
48
|
-
end
|
49
|
-
|
50
|
-
@factory.on "DefinitionTest" do |page|
|
51
|
-
page.should be_instance_of DefinitionTest
|
52
|
-
end
|
53
|
-
|
54
|
-
@factory.on "AppModule::TestDefinitionInModule" do |page|
|
55
|
-
page.should be_instance_of AppModule::TestDefinitionInModule
|
56
|
-
end
|
9
|
+
it 'will create a new definition and view it, using on_view' do
|
10
|
+
@factory.driver.should_receive(:goto)
|
11
|
+
@factory.on_view(ValidPage)
|
57
12
|
end
|
58
13
|
|
59
|
-
it
|
60
|
-
@factory.
|
61
|
-
@factory.
|
62
|
-
page.should be_instance_of
|
63
|
-
end
|
64
|
-
|
65
|
-
@factory.during "DefinitionTest" do |page|
|
66
|
-
page.should be_instance_of DefinitionTest
|
14
|
+
it 'will create a new definition and view it, using on_view and a block' do
|
15
|
+
@factory.driver.should_receive(:goto)
|
16
|
+
@factory.on_view ValidPage do |page|
|
17
|
+
page.should be_instance_of ValidPage
|
67
18
|
end
|
19
|
+
end
|
68
20
|
|
69
|
-
|
70
|
-
|
21
|
+
it 'will create a new definition, using on and a block with a parameter' do
|
22
|
+
@factory.driver.should_not_receive(:goto)
|
23
|
+
@factory.on ValidPage do |page|
|
24
|
+
page.should be_instance_of ValidPage
|
71
25
|
end
|
72
26
|
end
|
73
27
|
|
74
|
-
it
|
75
|
-
@factory.
|
76
|
-
@factory.
|
77
|
-
|
28
|
+
it 'will create a new definition, using on and a block without a parameter' do
|
29
|
+
@factory.driver.should_not_receive(:goto)
|
30
|
+
@factory.on ValidPage do
|
31
|
+
@factory.active.should be_instance_of ValidPage
|
78
32
|
end
|
33
|
+
end
|
79
34
|
|
80
|
-
|
81
|
-
|
82
|
-
|
35
|
+
it 'will use an existing object reference with on' do
|
36
|
+
@factory.driver.should_receive(:goto)
|
37
|
+
obj1 = @factory.on_view ValidPage
|
38
|
+
obj2 = @factory.on ValidPage
|
39
|
+
obj1.should == obj2
|
40
|
+
end
|
83
41
|
|
84
|
-
|
85
|
-
|
86
|
-
|
42
|
+
it 'will not use an existing object reference with on_new' do
|
43
|
+
@factory.driver.should_receive(:goto)
|
44
|
+
obj1 = @factory.on_view ValidPage
|
45
|
+
obj2 = @factory.on_new ValidPage
|
46
|
+
obj1.should_not == obj2
|
87
47
|
end
|
88
48
|
|
89
|
-
it
|
90
|
-
@factory.
|
91
|
-
@factory.
|
92
|
-
page.should be_instance_of
|
49
|
+
it 'will create a new definition, using on_set' do
|
50
|
+
@factory.driver.should_not_receive(:goto)
|
51
|
+
@factory.on_set ValidPage do |page|
|
52
|
+
page.should be_instance_of ValidPage
|
93
53
|
end
|
54
|
+
end
|
94
55
|
|
95
|
-
|
96
|
-
|
97
|
-
|
56
|
+
it 'will set a reference to be used outside the factory' do
|
57
|
+
active = @factory.on ValidPage
|
58
|
+
current = @factory.instance_variable_get '@active'
|
59
|
+
current.should === active
|
60
|
+
end
|
98
61
|
|
99
|
-
|
100
|
-
|
101
|
-
|
62
|
+
it 'will use an existing object reference with on_set' do
|
63
|
+
@factory.driver.should_receive(:goto)
|
64
|
+
obj1 = @factory.on_view ValidPage
|
65
|
+
obj2 = @factory.on_set ValidPage
|
66
|
+
obj1.should == obj2
|
102
67
|
end
|
103
68
|
|
104
|
-
it
|
105
|
-
@factory.
|
106
|
-
|
107
|
-
page.should be_instance_of DefinitionTest
|
69
|
+
it 'will use an existing context using on after using on_set' do
|
70
|
+
@factory.on_set ValidPage do |page|
|
71
|
+
@obj1 = page # obj1 is CONTEXT, ACTIVE
|
108
72
|
end
|
109
73
|
|
110
|
-
@factory.
|
111
|
-
page
|
74
|
+
@factory.on ValidPageNewContext do |page|
|
75
|
+
@obj2 = page # obj2 is ACTIVE
|
112
76
|
end
|
113
77
|
|
114
|
-
@factory.
|
115
|
-
page
|
78
|
+
@factory.on ValidPage do |page|
|
79
|
+
@obj3 = page # obj1 CONTEXT is still set
|
116
80
|
end
|
117
|
-
end
|
118
81
|
|
119
|
-
|
120
|
-
|
121
|
-
current = @factory.instance_variable_get "@active"
|
122
|
-
current.should === active
|
82
|
+
@obj1.should_not == @obj2
|
83
|
+
@obj1.should == @obj3
|
123
84
|
end
|
124
85
|
|
125
|
-
it
|
126
|
-
@factory.
|
127
|
-
|
128
|
-
used = false
|
129
|
-
@factory.if_on(TestFactorySecond) do |page|
|
130
|
-
page.should be_instance_of TestFactorySecond
|
131
|
-
used = true
|
86
|
+
it 'will use an existing context using on_new of a different class after using on_set' do
|
87
|
+
@factory.on_set ValidPage do |page|
|
88
|
+
@obj1 = page # obj1 is CONTEXT, ACTIVE
|
132
89
|
end
|
133
|
-
used.should be true
|
134
90
|
|
135
|
-
|
136
|
-
|
137
|
-
page.should be_instance_of TestFactorySecond
|
138
|
-
used = true
|
91
|
+
@factory.on_new ValidPageNewContext do |page|
|
92
|
+
@obj2 = page # ACTIVE nil, obj1 no longer ACTIVE, but is CONTEXT
|
139
93
|
end
|
140
|
-
used.should be true
|
141
94
|
|
142
|
-
|
143
|
-
|
144
|
-
@factory.if_on("AppModule::TestDefinitionInModule") do |page|
|
145
|
-
page.should be_instance_of AppModule::TestDefinitionInModule
|
146
|
-
used = true
|
95
|
+
@factory.on ValidPage do |page|
|
96
|
+
@obj3 = page # CONTEXT is set to obj1
|
147
97
|
end
|
148
|
-
used.should be true
|
149
|
-
end
|
150
98
|
|
151
|
-
|
152
|
-
@
|
153
|
-
|
154
|
-
fail
|
155
|
-
end
|
99
|
+
@obj1.should_not == @obj2
|
100
|
+
@obj1.should == @obj3
|
101
|
+
end
|
156
102
|
|
157
|
-
|
158
|
-
|
103
|
+
it 'will clear existing context using on_new after using on_set' do
|
104
|
+
@factory.on_set ValidPage do |page|
|
105
|
+
@obj1 = page # obj1 is CONTEXT, ACTIVE
|
159
106
|
end
|
160
107
|
|
161
|
-
@factory.
|
162
|
-
|
108
|
+
@factory.on_new ValidPage do |page|
|
109
|
+
@obj2 = page # ACTIVE nil; since page is same, CONTEXT is nil
|
163
110
|
end
|
164
|
-
end
|
165
111
|
|
166
|
-
|
167
|
-
expected = TestFactoryWithURL.new(@factory.browser)
|
168
|
-
@factory.instance_variable_set "@active", expected
|
169
|
-
@factory.if_on(TestFactoryPage).should == expected
|
170
|
-
@factory.if_on("TestFactoryPage").should == expected
|
171
|
-
@factory.if_on("AppModule::TestDefinitionInModule").should == expected
|
112
|
+
@obj1.should_not == @obj2
|
172
113
|
end
|
173
|
-
|
174
|
-
end
|
114
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::Page do
|
4
|
+
include_context :page
|
5
|
+
|
6
|
+
context 'a page definition being used - url' do
|
7
|
+
it 'will establish no default url' do
|
8
|
+
expect(empty_definition.url).to be_nil
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'will establish a page url with the url_is assertion' do
|
12
|
+
expect(watir_definition).to respond_to :url
|
13
|
+
expect(watir_definition.url).to eq('http://localhost:9292')
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'will not view a page if the url_is assertion has not been set' do
|
17
|
+
expect { empty_definition.view }.to raise_error Symbiont::Errors::NoUrlForDefinition
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'a page definition being used - url match' do
|
22
|
+
it 'will establish no default url matcher' do
|
23
|
+
expect(empty_definition.url_match).to be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'will establish a url matcher with the url_matches assertion' do
|
27
|
+
expect(watir_definition).to respond_to :url_match
|
28
|
+
expect(watir_definition.url_match).to eq(/:\d{4}/)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'will not verify a url if the url_matches assertion has not been set' do
|
32
|
+
expect { empty_definition.has_correct_url? }.to raise_error Symbiont::Errors::NoUrlMatchForDefinition
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'a page definition being used - title' do
|
37
|
+
it 'will establish no default title' do
|
38
|
+
expect(empty_definition.page_title).to be_nil
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'will establish a page title with the title_is assertion' do
|
42
|
+
expect(watir_definition).to respond_to :page_title
|
43
|
+
expect(watir_definition.page_title).to eq('Dialogic')
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'will not verify a title if the title_is assertion has not been set' do
|
47
|
+
expect { empty_definition.has_correct_title? }.to raise_error Symbiont::Errors::NoTitleForDefinition
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/symbiont.gemspec
CHANGED
@@ -1,27 +1,52 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'symbiont/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'symbiont'
|
8
|
+
spec.version = Symbiont::VERSION
|
9
|
+
spec.authors = ['Jeff Nyman']
|
10
|
+
spec.email = ['jeffnyman@gmail.com']
|
11
|
+
spec.summary = %q{An Endosymbiotic Facultative Semantically Clean Fluent Interface Test Framework}
|
12
|
+
spec.description = %q{
|
13
|
+
Symbiont is a framework that allows you to describe your application in
|
14
|
+
terms of activity and page definitions. Those definitions can then be
|
15
|
+
referenced by test libraries using the DSL that Symbiont provides. The
|
16
|
+
DSL allows web elements to be proxied to a driver library.
|
17
|
+
|
18
|
+
The DSL provides a fluent interface that can be used for constructing
|
19
|
+
test execution logic. This fluent interface promotes the idea of
|
20
|
+
compressibility of your test logic, allowing for more factoring, more
|
21
|
+
reuse, and less repetition.
|
22
|
+
|
23
|
+
You can use Symbiont directly as an automated test library or you can
|
24
|
+
use it with other tools such as RSpec, Cucumber, or my own Lucid tool.
|
25
|
+
}
|
26
|
+
spec.homepage = 'https://github.com/jnyman/symbiont'
|
27
|
+
spec.license = 'MIT'
|
28
|
+
spec.requirements << 'Watir-WebDriver, Colorize'
|
29
|
+
|
30
|
+
spec.files = `git ls-files -z`.split("\x0")
|
31
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
32
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|specs|features)/})
|
33
|
+
spec.require_paths = %w(lib)
|
34
|
+
|
35
|
+
spec.required_ruby_version = '>= 1.9.3'
|
36
|
+
spec.required_rubygems_version = '>= 1.8.29'
|
37
|
+
|
38
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
39
|
+
spec.add_development_dependency 'rake'
|
40
|
+
spec.add_development_dependency 'rspec', '>= 2.14'
|
41
|
+
|
42
|
+
spec.add_runtime_dependency 'colorize', '>= 0.7.2'
|
43
|
+
spec.add_runtime_dependency 'watir-webdriver', '>= 0.6.9'
|
44
|
+
|
45
|
+
spec.post_install_message = %{
|
46
|
+
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
|
47
|
+
|
48
|
+
Symbiont #{Symbiont::VERSION} has been installed.
|
49
|
+
|
50
|
+
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
|
51
|
+
}
|
52
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$: << './lib'
|
3
|
+
|
4
|
+
require 'rspec'
|
5
|
+
include RSpec::Matchers
|
6
|
+
|
7
|
+
require 'watir-webdriver'
|
8
|
+
|
9
|
+
require 'symbiont'
|
10
|
+
include Symbiont::Factory
|
11
|
+
|
12
|
+
#========================================
|
13
|
+
|
14
|
+
class Dialogic
|
15
|
+
attach Symbiont
|
16
|
+
|
17
|
+
url_is 'http://localhost:9292'
|
18
|
+
end
|
19
|
+
|
20
|
+
class Weight
|
21
|
+
attach Symbiont
|
22
|
+
|
23
|
+
url_is 'http://localhost:9292/weight'
|
24
|
+
|
25
|
+
text_field :weight, id: 'wt', index: 0
|
26
|
+
button :calculate, id: 'calculate'
|
27
|
+
|
28
|
+
def convert(value)
|
29
|
+
weight.set value
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class Practice
|
34
|
+
attach Symbiont
|
35
|
+
|
36
|
+
url_is 'http://localhost:9292/practice'
|
37
|
+
url_matches /:\d{4}/
|
38
|
+
title_is 'Dialogic - Practice Page'
|
39
|
+
|
40
|
+
link :view_in_frame, id: 'framed_page'
|
41
|
+
|
42
|
+
iframe :boxframe, class: 'fancybox-iframe'
|
43
|
+
|
44
|
+
text_field :weight, -> { boxframe.text_field(id: 'wt') }
|
45
|
+
|
46
|
+
article :practice, id: 'practice'
|
47
|
+
|
48
|
+
a :page_link do |text|
|
49
|
+
practice.a(text: text)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
@driver = Watir::Browser.new
|
54
|
+
|
55
|
+
def non_framed
|
56
|
+
@page = Weight.new(@driver)
|
57
|
+
@page.view
|
58
|
+
@page.weight.set '200'
|
59
|
+
@page.calculate.click
|
60
|
+
end
|
61
|
+
|
62
|
+
def framed
|
63
|
+
@page = Practice.new(@driver)
|
64
|
+
@page.view
|
65
|
+
#@page.view_in_frame.click
|
66
|
+
@page.page_link('View Weight Calculator in Frame').click
|
67
|
+
@page.weight.set '200'
|
68
|
+
end
|
69
|
+
|
70
|
+
def basic
|
71
|
+
@page = Practice.new(@driver)
|
72
|
+
@page.should be_a_kind_of(Symbiont)
|
73
|
+
@page.should be_an_instance_of(Practice)
|
74
|
+
|
75
|
+
@page.view
|
76
|
+
@page.has_correct_url?
|
77
|
+
@page.has_correct_title?
|
78
|
+
|
79
|
+
@page.should have_correct_url
|
80
|
+
@page.should have_correct_title
|
81
|
+
end
|
82
|
+
|
83
|
+
#basic
|
84
|
+
|
85
|
+
on_view(Weight)
|
86
|
+
on(Weight).convert('200')
|
87
|
+
on(Weight).calculate.click
|
88
|
+
|
89
|
+
on(Weight) do
|
90
|
+
@active.convert('200')
|
91
|
+
@active.calculate.click
|
92
|
+
end
|
93
|
+
|
94
|
+
on(Weight) do |page|
|
95
|
+
page.convert('200')
|
96
|
+
page.calculate.click
|
97
|
+
end
|