watirmark 5.14.16
Sign up to get free protection for your applications and to get access to all the features.
- data/app_generators/create_project/create_project_generator.rb +115 -0
- data/app_generators/create_project/templates/features/env.rb.erb +8 -0
- data/app_generators/create_project/templates/features/model_steps.rb.erb +9 -0
- data/app_generators/create_project/templates/features/post_error_steps.rb.erb +15 -0
- data/app_generators/create_project/templates/features/sample.feature.erb +5 -0
- data/app_generators/create_project/templates/features/site_steps.rb.erb +7 -0
- data/app_generators/create_project/templates/generators/controller.rb.erb +9 -0
- data/app_generators/create_project/templates/generators/generate.rb.erb +9 -0
- data/app_generators/create_project/templates/generators/model.rb.erb +7 -0
- data/app_generators/create_project/templates/generators/mvc_generator.rb.erb +100 -0
- data/app_generators/create_project/templates/generators/rbeautify.rb.erb +212 -0
- data/app_generators/create_project/templates/generators/view.rb.erb +16 -0
- data/app_generators/create_project/templates/generators/workflow_loader.rb.erb +1 -0
- data/app_generators/create_project/templates/library/base_controller.rb.erb +9 -0
- data/app_generators/create_project/templates/library/base_view.rb.erb +6 -0
- data/app_generators/create_project/templates/library/configuration.rb.erb +6 -0
- data/app_generators/create_project/templates/library/core_libraries.rb.erb +9 -0
- data/app_generators/create_project/templates/library/loader.rb.erb +23 -0
- data/app_generators/create_project/templates/library/page_load_checker.rb.erb +11 -0
- data/app_generators/create_project/templates/library/post_errors_checker.rb.erb +23 -0
- data/app_generators/create_project/templates/library/project_require_file.rb.erb +8 -0
- data/app_generators/create_project/templates/library/search_controller.rb.erb +12 -0
- data/app_generators/create_project/templates/library/workflows.rb.erb +0 -0
- data/app_generators/create_project/templates/project/config.yml.erb +3 -0
- data/app_generators/create_project/templates/project/gemfile.rb.erb +11 -0
- data/app_generators/create_project/templates/project/rakefile.rb.erb +21 -0
- data/bin/etapestry/Gemfile +11 -0
- data/bin/etapestry/config.yml +3 -0
- data/bin/etapestry/features/etapestry_home.feature +5 -0
- data/bin/etapestry/features/step_definitions/model_steps.rb +9 -0
- data/bin/etapestry/features/step_definitions/post_error_steps.rb +15 -0
- data/bin/etapestry/features/step_definitions/site_steps.rb +7 -0
- data/bin/etapestry/features/support/env.rb +8 -0
- data/bin/etapestry/generators/mvc/mvc_generator.rb +100 -0
- data/bin/etapestry/generators/mvc/rbeautify.rb +212 -0
- data/bin/etapestry/generators/mvc/templates/controller.rb.erb +9 -0
- data/bin/etapestry/generators/mvc/templates/model.rb.erb +7 -0
- data/bin/etapestry/generators/mvc/templates/view.rb.erb +16 -0
- data/bin/etapestry/generators/mvc/templates/workflow_loader.rb.erb +1 -0
- data/bin/etapestry/lib/etapestry.rb +8 -0
- data/bin/etapestry/lib/etapestry/checkers/page_load_checker.rb +11 -0
- data/bin/etapestry/lib/etapestry/checkers/post_errors_checker.rb +23 -0
- data/bin/etapestry/lib/etapestry/configuration.rb +6 -0
- data/bin/etapestry/lib/etapestry/core_libraries.rb +9 -0
- data/bin/etapestry/lib/etapestry/loader.rb +23 -0
- data/bin/etapestry/lib/etapestry/site/base_controller.rb +9 -0
- data/bin/etapestry/lib/etapestry/site/base_view.rb +6 -0
- data/bin/etapestry/lib/etapestry/site/search_controller.rb +12 -0
- data/bin/etapestry/lib/etapestry/workflows.rb +0 -0
- data/bin/etapestry/rakefile.rb +21 -0
- data/bin/etapestry/script/generate.rb +9 -0
- data/bin/twitter/features/hashtag_search.feature +93 -0
- data/bin/twitter/features/step_definitions/hashtag_steps.rb +9 -0
- data/bin/twitter/lib/twitter/workflows/search/result_controller.rb +13 -0
- data/bin/twitter/lib/twitter/workflows/search/result_model.rb +5 -0
- data/bin/twitter/lib/twitter/workflows/search/result_view.rb +19 -0
- data/bin/watirmark +10 -0
- data/lib/watirmark.rb +26 -0
- data/lib/watirmark/at_exit.rb +13 -0
- data/lib/watirmark/configuration.rb +201 -0
- data/lib/watirmark/controller/actions.rb +172 -0
- data/lib/watirmark/controller/assertions.rb +116 -0
- data/lib/watirmark/controller/controller.rb +191 -0
- data/lib/watirmark/controller/dialogs.rb +33 -0
- data/lib/watirmark/controller/matcher.rb +19 -0
- data/lib/watirmark/cucumber/cuke_helper.rb +150 -0
- data/lib/watirmark/cucumber/email_helper.rb +103 -0
- data/lib/watirmark/cucumber/env.rb +9 -0
- data/lib/watirmark/cucumber/hooks.rb +16 -0
- data/lib/watirmark/cucumber/model_helper.rb +34 -0
- data/lib/watirmark/cucumber/transforms.rb +55 -0
- data/lib/watirmark/exceptions.rb +15 -0
- data/lib/watirmark/extensions/ruby_extensions.rb +129 -0
- data/lib/watirmark/extensions/webdriver_extensions.rb +150 -0
- data/lib/watirmark/formatters/snapshot_formatter.rb +23 -0
- data/lib/watirmark/loader.rb +87 -0
- data/lib/watirmark/model.rb +3 -0
- data/lib/watirmark/models/cucumber_helper.rb +49 -0
- data/lib/watirmark/models/debug_methods.rb +21 -0
- data/lib/watirmark/models/default_values.rb +21 -0
- data/lib/watirmark/models/factory.rb +168 -0
- data/lib/watirmark/models/factory_method_generators.rb +84 -0
- data/lib/watirmark/models/factory_methods.rb +72 -0
- data/lib/watirmark/models/trait.rb +35 -0
- data/lib/watirmark/models/upload_csv.rb +24 -0
- data/lib/watirmark/page/keyed_element.rb +63 -0
- data/lib/watirmark/page/page.rb +50 -0
- data/lib/watirmark/page/page_definition.rb +187 -0
- data/lib/watirmark/page/process_page.rb +112 -0
- data/lib/watirmark/page/radio_maps.rb +53 -0
- data/lib/watirmark/profile.rb +22 -0
- data/lib/watirmark/rake/smoketest.rb +17 -0
- data/lib/watirmark/screenshot.rb +127 -0
- data/lib/watirmark/session.rb +115 -0
- data/lib/watirmark/version.rb +5 -0
- data/spec/assertions_spec.rb +95 -0
- data/spec/config_spec.rb +82 -0
- data/spec/controller_actions_spec.rb +91 -0
- data/spec/controller_spec.rb +426 -0
- data/spec/controllers_and_models_spec.rb +52 -0
- data/spec/model_factory_spec.rb +568 -0
- data/spec/model_traits_spec.rb +141 -0
- data/spec/page_spec.rb +127 -0
- data/spec/process_page_spec.rb +163 -0
- data/spec/spec_helper.rb +17 -0
- metadata +238 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe "Traits" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
module Watirmark::Model
|
7
|
+
trait :contact_name do
|
8
|
+
first_name { "first" }
|
9
|
+
last_name { "last_#{uuid}" }
|
10
|
+
end
|
11
|
+
|
12
|
+
trait :credit_card do
|
13
|
+
cardnumber { 4111111111111111 }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module FactoryTest
|
18
|
+
class TraitsA < Watirmark::Model::Factory
|
19
|
+
keywords :first_name, :last_name, :middle_name, :cardnumber
|
20
|
+
traits :contact_name, :credit_card
|
21
|
+
defaults do
|
22
|
+
middle_name { "A" }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class TraitsB < Watirmark::Model::Factory
|
27
|
+
keywords :first_name, :last_name, :middle_name, :cardnumber
|
28
|
+
traits :contact_name, :credit_card
|
29
|
+
defaults do
|
30
|
+
middle_name { "B" }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class TraitsC < Watirmark::Model::Factory
|
35
|
+
keywords :first_name
|
36
|
+
defaults do
|
37
|
+
first_name { "C" }
|
38
|
+
end
|
39
|
+
traits :contact_name, :credit_card
|
40
|
+
end
|
41
|
+
|
42
|
+
class TraitsD < Watirmark::Model::Factory
|
43
|
+
keywords :first_name
|
44
|
+
traits :contact_name, :credit_card
|
45
|
+
defaults do
|
46
|
+
first_name { "D" }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
specify "should have different last names" do
|
53
|
+
a = FactoryTest::TraitsA.new
|
54
|
+
b = FactoryTest::TraitsB.new
|
55
|
+
a.middle_name.should_not == b.middle_name
|
56
|
+
end
|
57
|
+
|
58
|
+
specify "should have same first names" do
|
59
|
+
a = FactoryTest::TraitsA.new
|
60
|
+
b = FactoryTest::TraitsB.new
|
61
|
+
a.first_name.should == b.first_name
|
62
|
+
end
|
63
|
+
|
64
|
+
specify "should have same last name but with different UUID" do
|
65
|
+
a = FactoryTest::TraitsA.new
|
66
|
+
b = FactoryTest::TraitsB.new
|
67
|
+
a.last_name.should include "last"
|
68
|
+
b.last_name.should include "last"
|
69
|
+
a.last_name.should_not == b.last_name
|
70
|
+
end
|
71
|
+
|
72
|
+
specify "should have same credit card number" do
|
73
|
+
a = FactoryTest::TraitsA.new
|
74
|
+
b = FactoryTest::TraitsB.new
|
75
|
+
a.cardnumber.should == b.cardnumber
|
76
|
+
end
|
77
|
+
|
78
|
+
specify "defaults should take precedence over traits" do
|
79
|
+
FactoryTest::TraitsC.new.first_name.should == "C"
|
80
|
+
FactoryTest::TraitsD.new.first_name.should == "D"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "Nested Traits" do
|
85
|
+
|
86
|
+
before :all do
|
87
|
+
module Watirmark::Model
|
88
|
+
trait :credit_card do
|
89
|
+
credit_card {4111111111111111}
|
90
|
+
end
|
91
|
+
|
92
|
+
trait :donor_address do
|
93
|
+
donor_address { "123 Sunset St" }
|
94
|
+
donor_state { "TX" }
|
95
|
+
end
|
96
|
+
|
97
|
+
trait :donor_jim do
|
98
|
+
traits :donor_address
|
99
|
+
first_name { "Jim" }
|
100
|
+
last_name { "Smith" }
|
101
|
+
end
|
102
|
+
|
103
|
+
trait :donor_jane do
|
104
|
+
first_name { "Jane" }
|
105
|
+
last_name { "Baker" }
|
106
|
+
traits :donor_address, :credit_card
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
module FactoryTest
|
111
|
+
class Jim < Watirmark::Model::Factory
|
112
|
+
keywords :first_name, :last_name, :donor_address, :donor_state, :credit_card
|
113
|
+
traits :donor_jim
|
114
|
+
end
|
115
|
+
|
116
|
+
class Jane < Watirmark::Model::Factory
|
117
|
+
keywords :first_name, :last_name, :donor_address, :donor_state, :credit_card
|
118
|
+
traits :donor_jane
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
specify "should have different first and last name" do
|
125
|
+
jim = FactoryTest::Jim.new
|
126
|
+
jane = FactoryTest::Jane.new
|
127
|
+
jim.first_name.should_not == jane.first_name
|
128
|
+
jim.last_name.should_not == jane.last_name
|
129
|
+
end
|
130
|
+
|
131
|
+
specify "should have same address due to same trait" do
|
132
|
+
jim = FactoryTest::Jim.new
|
133
|
+
jane = FactoryTest::Jane.new
|
134
|
+
jim.donor_address.should == "123 Sunset St"
|
135
|
+
jim.donor_state.should == "TX"
|
136
|
+
jim.donor_address.should == jim.donor_address
|
137
|
+
jim.donor_state.should == jim.donor_state
|
138
|
+
jane.credit_card.should == 4111111111111111
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
data/spec/page_spec.rb
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Page' do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
class Page1 < Page
|
7
|
+
keyword(:a) { "a" }
|
8
|
+
keyword(:b) { "b" }
|
9
|
+
end
|
10
|
+
class Page2 < Page
|
11
|
+
keyword(:c) { "c" }
|
12
|
+
end
|
13
|
+
class Page3 < Page
|
14
|
+
populate_keyword(:d) { "d" }
|
15
|
+
verify_keyword(:e) { "e" }
|
16
|
+
end
|
17
|
+
class Page4 < Page
|
18
|
+
navigation_keyword(:f) { "f" }
|
19
|
+
private_keyword(:g) { "g" }
|
20
|
+
keyword(:h) { "h" }
|
21
|
+
end
|
22
|
+
class Page5 < Page1
|
23
|
+
keyword(:i) { "i" }
|
24
|
+
end
|
25
|
+
|
26
|
+
@page1 = Page1.new
|
27
|
+
@page2 = Page2.new
|
28
|
+
@page3 = Page3.new
|
29
|
+
@page4 = Page4.new
|
30
|
+
@page5 = Page5.new
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should list its keywords" do
|
34
|
+
@page1.keywords.should == [:a, :b]
|
35
|
+
@page2.keywords.should == [:c]
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should list its parent's keywords" do
|
39
|
+
@page5.keywords.should == [:a, :b, :i]
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
it "should list its own keywords" do
|
44
|
+
@page5.native_keywords.should == [:i]
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
it "should list populate and verify keywords" do
|
49
|
+
@page3.keywords.should == [:d, :e]
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should create a method for the keyword' do
|
53
|
+
@page1.a.should == 'a'
|
54
|
+
@page2.c.should == 'c'
|
55
|
+
@page4.h.should == 'h'
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should be able to get and set the browser' do
|
59
|
+
old_browser = Page.browser
|
60
|
+
begin
|
61
|
+
Page.browser = 'browser'
|
62
|
+
Page1.new.browser.should == 'browser'
|
63
|
+
Page2.new.browser.should == 'browser'
|
64
|
+
Page3.new.browser.should == 'browser'
|
65
|
+
Page4.new.browser.should == 'browser'
|
66
|
+
ensure
|
67
|
+
Page.browser = old_browser
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should not leak keywords to other classes' do
|
72
|
+
lambda { @page2.a }.should raise_error
|
73
|
+
lambda { @page1.c }.should raise_error
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should support aliasing keywords' do
|
77
|
+
class Page1 < Page
|
78
|
+
keyword_alias :aliased_keyword, :a
|
79
|
+
end
|
80
|
+
page1 = Page1.new
|
81
|
+
page1.a.should == 'a'
|
82
|
+
page1.aliased_keyword.should == 'a'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "keyword metadata inheritance" do
|
87
|
+
|
88
|
+
before :all do
|
89
|
+
class Parent < Page
|
90
|
+
keyword(:a) { "a" }
|
91
|
+
keyword(:b) { "b" }
|
92
|
+
keyword(:same) { "c1" }
|
93
|
+
end
|
94
|
+
|
95
|
+
class Child < Parent
|
96
|
+
keyword(:c) { "c" }
|
97
|
+
keyword(:same) { "c1-child" }
|
98
|
+
end
|
99
|
+
|
100
|
+
class Child2 < Parent
|
101
|
+
keyword(:g) { "g" }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'should get declared keywords' do
|
106
|
+
parent = Parent.new
|
107
|
+
parent.keywords.should == [:a, :b, :same]
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'should allow child to override superclass' do
|
111
|
+
child = Child.new
|
112
|
+
child.keywords.sort_by{|k| k.to_s}.should == [:a, :b, :c, :same]
|
113
|
+
child.a.should == "a"
|
114
|
+
child.same.should == 'c1-child'
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should not bleed settings between children' do
|
118
|
+
child2 = Child2.new
|
119
|
+
child2.keywords.sort_by{|k| k.to_s}.should == [:a, :b, :g, :same]
|
120
|
+
child2.g.should == 'g'
|
121
|
+
child2.same.should == 'c1'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
@@ -0,0 +1,163 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe 'ProcessPage' do
|
4
|
+
|
5
|
+
it 'should implement a process page interface' do
|
6
|
+
lambda{Watirmark::ProcessPage.new('pp')}.should_not raise_error
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should support an activate method' do
|
10
|
+
p = Watirmark::ProcessPage.new('pp')
|
11
|
+
lambda{p.activate}.should_not raise_error(NoMethodError)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'Process Page Views' do
|
17
|
+
|
18
|
+
before :all do
|
19
|
+
class ProcessPageTest < Watirmark::Page
|
20
|
+
keyword(:a) {'a'}
|
21
|
+
process_page('ProcessPage 1') do
|
22
|
+
keyword(:b) {'b'}
|
23
|
+
end
|
24
|
+
process_page('ProcessPage 2') do
|
25
|
+
keyword(:c) {'c'}
|
26
|
+
keyword(:d) {'d'}
|
27
|
+
end
|
28
|
+
keyword(:e) {'e'}
|
29
|
+
end
|
30
|
+
|
31
|
+
class NestedProcessPageTest < Watirmark::Page
|
32
|
+
keyword(:a) {'a'}
|
33
|
+
process_page('ProcessPage 1') do
|
34
|
+
keyword(:b) {'b'}
|
35
|
+
process_page('ProcessPage 1.1') do
|
36
|
+
keyword(:b1) {'b1'}
|
37
|
+
keyword(:b2) {'b2'}
|
38
|
+
process_page('ProcessPage 1.1.1') do
|
39
|
+
keyword(:b3) {'b3'}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
keyword(:c) {'c'}
|
44
|
+
end
|
45
|
+
|
46
|
+
class DefaultView < Watirmark::Page
|
47
|
+
keyword(:a) {'a'}
|
48
|
+
keyword(:b) {'b'}
|
49
|
+
end
|
50
|
+
|
51
|
+
class ProcessPageView < Watirmark::Page
|
52
|
+
process_page 'page 1' do
|
53
|
+
keyword(:a) {'a'}
|
54
|
+
end
|
55
|
+
process_page 'page 2' do
|
56
|
+
keyword(:b) {'b'}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class ProcessPageAliasView < Watirmark::Page
|
61
|
+
process_page 'page 1' do
|
62
|
+
process_page_alias 'page a'
|
63
|
+
process_page_alias 'page b'
|
64
|
+
keyword(:a) {'a'}
|
65
|
+
end
|
66
|
+
process_page 'page 2' do
|
67
|
+
keyword(:b) {'b'}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class ProcessPageSubclassView < ProcessPageView
|
72
|
+
process_page 'page 3' do
|
73
|
+
keyword(:c) {'c'}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class ProcessPageCustomNav < Watirmark::Page
|
78
|
+
process_page_navigate_method Proc.new {}
|
79
|
+
process_page_submit_method Proc.new {}
|
80
|
+
process_page_active_page_method Proc.new {}
|
81
|
+
process_page 'page 4' do
|
82
|
+
keyword(:d) {'d'}
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
@processpagetest = ProcessPageTest.new
|
87
|
+
@nestedprocesspagetest = NestedProcessPageTest.new
|
88
|
+
@processpage = ProcessPageView.new
|
89
|
+
@processpagealias = ProcessPageAliasView.new
|
90
|
+
@processpagesubclass = ProcessPageSubclassView.new
|
91
|
+
@processpagecustomnav = ProcessPageCustomNav.new
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should only activate process_page when in the closure' do
|
95
|
+
@processpagetest.a.should == 'a'
|
96
|
+
@processpagetest.b.should == 'b'
|
97
|
+
@processpagetest.c.should == 'c'
|
98
|
+
@processpagetest.d.should == 'd'
|
99
|
+
@processpagetest.e.should == 'e'
|
100
|
+
@processpagetest.keywords.should == [:a,:b,:c,:d,:e]
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should show all keywords for a given process page' do
|
104
|
+
@processpagetest.process_page('ProcessPage 1').keywords.should == [:b]
|
105
|
+
@processpagetest.process_page('ProcessPage 2').keywords.should == [:c, :d]
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'should activate the nested process_page where appropriate' do
|
109
|
+
@nestedprocesspagetest.a.should == 'a'
|
110
|
+
@nestedprocesspagetest.b.should == 'b'
|
111
|
+
@nestedprocesspagetest.b1.should == 'b1'
|
112
|
+
@nestedprocesspagetest.b2.should == 'b2'
|
113
|
+
@nestedprocesspagetest.b3.should == 'b3'
|
114
|
+
@nestedprocesspagetest.c.should == 'c'
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should support defining the process page navigate method' do
|
118
|
+
custom_method_called = false
|
119
|
+
Watirmark::ProcessPage.navigate_method_default = Proc.new { custom_method_called = true }
|
120
|
+
@processpagetest.a.should == 'a'
|
121
|
+
custom_method_called.should be_false
|
122
|
+
@processpagetest.b.should == 'b'
|
123
|
+
custom_method_called.should be_true
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'should support defining the process page submit method' do
|
127
|
+
process_page = @processpagealias.process_page('page 1')
|
128
|
+
process_page.alias.should == ['page a', 'page b']
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should be able to report all process pages' do
|
132
|
+
@processpage.process_pages[0].name.should == ''
|
133
|
+
@processpage.process_pages[1].name.should == 'page 1'
|
134
|
+
@processpage.process_pages[2].name.should == 'page 2'
|
135
|
+
@processpage.process_pages.size.should == 3
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'should include process page keywords in subclasses' do
|
139
|
+
@processpagesubclass.process_pages[0].name.should == ''
|
140
|
+
@processpagesubclass.process_pages[1].name.should == 'page 1'
|
141
|
+
@processpagesubclass.process_pages[2].name.should == 'page 2'
|
142
|
+
@processpagesubclass.process_pages[3].name.should == ''
|
143
|
+
@processpagesubclass.process_pages[4].name.should == 'page 3'
|
144
|
+
@processpagesubclass.process_pages.size.should == 5
|
145
|
+
@processpagesubclass.keywords.should == [:a, :b, :c]
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'should honor overriding default process page behavior' do
|
149
|
+
@processpagesubclass.c.should == 'c'
|
150
|
+
@processpagesubclass.class.instance_variable_get(:@process_page_active_page_method).should_not be_kind_of(Proc)
|
151
|
+
@processpagesubclass.class.instance_variable_get(:@process_page_navigate_method).should_not be_kind_of(Proc)
|
152
|
+
@processpagesubclass.class.instance_variable_get(:@process_page_submit_method).should_not be_kind_of(Proc)
|
153
|
+
|
154
|
+
@processpagecustomnav.d.should == 'd'
|
155
|
+
@processpagecustomnav.class.instance_variable_get(:@process_page_active_page_method).should be_kind_of(Proc)
|
156
|
+
@processpagecustomnav.class.instance_variable_get(:@process_page_navigate_method).should be_kind_of(Proc)
|
157
|
+
@processpagecustomnav.class.instance_variable_get(:@process_page_submit_method).should be_kind_of(Proc)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
+
$: << File.expand_path(lib_dir)
|
3
|
+
|
4
|
+
ENV['WEBDRIVER'] = 'firefox'
|
5
|
+
|
6
|
+
|
7
|
+
require 'rspec/autorun'
|
8
|
+
require 'watirmark'
|
9
|
+
require 'watirmark/configuration'
|
10
|
+
|
11
|
+
Watirmark.logger.level = Logger::FATAL
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.mock_with :mocha
|
15
|
+
end
|
16
|
+
|
17
|
+
Watirmark.add_exit_task { Page.browser.close if Page.browser_exists? }
|