1447
|
1 |
"{ Package: 'stx:goodies/regression' }"
|
359
|
2 |
|
|
3 |
"{ NameSpace: RegressionTests }"
|
|
4 |
|
|
5 |
TestCase subclass:#HTMLParserTests
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
1550
|
9 |
category:'tests-Regression-XML'
|
359
|
10 |
!
|
|
11 |
|
|
12 |
!HTMLParserTests class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
documentation
|
|
15 |
"
|
|
16 |
documentation to be added.
|
|
17 |
|
|
18 |
[author:]
|
1447
|
19 |
mb (mb@SUNGSAM)
|
359
|
20 |
|
|
21 |
[instance variables:]
|
|
22 |
|
|
23 |
[class variables:]
|
|
24 |
|
|
25 |
[see also:]
|
|
26 |
|
|
27 |
"
|
|
28 |
!
|
|
29 |
|
|
30 |
history
|
|
31 |
"Created: / 15-01-2009 / 12:44:33 / mb"
|
|
32 |
! !
|
|
33 |
|
|
34 |
!HTMLParserTests methodsFor:'initialize / release'!
|
|
35 |
|
|
36 |
setUp
|
|
37 |
"common setup - invoked before testing."
|
|
38 |
|
1662
|
39 |
(Smalltalk classNamed:'stx_goodies_webServer_htmlTree') isNil ifTrue:[
|
|
40 |
(Smalltalk loadPackage:'stx:goodies/webServer/htmlTree') ifFalse:[
|
|
41 |
self error:'stx:goodies/webServer/htmlTree cannot be loaded'.
|
|
42 |
].
|
|
43 |
].
|
|
44 |
(Smalltalk classNamed:'stx_goodies_webServer_htmlTree') load.
|
|
45 |
|
|
46 |
"Modified: / 31-07-2017 / 11:40:25 / mawalch"
|
359
|
47 |
!
|
|
48 |
|
|
49 |
tearDown
|
|
50 |
"common cleanup - invoked after testing."
|
|
51 |
|
|
52 |
super tearDown
|
|
53 |
! !
|
|
54 |
|
|
55 |
!HTMLParserTests methodsFor:'tests'!
|
|
56 |
|
|
57 |
test01
|
|
58 |
|el|
|
|
59 |
|
|
60 |
el := HTML::HTMLParser parseText:'
|
|
61 |
<HEAD>
|
|
62 |
</HEAD>
|
|
63 |
'.
|
1677
|
64 |
"/ el inspect.
|
359
|
65 |
|
|
66 |
"
|
|
67 |
self new test01
|
|
68 |
"
|
|
69 |
!
|
|
70 |
|
|
71 |
test02
|
|
72 |
|doc|
|
|
73 |
|
|
74 |
doc := HTML::HTMLParser parseText:'
|
|
75 |
<!!--
|
|
76 |
Copyright 2004 ThoughtWorks, Inc
|
|
77 |
|
|
78 |
Licensed under the Apache License, Version 2.0 (the "License");
|
|
79 |
you may not use this file except in compliance with the License.
|
|
80 |
You may obtain a copy of the License at
|
|
81 |
|
|
82 |
http://www.apache.org/licenses/LICENSE-2.0
|
|
83 |
|
|
84 |
Unless required by applicable law or agreed to in writing, software
|
|
85 |
distributed under the License is distributed on an "AS IS" BASIS,
|
|
86 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
87 |
See the License for the specific language governing permissions and
|
|
88 |
limitations under the License.
|
|
89 |
-->
|
|
90 |
<html>
|
|
91 |
<head>
|
|
92 |
<meta content="text/html; charset=ISO-8859-1"
|
|
93 |
http-equiv="content-type">
|
|
94 |
<title>Test Open</title>
|
|
95 |
</head>
|
|
96 |
<body>
|
|
97 |
<table cellpadding="1" cellspacing="1" border="1">
|
|
98 |
<tbody>
|
|
99 |
<tr>
|
|
100 |
<td rowspan="1" colspan="3">Google Test Search<br>
|
|
101 |
</td>
|
|
102 |
</tr>
|
|
103 |
<tr>
|
|
104 |
<td>open</td>
|
|
105 |
<td>http://www.google.com/webhp?hl=en</td>
|
|
106 |
<td> </td>
|
|
107 |
</tr>
|
|
108 |
<tr>
|
|
109 |
<td>verifyTitle</td>
|
|
110 |
<td>Google</td>
|
|
111 |
<td> </td>
|
|
112 |
</tr>
|
|
113 |
<tr>
|
|
114 |
<td>type</td>
|
|
115 |
<td>q</td>
|
|
116 |
<td>Selenium OpenQA</td>
|
|
117 |
</tr>
|
|
118 |
<tr>
|
|
119 |
<td>verifyValue</td>
|
|
120 |
<td>q</td>
|
|
121 |
<td>Selenium OpenQA</td>
|
|
122 |
</tr>
|
|
123 |
<tr>
|
|
124 |
<td>clickAndWait</td>
|
|
125 |
<td>btnG</td>
|
|
126 |
<td> </td>
|
|
127 |
</tr>
|
|
128 |
<tr>
|
|
129 |
<td>verifyTextPresent</td>
|
|
130 |
<td>openqa.org</td>
|
|
131 |
<td> </td>
|
|
132 |
</tr>
|
|
133 |
<tr>
|
|
134 |
<td>verifyTitle</td>
|
|
135 |
<td>Selenium OpenQA - Google Search</td>
|
|
136 |
<td> </td>
|
|
137 |
</tr>
|
|
138 |
</tbody>
|
|
139 |
|
|
140 |
</table>
|
|
141 |
</body>
|
|
142 |
</html>
|
|
143 |
'.
|
1677
|
144 |
self assert:(doc children first tagName = 'head').
|
359
|
145 |
|
|
146 |
"
|
|
147 |
self new test02
|
|
148 |
"
|
|
149 |
!
|
|
150 |
|
|
151 |
test03
|
|
152 |
|doc|
|
|
153 |
|
|
154 |
doc := HTML::HTMLParser parseText:'
|
|
155 |
<!!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
156 |
<!!--
|
|
157 |
Copyright 2004 ThoughtWorks, Inc
|
|
158 |
|
|
159 |
Licensed under the Apache License, Version 2.0 (the "License");
|
|
160 |
you may not use this file except in compliance with the License.
|
|
161 |
You may obtain a copy of the License at
|
|
162 |
|
|
163 |
http://www.apache.org/licenses/LICENSE-2.0
|
|
164 |
|
|
165 |
Unless required by applicable law or agreed to in writing, software
|
|
166 |
distributed under the License is distributed on an "AS IS" BASIS,
|
|
167 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
168 |
See the License for the specific language governing permissions and
|
|
169 |
limitations under the License.
|
|
170 |
-->
|
|
171 |
<html>
|
|
172 |
<head>
|
|
173 |
<meta content="text/html; charset=ISO-8859-1"
|
|
174 |
http-equiv="content-type">
|
|
175 |
<title>Test Open</title>
|
|
176 |
</head>
|
|
177 |
<body>
|
|
178 |
<table cellpadding="1" cellspacing="1" border="1">
|
|
179 |
<tbody>
|
|
180 |
<tr>
|
|
181 |
<td rowspan="1" colspan="3">Google Test Search<br>
|
|
182 |
</td>
|
|
183 |
</tr>
|
|
184 |
<tr>
|
|
185 |
<td>open</td>
|
|
186 |
<td>http://www.google.com/webhp?hl=en</td>
|
|
187 |
<td> </td>
|
|
188 |
</tr>
|
|
189 |
<tr>
|
|
190 |
<td>verifyTitle</td>
|
|
191 |
<td>Google</td>
|
|
192 |
<td> </td>
|
|
193 |
</tr>
|
|
194 |
<tr>
|
|
195 |
<td>type</td>
|
|
196 |
<td>q</td>
|
|
197 |
<td>Selenium OpenQA</td>
|
|
198 |
</tr>
|
|
199 |
<tr>
|
|
200 |
<td>verifyValue</td>
|
|
201 |
<td>q</td>
|
|
202 |
<td>Selenium OpenQA</td>
|
|
203 |
</tr>
|
|
204 |
<tr>
|
|
205 |
<td>clickAndWait</td>
|
|
206 |
<td>btnG</td>
|
|
207 |
<td> </td>
|
|
208 |
</tr>
|
|
209 |
<tr>
|
|
210 |
<td>verifyTextPresent</td>
|
|
211 |
<td>openqa.org</td>
|
|
212 |
<td> </td>
|
|
213 |
</tr>
|
|
214 |
<tr>
|
|
215 |
<td>verifyTitle</td>
|
|
216 |
<td>Selenium OpenQA - Google Search</td>
|
|
217 |
<td> </td>
|
|
218 |
</tr>
|
|
219 |
</tbody>
|
|
220 |
|
|
221 |
</table>
|
|
222 |
</body>
|
|
223 |
</html>
|
|
224 |
'.
|
360
|
225 |
self assert:(doc children first tagName = 'head').
|
|
226 |
self assert:(doc docType = '-//W3C//DTD HTML 4.01 Transitional//EN').
|
359
|
227 |
|
|
228 |
"
|
|
229 |
self new test03
|
|
230 |
"
|
|
231 |
! !
|
|
232 |
|
|
233 |
!HTMLParserTests class methodsFor:'documentation'!
|
|
234 |
|
|
235 |
version
|
|
236 |
^ '$Header$'
|
|
237 |
! !
|
1550
|
238 |
|