watirmark 5.14.16 → 5.27.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/watirmark +2 -8
- data/generators/new_project/generator.rb +58 -0
- data/{app_generators/create_project/templates/project → generators/new_project/templates}/config.yml.erb +0 -0
- data/{app_generators/create_project → generators/new_project}/templates/features/env.rb.erb +0 -0
- data/{app_generators/create_project → generators/new_project}/templates/features/model_steps.rb.erb +0 -0
- data/{app_generators/create_project → generators/new_project}/templates/features/post_error_steps.rb.erb +0 -0
- data/{app_generators/create_project → generators/new_project}/templates/features/sample.feature.erb +0 -0
- data/{app_generators/create_project → generators/new_project}/templates/features/site_steps.rb.erb +0 -0
- data/generators/new_project/templates/gemfile.rb.erb +10 -0
- data/generators/new_project/templates/generators/mvc/generator.rb.erb +61 -0
- data/generators/new_project/templates/generators/mvc/templates/controller.rb.erb +9 -0
- data/generators/new_project/templates/generators/mvc/templates/model.rb.erb +7 -0
- data/generators/new_project/templates/generators/mvc/templates/view.rb.erb +16 -0
- data/{app_generators/create_project/templates/library → generators/new_project/templates/lib}/configuration.rb.erb +0 -0
- data/{app_generators/create_project/templates/library → generators/new_project/templates/lib}/core_libraries.rb.erb +0 -0
- data/{app_generators/create_project/templates/library → generators/new_project/templates/lib}/loader.rb.erb +0 -0
- data/{app_generators/create_project/templates/library → generators/new_project/templates/lib/name/checkers}/page_load_checker.rb.erb +0 -0
- data/{app_generators/create_project/templates/library → generators/new_project/templates/lib/name/checkers}/post_errors_checker.rb.erb +0 -0
- data/{app_generators/create_project/templates/library → generators/new_project/templates/lib/name/site}/base_controller.rb.erb +0 -0
- data/{app_generators/create_project/templates/library → generators/new_project/templates/lib/name/site}/base_view.rb.erb +0 -0
- data/{app_generators/create_project/templates/library → generators/new_project/templates/lib/name/site}/search_controller.rb.erb +0 -0
- data/{app_generators/create_project/templates/library/project_require_file.rb.erb → generators/new_project/templates/lib/name.rb.erb} +0 -0
- data/{app_generators/create_project/templates/library → generators/new_project/templates/lib}/workflows.rb.erb +0 -0
- data/{app_generators/create_project/templates/project → generators/new_project/templates}/rakefile.rb.erb +1 -1
- data/generators/new_project/templates/script/generate.rb.erb +4 -0
- data/lib/watirmark/at_exit.rb +5 -9
- data/lib/watirmark/configuration.rb +7 -2
- data/lib/watirmark/controller/actions.rb +35 -12
- data/lib/watirmark/controller/controller.rb +8 -4
- data/lib/watirmark/controller/dialogs.rb +3 -3
- data/lib/watirmark/cucumber/email_helper.rb +19 -0
- data/lib/watirmark/cucumber/env.rb +6 -5
- data/lib/watirmark/cucumber/hook_helper.rb +38 -0
- data/lib/watirmark/cucumber/hooks.rb +13 -8
- data/lib/watirmark/cucumber/load_cached_models.rb +9 -0
- data/lib/watirmark/cucumber/model_helper.rb +4 -4
- data/lib/watirmark/cucumber/transforms.rb +3 -1
- data/lib/watirmark/extensions/ruby_extensions.rb +8 -0
- data/lib/watirmark/extensions/webdriver_extensions.rb +38 -3
- data/lib/watirmark/formatters/snapshot_formatter.rb +3 -0
- data/lib/watirmark/models/cucumber_helper.rb +12 -5
- data/lib/watirmark/models/factory.rb +35 -2
- data/lib/watirmark/page/page.rb +1 -0
- data/lib/watirmark/page/page_definition.rb +7 -5
- data/lib/watirmark/profile.rb +2 -2
- data/lib/watirmark/rake/smoketest.rb +6 -4
- data/lib/watirmark/screenshot.rb +3 -8
- data/lib/watirmark/session.rb +105 -9
- data/lib/watirmark/version.rb +1 -1
- data/lib/watirmark.rb +1 -8
- data/spec/config_spec.rb +45 -37
- data/spec/controller_actions_spec.rb +70 -7
- data/spec/controller_spec.rb +103 -83
- data/spec/model_factory_spec.rb +191 -8
- data/spec/model_traits_spec.rb +5 -0
- data/spec/page_spec.rb +10 -2
- data/spec/process_page_spec.rb +3 -3
- data/spec/session_spec.rb +56 -0
- data/spec/spec_helper.rb +1 -1
- metadata +146 -142
- data/app_generators/create_project/create_project_generator.rb +0 -115
- data/app_generators/create_project/templates/generators/controller.rb.erb +0 -9
- data/app_generators/create_project/templates/generators/generate.rb.erb +0 -9
- data/app_generators/create_project/templates/generators/model.rb.erb +0 -7
- data/app_generators/create_project/templates/generators/mvc_generator.rb.erb +0 -100
- data/app_generators/create_project/templates/generators/rbeautify.rb.erb +0 -212
- data/app_generators/create_project/templates/generators/view.rb.erb +0 -16
- data/app_generators/create_project/templates/generators/workflow_loader.rb.erb +0 -1
- data/app_generators/create_project/templates/project/gemfile.rb.erb +0 -11
- data/bin/etapestry/Gemfile +0 -11
- data/bin/etapestry/config.yml +0 -3
- data/bin/etapestry/features/etapestry_home.feature +0 -5
- data/bin/etapestry/features/step_definitions/model_steps.rb +0 -9
- data/bin/etapestry/features/step_definitions/post_error_steps.rb +0 -15
- data/bin/etapestry/features/step_definitions/site_steps.rb +0 -7
- data/bin/etapestry/features/support/env.rb +0 -8
- data/bin/etapestry/generators/mvc/mvc_generator.rb +0 -100
- data/bin/etapestry/generators/mvc/rbeautify.rb +0 -212
- data/bin/etapestry/generators/mvc/templates/controller.rb.erb +0 -9
- data/bin/etapestry/generators/mvc/templates/model.rb.erb +0 -7
- data/bin/etapestry/generators/mvc/templates/view.rb.erb +0 -16
- data/bin/etapestry/generators/mvc/templates/workflow_loader.rb.erb +0 -1
- data/bin/etapestry/lib/etapestry/checkers/page_load_checker.rb +0 -11
- data/bin/etapestry/lib/etapestry/checkers/post_errors_checker.rb +0 -23
- data/bin/etapestry/lib/etapestry/configuration.rb +0 -6
- data/bin/etapestry/lib/etapestry/core_libraries.rb +0 -9
- data/bin/etapestry/lib/etapestry/loader.rb +0 -23
- data/bin/etapestry/lib/etapestry/site/base_controller.rb +0 -9
- data/bin/etapestry/lib/etapestry/site/base_view.rb +0 -6
- data/bin/etapestry/lib/etapestry/site/search_controller.rb +0 -12
- data/bin/etapestry/lib/etapestry/workflows.rb +0 -0
- data/bin/etapestry/lib/etapestry.rb +0 -8
- data/bin/etapestry/rakefile.rb +0 -21
- data/bin/etapestry/script/generate.rb +0 -9
- data/bin/twitter/features/hashtag_search.feature +0 -93
- data/bin/twitter/features/step_definitions/hashtag_steps.rb +0 -9
- data/bin/twitter/lib/twitter/workflows/search/result_controller.rb +0 -13
- data/bin/twitter/lib/twitter/workflows/search/result_model.rb +0 -5
- data/bin/twitter/lib/twitter/workflows/search/result_view.rb +0 -19
data/spec/model_factory_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require_relative 'spec_helper'
|
2
3
|
|
3
4
|
describe "factory" do
|
@@ -6,6 +7,14 @@ describe "factory" do
|
|
6
7
|
class InitializeModel < Watirmark::Model::Factory
|
7
8
|
keywords :username, :password
|
8
9
|
end
|
10
|
+
|
11
|
+
class UniqueDefaultsModel < Watirmark::Model::Factory
|
12
|
+
keywords :test_name
|
13
|
+
defaults do
|
14
|
+
test_name { unique_instance_name }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
9
18
|
end
|
10
19
|
end
|
11
20
|
|
@@ -37,6 +46,16 @@ describe "factory" do
|
|
37
46
|
login = FactoryTest::InitializeModel.new(username: 'foo', password: 'bar')
|
38
47
|
login.to_h.should == {:username=>"foo", :password=>"bar"}
|
39
48
|
end
|
49
|
+
|
50
|
+
specify "should generate custom unique_instance_name given model_name" do
|
51
|
+
demo_model = FactoryTest::UniqueDefaultsModel.new({:model_name => "RspecUniqueName"})
|
52
|
+
demo_model.test_name.should =~ /^RspecUniqueName_[\dA-Za-z]+$/
|
53
|
+
end
|
54
|
+
|
55
|
+
specify "should generate default unique_instance_name given no model_name" do
|
56
|
+
demo_model = FactoryTest::UniqueDefaultsModel.new()
|
57
|
+
demo_model.test_name.should =~ /^uniquedefaults_[\dA-Za-z]+$/
|
58
|
+
end
|
40
59
|
end
|
41
60
|
|
42
61
|
describe "#update" do
|
@@ -68,16 +87,16 @@ describe "#update" do
|
|
68
87
|
first = FactoryTest::UpdateModel.new
|
69
88
|
first.update(:foobar=>1)
|
70
89
|
second = FactoryTest::UpdateModel.new
|
71
|
-
second.respond_to?(:foobar).should
|
72
|
-
second.respond_to?(:foobar).should
|
90
|
+
second.respond_to?(:foobar).should == false
|
91
|
+
second.respond_to?(:foobar).should == false
|
73
92
|
end
|
74
93
|
|
75
94
|
specify "model update should remove empty keys" do
|
76
95
|
keys = FactoryTest::UpdateModel.new
|
77
|
-
lambda{keys.update(':'=>'') }.should_not raise_error
|
78
|
-
lambda{keys.update(nil=>'') }.should_not raise_error
|
79
|
-
lambda{keys.update(' '=>'') }.should_not raise_error
|
80
|
-
lambda{keys.update(' '.to_sym=>'') }.should_not raise_error
|
96
|
+
lambda{keys.update(':'=>'') }.should_not raise_error
|
97
|
+
lambda{keys.update(nil=>'') }.should_not raise_error
|
98
|
+
lambda{keys.update(' '=>'') }.should_not raise_error
|
99
|
+
lambda{keys.update(' '.to_sym=>'') }.should_not raise_error
|
81
100
|
end
|
82
101
|
|
83
102
|
end
|
@@ -462,7 +481,7 @@ describe "methods in Enumerable should not collide with model defaults" do
|
|
462
481
|
end
|
463
482
|
end
|
464
483
|
end
|
465
|
-
FactoryTest::NoZipModel.new.respond_to?(:zip).should_not
|
484
|
+
FactoryTest::NoZipModel.new.respond_to?(:zip).should_not == true
|
466
485
|
end
|
467
486
|
|
468
487
|
end
|
@@ -533,10 +552,12 @@ describe "subclassing" do
|
|
533
552
|
end
|
534
553
|
module FactoryTest
|
535
554
|
class BaseModel < Watirmark::Model::Factory
|
536
|
-
keywords :first_name, :last_name, :full_name
|
555
|
+
keywords :first_name, :last_name, :full_name, :attr_test, :base_attr
|
537
556
|
defaults do
|
538
557
|
first_name { 'base_first_name' }
|
539
558
|
last_name { 'base_last_name' }
|
559
|
+
attr_test { 'I came from BaseModel' }
|
560
|
+
base_attr { 'This is a base attribute' }
|
540
561
|
end
|
541
562
|
traits :some_trait
|
542
563
|
end
|
@@ -545,6 +566,7 @@ describe "subclassing" do
|
|
545
566
|
defaults do
|
546
567
|
first_name { 'sub_first_name' }
|
547
568
|
last_name { 'sub_last_name' }
|
569
|
+
attr_test { 'I came from SubModel'}
|
548
570
|
end
|
549
571
|
end
|
550
572
|
|
@@ -564,5 +586,166 @@ describe "subclassing" do
|
|
564
586
|
specify "submodel should be able to inherit defaults" do
|
565
587
|
FactoryTest::NoDefaultModel.new.full_name.should == 'full_name'
|
566
588
|
end
|
589
|
+
|
590
|
+
specify "submodel should be able to override defaults" do
|
591
|
+
FactoryTest::SubModel.new.first_name.should == 'sub_first_name'
|
592
|
+
FactoryTest::SubModel.new.last_name.should == 'sub_last_name'
|
593
|
+
FactoryTest::SubModel.new.attr_test.should == 'I came from SubModel'
|
594
|
+
FactoryTest::SubModel.new.base_attr.should == 'This is a base attribute'
|
595
|
+
end
|
596
|
+
|
567
597
|
end
|
568
598
|
|
599
|
+
describe "#hash_id" do
|
600
|
+
class HashIdModel < Watirmark::Model::Factory
|
601
|
+
keywords :first_name, :last_name
|
602
|
+
defaults do
|
603
|
+
first_name { "First" }
|
604
|
+
middle_name { "Middle" }
|
605
|
+
last_name { "Last #{hash_id}" }
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
let(:model1) { HashIdModel.new }
|
610
|
+
let(:model2) { HashIdModel.new }
|
611
|
+
let(:model3) { HashIdModel.new }
|
612
|
+
|
613
|
+
specify "HashIdModel should have a 8 digit hash_id and are always the same" do
|
614
|
+
[model1, model2].each{|x| x.last_name.should match(/^Last [a-f0-9]{8}$/)}
|
615
|
+
model1.last_name.should == model2.last_name
|
616
|
+
end
|
617
|
+
|
618
|
+
specify "HashIdModels should have a hash_id of '4033fe24' when using the default seed 'Watirmark Default Seed'" do
|
619
|
+
Watirmark::Configuration.instance.hash_id_seed = nil
|
620
|
+
hash_id = (RUBY_VERSION == '1.9.3') ? 'ca14e5fb' : '4033fe24'
|
621
|
+
model1.hash_id.should == hash_id
|
622
|
+
end
|
623
|
+
|
624
|
+
specify "HashIdModels should have a different 8 digit hash_id when they have different seeds" do
|
625
|
+
model_seed_1 = HashIdModel.new
|
626
|
+
Watirmark::Configuration.instance.hash_id_seed = "New Seed"
|
627
|
+
model_seed_2 = HashIdModel.new
|
628
|
+
Watirmark::Configuration.instance.hash_id_seed = "Newest Seed"
|
629
|
+
model_seed_3 = HashIdModel.new
|
630
|
+
Watirmark::Configuration.instance.hash_id_seed = nil
|
631
|
+
|
632
|
+
[model_seed_1, model_seed_2, model_seed_3].each do |x|
|
633
|
+
x.last_name.should match(/^Last [a-f0-9]{8}$/)
|
634
|
+
end
|
635
|
+
[model_seed_1.last_name, model_seed_2.last_name, model_seed_3.last_name].uniq.length.should == 3
|
636
|
+
end
|
637
|
+
|
638
|
+
specify "add a new attribute to a HashIdModel with the hash_id" do
|
639
|
+
model1.foo = "bar #{model1.hash_id}"
|
640
|
+
model2.zoo = "baz #{model1.hash_id}"
|
641
|
+
|
642
|
+
model1.foo.gsub("bar", "baz").should == model2.zoo
|
643
|
+
HashIdModel.new.hash_id.should == HashIdModel.new.hash_id
|
644
|
+
end
|
645
|
+
|
646
|
+
let(:test_strings) {
|
647
|
+
["0",
|
648
|
+
"1",
|
649
|
+
"a",
|
650
|
+
"b",
|
651
|
+
"This is quite a long test string",
|
652
|
+
"This is quite a much longer test string that I'm going to use in my tests",
|
653
|
+
"And one test string I'll use with special characters ©å߃"
|
654
|
+
]
|
655
|
+
}
|
656
|
+
|
657
|
+
specify "should generate a hash value with a length of 8 - the default" do
|
658
|
+
new_model = Watirmark::Model::Factory.new
|
659
|
+
keys = test_strings.map { |x| new_model.hash_id }
|
660
|
+
keys.each { |x| x.length.should == 8 }
|
661
|
+
end
|
662
|
+
|
663
|
+
specify "should generate a hash value with a length of 20" do
|
664
|
+
length = Watirmark::Configuration.instance.hash_id_length = 20
|
665
|
+
new_model = Watirmark::Model::Factory.new
|
666
|
+
keys = test_strings.map { |x| new_model.hash_id(length) }
|
667
|
+
keys.each { |x| x.length.should == 20 }
|
668
|
+
end
|
669
|
+
|
670
|
+
specify "should generate a hash value with a length of 1" do
|
671
|
+
length = Watirmark::Configuration.instance.hash_id_length = 1
|
672
|
+
new_model = Watirmark::Model::Factory.new
|
673
|
+
keys = test_strings.map { |x| new_model.hash_id(length) }
|
674
|
+
keys.each { |x| x.length.should == 1 }
|
675
|
+
end
|
676
|
+
|
677
|
+
specify "should generate keys with hex values" do
|
678
|
+
length = Watirmark::Configuration.instance.hash_id_length = 8
|
679
|
+
new_model = Watirmark::Model::Factory.new
|
680
|
+
keys = test_strings.map { |x| new_model.hash_id(length, :hex) }
|
681
|
+
keys.each do |key|
|
682
|
+
key.each_char do |char|
|
683
|
+
char[/[a-f0-9]/].should_not be_nil
|
684
|
+
end
|
685
|
+
end
|
686
|
+
end
|
687
|
+
|
688
|
+
specify "should generate keys with alphanumeric values" do
|
689
|
+
length = Watirmark::Configuration.instance.hash_id_length = 8
|
690
|
+
new_model = Watirmark::Model::Factory.new
|
691
|
+
keys = test_strings.map { |x| new_model.hash_id(length, :alpha) }
|
692
|
+
keys.each do |key|
|
693
|
+
key.each_char do |char|
|
694
|
+
char[/[A-Za-z0-9]/].should_not be_nil
|
695
|
+
end
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
699
|
+
end
|
700
|
+
|
701
|
+
describe "#uuid" do
|
702
|
+
class UUIDModel < Watirmark::Model::Factory
|
703
|
+
keywords :first_name, :last_name
|
704
|
+
defaults do
|
705
|
+
first_name { "First" }
|
706
|
+
middle_name { "Middle" }
|
707
|
+
last_name { "Last #{uuid}" }
|
708
|
+
end
|
709
|
+
end
|
710
|
+
|
711
|
+
let(:model1) {UUIDModel.new}
|
712
|
+
let(:model2) {UUIDModel.new}
|
713
|
+
let(:model3) {UUIDModel.new}
|
714
|
+
|
715
|
+
specify "UUIDModel should have a 10 digit uuid and are never the same" do
|
716
|
+
[model1, model2].each{|x| x.last_name.should match(/^Last [a-f0-9]{10}$/)}
|
717
|
+
model1.last_name.should_not == model2.last_name
|
718
|
+
end
|
719
|
+
|
720
|
+
specify "UUIDModels should have a different 10 digit uuid when they are initialized with a different UUID" do
|
721
|
+
model_seed_1 = UUIDModel.new
|
722
|
+
Watirmark::Configuration.instance.uuid = "1234567890"
|
723
|
+
model_seed_2 = UUIDModel.new
|
724
|
+
Watirmark::Configuration.instance.uuid = "0987654321"
|
725
|
+
model_seed_3 = UUIDModel.new
|
726
|
+
|
727
|
+
[model_seed_1, model_seed_2, model_seed_3].each do |x|
|
728
|
+
#puts x.last_name
|
729
|
+
x.last_name.should match(/^Last [a-f0-9]{10}$/)
|
730
|
+
end
|
731
|
+
[model_seed_1.last_name, model_seed_2.last_name, model_seed_3.last_name].uniq.length.should == 3
|
732
|
+
end
|
733
|
+
|
734
|
+
specify "UUIDModels should have different UUIDs if Watirmark::Configuration#uuid is not set" do
|
735
|
+
Watirmark::Configuration.instance.uuid = nil
|
736
|
+
Watirmark::Configuration.instance.uuid.should be_nil
|
737
|
+
UUIDModel.new.uuid.should_not == UUIDModel.new.uuid
|
738
|
+
end
|
739
|
+
|
740
|
+
specify "add a new attribute to a UUIDModel with the uuid" do
|
741
|
+
model1.foo = "bar #{model1.uuid}"
|
742
|
+
model2.zoo = "baz #{model1.uuid}"
|
743
|
+
|
744
|
+
model1.foo.gsub("bar", "baz").should == model2.zoo
|
745
|
+
end
|
746
|
+
|
747
|
+
after :all do
|
748
|
+
Watirmark::Configuration.instance.uuid = nil
|
749
|
+
end
|
750
|
+
|
751
|
+
end
|
data/spec/model_traits_spec.rb
CHANGED
@@ -49,6 +49,11 @@ describe "Traits" do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
before :all do
|
53
|
+
# guard against other tests setting UUID
|
54
|
+
Watirmark::Configuration.instance.uuid = nil
|
55
|
+
end
|
56
|
+
|
52
57
|
specify "should have different last names" do
|
53
58
|
a = FactoryTest::TraitsA.new
|
54
59
|
b = FactoryTest::TraitsB.new
|
data/spec/page_spec.rb
CHANGED
@@ -22,12 +22,20 @@ describe 'Page' do
|
|
22
22
|
class Page5 < Page1
|
23
23
|
keyword(:i) { "i" }
|
24
24
|
end
|
25
|
+
class Page6 < Page
|
26
|
+
|
27
|
+
end
|
25
28
|
|
26
29
|
@page1 = Page1.new
|
27
30
|
@page2 = Page2.new
|
28
31
|
@page3 = Page3.new
|
29
32
|
@page4 = Page4.new
|
30
33
|
@page5 = Page5.new
|
34
|
+
@page6 = Page6.new
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should handle empty keywords gracefully" do
|
38
|
+
@page6.keywords.should == []
|
31
39
|
end
|
32
40
|
|
33
41
|
it "should list its keywords" do
|
@@ -109,14 +117,14 @@ describe "keyword metadata inheritance" do
|
|
109
117
|
|
110
118
|
it 'should allow child to override superclass' do
|
111
119
|
child = Child.new
|
112
|
-
child.keywords.sort_by{|k| k.to_s}.should == [:a, :b, :c, :same]
|
120
|
+
child.keywords.sort_by { |k| k.to_s }.should == [:a, :b, :c, :same]
|
113
121
|
child.a.should == "a"
|
114
122
|
child.same.should == 'c1-child'
|
115
123
|
end
|
116
124
|
|
117
125
|
it 'should not bleed settings between children' do
|
118
126
|
child2 = Child2.new
|
119
|
-
child2.keywords.sort_by{|k| k.to_s}.should == [:a, :b, :g, :same]
|
127
|
+
child2.keywords.sort_by { |k| k.to_s }.should == [:a, :b, :g, :same]
|
120
128
|
child2.g.should == 'g'
|
121
129
|
child2.same.should == 'c1'
|
122
130
|
end
|
data/spec/process_page_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe 'ProcessPage' do
|
|
8
8
|
|
9
9
|
it 'should support an activate method' do
|
10
10
|
p = Watirmark::ProcessPage.new('pp')
|
11
|
-
lambda{p.activate}.should_not raise_error
|
11
|
+
lambda{p.activate}.should_not raise_error
|
12
12
|
end
|
13
13
|
|
14
14
|
end
|
@@ -118,9 +118,9 @@ describe 'Process Page Views' do
|
|
118
118
|
custom_method_called = false
|
119
119
|
Watirmark::ProcessPage.navigate_method_default = Proc.new { custom_method_called = true }
|
120
120
|
@processpagetest.a.should == 'a'
|
121
|
-
custom_method_called.should
|
121
|
+
custom_method_called.should == false
|
122
122
|
@processpagetest.b.should == 'b'
|
123
|
-
custom_method_called.should
|
123
|
+
custom_method_called.should == true
|
124
124
|
end
|
125
125
|
|
126
126
|
it 'should support defining the process page submit method' do
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe Watirmark::Session do
|
4
|
+
before :all do
|
5
|
+
@html = File.expand_path(File.dirname(__FILE__) + '/html/controller.html')
|
6
|
+
@config = Watirmark::Configuration.instance
|
7
|
+
end
|
8
|
+
|
9
|
+
before :each do
|
10
|
+
Watirmark::Session.instance.closebrowser
|
11
|
+
@config.reload
|
12
|
+
end
|
13
|
+
|
14
|
+
specify "check firefox to close the browser" do
|
15
|
+
session = Watirmark::Session.instance
|
16
|
+
b = session.openbrowser
|
17
|
+
b.goto "file://#{@html}"
|
18
|
+
session.closebrowser
|
19
|
+
b.instance_variable_get('@closed').should be true
|
20
|
+
end
|
21
|
+
|
22
|
+
specify 'does not run headless when headless set to false' do
|
23
|
+
@config.headless = false
|
24
|
+
session = Watirmark::Session.instance
|
25
|
+
b = session.openbrowser
|
26
|
+
b.goto "file://#{@html}"
|
27
|
+
b.title.should == "Controller Page"
|
28
|
+
b.instance_variable_get('@closed').should be false
|
29
|
+
session.instance_variable_get('@headless').should be_nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# CI can not use chrome; must verify locally
|
33
|
+
context "when running with Chrome" do
|
34
|
+
xit "check chrome to close the browser" do
|
35
|
+
@config.webdriver = 'chrome'
|
36
|
+
session = Watirmark::Session.instance
|
37
|
+
b = session.newsession
|
38
|
+
b.goto "file://#{@html}"
|
39
|
+
session.closebrowser
|
40
|
+
b.instance_variable_get('@closed').should be true
|
41
|
+
end
|
42
|
+
|
43
|
+
# Have to use chrome; headless doesn't always play well with Firefox
|
44
|
+
xit 'can run headless on linux' do
|
45
|
+
@config.webdriver = 'chrome'
|
46
|
+
@config.headless = true
|
47
|
+
session = Watirmark::Session.instance
|
48
|
+
b = session.openbrowser
|
49
|
+
b.goto "file://#{@html}"
|
50
|
+
b.title.should == "Controller Page"
|
51
|
+
b.instance_variable_get('@closed').should be false
|
52
|
+
session.instance_variable_get('@headless').should_not be_nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
data/spec/spec_helper.rb
CHANGED