redsquirrel-safariwatir 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,151 @@
1
+ require 'rubygems'
2
+ require 'safariwatir'
3
+
4
+ # TODO
5
+ #
6
+ # Looking up textareas, or any input element for that matter, by index
7
+ #
8
+ # Be more attached to the Safari window.
9
+ # Currently, if a different window is selected, the AppleScript executes against it.
10
+ # Verify onclick is working for buttons and links
11
+ # TextFields should not respond to button method, etc.
12
+
13
+ # Unsupported Elements: Test that P/Div/Span/TD handle link, button, etc.,
14
+ # Javascript confirm [OK/CANCEL], Javascript prompt, Javascript popup windows
15
+
16
+ # Need to find a better way to distinguish between a submit button and a checkbox, re: page_load
17
+
18
+ # SAFARI ISSUES
19
+ # Labels are not clickable
20
+ # No known way to programatically click a <button>
21
+ # Links with href="javascript:foo()"
22
+
23
+ safari = Watir::Safari.new
24
+
25
+ def safari.google_to_prag
26
+ goto("http://google.com")
27
+ text_field(:name, "q").set("pickaxe")
28
+ button(:name, "btnG").click
29
+ link(:text, /Programming Ruby/).click
30
+ link(:url, "http://www.pragprog.com/titles/ruby/source_code").click
31
+ link(:text, "All Categories").click
32
+ link(:text, "All Titles").click
33
+ link(:url, /retrospectives/).click
34
+ puts "FAILURE prag" unless contains_text("Dave Hoover")
35
+ end
36
+
37
+ def safari.ala
38
+ goto("http://alistapart.com/")
39
+ text_field(:id, "search").set("grail")
40
+ checkbox(:id, "incdisc").set
41
+ button(:id, "submit").click
42
+ puts "FAILURE ala" unless contains_text('Search Results for “grail”')
43
+ end
44
+
45
+ def safari.amazon
46
+ goto("http://amazon.com")
47
+ select_list(:name, "url").select("VHS")
48
+ select_list(:name, "url").select_value("search-alias=stripbooks")
49
+ text_field(:name, "field-keywords").set("potter")
50
+ button(:name, "Go").click
51
+ puts "FAILURE amazon" unless contains_text("Deathly Hallows")
52
+ end
53
+
54
+ def safari.google_advanced
55
+ goto("http://www.google.com/advanced_search")
56
+ radio(:name, "safe", "active").set
57
+ radio(:name, "safe", "images").set
58
+ # Safari doesn't support label clicking ... perhaps I should raise an Exception
59
+ label(:text, "No filtering").click
60
+ radio(:id, "ss").set
61
+ text_field(:name, "as_q").set("obtiva")
62
+ button(:name, "btnG").click
63
+ puts "FAILURE google" unless contains_text("Training, Coaching, and Software Development")
64
+ end
65
+
66
+ def safari.reddit
67
+ goto("http://reddit.com/")
68
+ text_field(:name, "user").set("foo")
69
+ password(:name, "passwd").set("bar")
70
+ form(:index, 2).submit
71
+ puts "FAILURE reddit" unless contains_text("foo") and contains_text("logout")
72
+ end
73
+
74
+ def safari.colbert
75
+ goto("http://www.colbertnation.com/cn/contact.php")
76
+ text_field(:name, "formmessage").set("Beware the Bear")
77
+ button(:value, "Send Email").click
78
+ puts "FAILURE colbert" unless text_field(:name, "formmessage").verify_contains(/Enter message/)
79
+ end
80
+
81
+ def safari.redsquirrel
82
+ goto("http://redsquirrel.com/")
83
+ begin
84
+ text_field(:id, "not_there").set("imaginary")
85
+ puts "FAILURE squirrel text no e"
86
+ rescue Watir::UnknownObjectException => e
87
+ puts "FAILURE squirrel text bad e" unless e.message =~ /not_there/
88
+ end
89
+ begin
90
+ link(:text, "no_where").click
91
+ puts "FAILURE squirrel link no e"
92
+ rescue Watir::UnknownObjectException => e
93
+ puts "FAILURE squirrel link bad e" unless e.message =~ /no_where/
94
+ end
95
+ end
96
+
97
+ def safari.weinberg
98
+ goto("http://www.geraldmweinberg.com/")
99
+ puts "FAILURE weinberg menu" unless frame("menu").contains_text("Jerry Weinberg's Site")
100
+ frame("menu").link(:text, "Books").click
101
+ frame("menu").link(:text, /psychology/i).click
102
+ puts "FAILURE weinberg content" unless frame("content").contains_text("Silver Anniversary")
103
+ end
104
+
105
+ def safari.tables
106
+ # Site Redesign, need to update test
107
+ # goto("http://basecamphq.com/")
108
+ # puts "FAILURE basecamp content" unless table(:index, 1)[1][2].text =~ /What is Basecamp\?/
109
+
110
+ goto("http://www.jimthatcher.com/webcourse9.htm")
111
+ puts "FAILURE thatcher" unless cell(:id, "c5").text == "subtotals"
112
+
113
+ goto("http://amazon.com/")
114
+ if contains_text("If you're not")
115
+ link(:text, "click here").click
116
+ end
117
+
118
+ puts "FAILURE amazon tr" unless row(:id, "twotabtop")[2].text =~ /Your\s+Amazon\.com/
119
+ row(:id, "twotabtop")[2].link(:index, 1).click
120
+ puts "FAILURE amazon link" unless contains_text("personalized recommendations")
121
+
122
+ goto("http://www.dreamweaverresources.com/tutorials/tableborder.htm")
123
+ puts "FAILURE dreamweaver" unless table(:id, "titletable")[1][1].text =~ /CSS/
124
+ end
125
+
126
+ def safari.onchange
127
+ goto("http://www.gr8cardeal.co.uk/?s=1")
128
+ select_list(:name, "manufacturer").select_value("BMW")
129
+ sleep 0.3 # There's an Ajax call here
130
+ select_list(:name, "model").select_value("Z4 ROADSTER")
131
+ end
132
+
133
+ def safari.ruby_sponsor_images
134
+ goto("http://mtnwestruby.org/")
135
+ puts "FAILURE image obtiva" unless image(:src, "http://mtnwestruby.org/images/sponsors/obtiva_logo.png").exists?
136
+ puts "FAILURE image thoughtworks" unless image(:src, /thoughtworks/).exists?
137
+ end
138
+
139
+ begin
140
+ safari.google_to_prag
141
+ safari.ala
142
+ safari.amazon
143
+ safari.google_advanced
144
+ safari.reddit
145
+ safari.colbert
146
+ safari.redsquirrel
147
+ safari.weinberg
148
+ safari.tables
149
+ safari.onchange
150
+ safari.ruby_sponsor_images
151
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redsquirrel-safariwatir
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.5
5
+ platform: ruby
6
+ authors:
7
+ - Dave Hoover
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-18 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rb-appscript
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: WATIR stands for "Web Application Testing in Ruby". See WATIR project for more information. This is a Safari-version of the original IE-only WATIR.
26
+ email: dave@obtiva.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - lib/safariwatir/core_ext.rb
33
+ - lib/safariwatir/scripter.rb
34
+ - lib/safariwatir.rb
35
+ - lib/watir/exceptions.rb
36
+ - README.rdoc
37
+ files:
38
+ - lib/safariwatir/core_ext.rb
39
+ - lib/safariwatir/scripter.rb
40
+ - lib/safariwatir.rb
41
+ - lib/watir/exceptions.rb
42
+ - Manifest
43
+ - Rakefile
44
+ - README.rdoc
45
+ - safariwatir.gemspec
46
+ - safariwatir_example.rb
47
+ has_rdoc: true
48
+ homepage: http://safariwatir.rubyforge.org/
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --line-numbers
52
+ - --inline-source
53
+ - --title
54
+ - Safariwatir
55
+ - --main
56
+ - README.rdoc
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "1.2"
70
+ version:
71
+ requirements: []
72
+
73
+ rubyforge_project: safariwatir
74
+ rubygems_version: 1.2.0
75
+ signing_key:
76
+ specification_version: 2
77
+ summary: Automated testing tool for web applications.
78
+ test_files: []
79
+