RegressionTests__HTMLParserTests.st
author Claus Gittinger <cg@exept.de>
Tue, 26 Mar 2019 18:29:04 +0100
changeset 2169 a1a0194d9890
parent 2158 d641af2ffa0d
child 2202 145d31a73d22
permissions -rw-r--r--
#OTHER by cg class: TestCase category of: #setUp #tearDown
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
     1
"{ Package: 'stx:goodies/regression' }"
359
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     2
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     3
"{ NameSpace: RegressionTests }"
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     4
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     5
TestCase subclass:#HTMLParserTests
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     6
	instanceVariableNames:''
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     7
	classVariableNames:''
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
     8
	poolDictionaries:''
1550
419ac7b220a4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
     9
	category:'tests-Regression-XML'
359
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    10
!
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    11
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    12
!HTMLParserTests class methodsFor:'documentation'!
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    13
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    14
documentation
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    15
"
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    16
    documentation to be added.
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    17
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    18
    [author:]
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
    19
	mb (mb@SUNGSAM)
359
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    20
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    21
    [instance variables:]
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    22
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    23
    [class variables:]
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    24
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    25
    [see also:]
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    26
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    27
"
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    28
!
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    29
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    30
history
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    31
    "Created: / 15-01-2009 / 12:44:33 / mb"
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    32
! !
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    33
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    34
!HTMLParserTests methodsFor:'initialize / release'!
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    35
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    36
setUp
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    37
    "common setup - invoked before testing."
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    38
1662
bf66d3880737 #BUGFIX by mawalch
mawalch
parents: 1550
diff changeset
    39
    (Smalltalk classNamed:'stx_goodies_webServer_htmlTree') isNil ifTrue:[
bf66d3880737 #BUGFIX by mawalch
mawalch
parents: 1550
diff changeset
    40
        (Smalltalk loadPackage:'stx:goodies/webServer/htmlTree') ifFalse:[
bf66d3880737 #BUGFIX by mawalch
mawalch
parents: 1550
diff changeset
    41
            self error:'stx:goodies/webServer/htmlTree cannot be loaded'.
bf66d3880737 #BUGFIX by mawalch
mawalch
parents: 1550
diff changeset
    42
        ].
bf66d3880737 #BUGFIX by mawalch
mawalch
parents: 1550
diff changeset
    43
    ].
bf66d3880737 #BUGFIX by mawalch
mawalch
parents: 1550
diff changeset
    44
    (Smalltalk classNamed:'stx_goodies_webServer_htmlTree') load.
bf66d3880737 #BUGFIX by mawalch
mawalch
parents: 1550
diff changeset
    45
bf66d3880737 #BUGFIX by mawalch
mawalch
parents: 1550
diff changeset
    46
    "Modified: / 31-07-2017 / 11:40:25 / mawalch"
359
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    47
!
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    48
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    49
tearDown
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    50
    "common cleanup - invoked after testing."
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    51
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    52
    super tearDown
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    53
! !
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    54
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    55
!HTMLParserTests methodsFor:'tests'!
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    56
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    57
test01
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    58
    |el|
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    59
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    60
    el := HTML::HTMLParser parseText:'
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    61
<HEAD>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    62
</HEAD>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    63
'.
1677
308cf4307f5d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
    64
    "/ el inspect.
359
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    65
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    66
    "
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    67
     self new test01
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    68
    "
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    69
!
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    70
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    71
test02
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    72
    |doc|
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    73
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    74
    doc := HTML::HTMLParser parseText:'
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    75
<!!--
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    76
Copyright 2004 ThoughtWorks, Inc
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    77
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    78
 Licensed under the Apache License, Version 2.0 (the "License");
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    79
 you may not use this file except in compliance with the License.
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    80
 You may obtain a copy of the License at
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    81
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    82
     http://www.apache.org/licenses/LICENSE-2.0
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    83
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    84
 Unless required by applicable law or agreed to in writing, software
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    85
 distributed under the License is distributed on an "AS IS" BASIS,
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    86
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    87
 See the License for the specific language governing permissions and
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    88
 limitations under the License.
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    89
-->
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    90
<html>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    91
<head>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    92
  <meta content="text/html; charset=ISO-8859-1"
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    93
 http-equiv="content-type">
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    94
  <title>Test Open</title>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    95
</head>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    96
<body>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    97
<table cellpadding="1" cellspacing="1" border="1">
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    98
  <tbody>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
    99
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   100
      <td rowspan="1" colspan="3">Google Test Search<br>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   101
      </td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   102
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   103
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   104
      <td>open</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   105
      <td>http://www.google.com/webhp?hl=en</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   106
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   107
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   108
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   109
      <td>verifyTitle</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   110
      <td>Google</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   111
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   112
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   113
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   114
      <td>type</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   115
      <td>q</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   116
      <td>Selenium OpenQA</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   117
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   118
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   119
      <td>verifyValue</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   120
      <td>q</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   121
      <td>Selenium OpenQA</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   122
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   123
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   124
      <td>clickAndWait</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   125
      <td>btnG</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   126
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   127
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   128
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   129
      <td>verifyTextPresent</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   130
      <td>openqa.org</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   131
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   132
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   133
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   134
      <td>verifyTitle</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   135
      <td>Selenium OpenQA - Google Search</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   136
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   137
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   138
  </tbody>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   139
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   140
</table>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   141
</body>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   142
</html>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   143
'.
1677
308cf4307f5d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
   144
    self assert:(doc children first tagName = 'head').
359
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   145
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   146
    "
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   147
     self new test02
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   148
    "
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   149
!
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   150
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   151
test03
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   152
    |doc|
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   153
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   154
    doc := HTML::HTMLParser parseText:'
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   155
<!!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   156
<!!--
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   157
Copyright 2004 ThoughtWorks, Inc
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   158
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   159
 Licensed under the Apache License, Version 2.0 (the "License");
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   160
 you may not use this file except in compliance with the License.
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   161
 You may obtain a copy of the License at
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   162
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   163
     http://www.apache.org/licenses/LICENSE-2.0
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   164
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   165
 Unless required by applicable law or agreed to in writing, software
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   166
 distributed under the License is distributed on an "AS IS" BASIS,
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   167
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   168
 See the License for the specific language governing permissions and
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   169
 limitations under the License.
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   170
-->
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   171
<html>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   172
<head>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   173
  <meta content="text/html; charset=ISO-8859-1"
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   174
 http-equiv="content-type">
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   175
  <title>Test Open</title>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   176
</head>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   177
<body>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   178
<table cellpadding="1" cellspacing="1" border="1">
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   179
  <tbody>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   180
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   181
      <td rowspan="1" colspan="3">Google Test Search<br>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   182
      </td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   183
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   184
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   185
      <td>open</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   186
      <td>http://www.google.com/webhp?hl=en</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   187
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   188
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   189
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   190
      <td>verifyTitle</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   191
      <td>Google</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   192
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   193
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   194
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   195
      <td>type</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   196
      <td>q</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   197
      <td>Selenium OpenQA</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   198
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   199
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   200
      <td>verifyValue</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   201
      <td>q</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   202
      <td>Selenium OpenQA</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   203
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   204
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   205
      <td>clickAndWait</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   206
      <td>btnG</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   207
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   208
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   209
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   210
      <td>verifyTextPresent</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   211
      <td>openqa.org</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   212
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   213
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   214
    <tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   215
      <td>verifyTitle</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   216
      <td>Selenium OpenQA - Google Search</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   217
      <td>&nbsp;</td>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   218
    </tr>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   219
  </tbody>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   220
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   221
</table>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   222
</body>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   223
</html>
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   224
'.
360
9956901550ae caer for the docType
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   225
    self assert:(doc children first tagName = 'head').
9956901550ae caer for the docType
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   226
    self assert:(doc docType = '-//W3C//DTD HTML 4.01 Transitional//EN').
359
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   227
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   228
    "
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   229
     self new test03
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   230
    "
1975
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   231
!
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   232
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   233
test04_style
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   234
    |doc headElement styleElement styleText|
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   235
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   236
    "/ verify: no ampersand escaping in style elements
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   237
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   238
    UserNotification ignoreIn:[
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   239
        doc := HTML::HTMLParser parseText:'
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   240
<!!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   241
<html>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   242
<head>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   243
<style>foo bar &bla &froboz &amp; &amp foo</style>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   244
</head>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   245
<body>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   246
</body>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   247
</html>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   248
'.
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   249
    ].
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   250
    headElement := doc children first.
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   251
    self assert:(headElement tagName = 'head').
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   252
    styleElement := headElement children first.
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   253
    self assert:(styleElement tagName = 'style').
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   254
    styleText := HTML::TextExtractor extractTextFromElement:styleElement.
1988
5960dfd0abd7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
   255
    self assert:(styleText = 'foo bar &bla &froboz & &amp foo').
1975
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   256
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   257
    "
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   258
     self new test04_style
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   259
    "
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   260
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   261
    "Created: / 27-06-2018 / 12:58:48 / Claus Gittinger"
1988
5960dfd0abd7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
   262
    "Modified: / 16-07-2018 / 19:49:23 / Claus Gittinger"
1975
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   263
!
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   264
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   265
test05_textExtraction
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   266
     |doc bodyElement p|
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   267
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   268
    "/ verify: no ampersand escaping in style elements
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   269
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   270
     UserNotification ignoreIn:[
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   271
        doc := HTML::HTMLParser parseText:'
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   272
<!!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   273
<html>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   274
<body>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   275
<p>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   276
foo bar &bla &froboz &amp; &amp foo
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   277
</p>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   278
</body>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   279
</html>
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   280
'.
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   281
     ].
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   282
     bodyElement := doc body.
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   283
     p := bodyElement children first.
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   284
     self assert:(p extractedText = 'foo bar &bla &froboz & &amp foo').
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   285
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   286
    "
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   287
     self new test05_textExtraction
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   288
    "
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   289
6e10a8a87a04 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   290
    "Created: / 27-06-2018 / 15:28:31 / Claus Gittinger"
1987
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   291
!
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   292
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   293
test06_comments
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   294
     |doc bodyElement|
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   295
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   296
    "/ verify: no ampersand escaping in style elements
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   297
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   298
     UserNotification ignoreIn:[
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   299
        doc := HTML::HTMLParser parseText:'
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   300
<!!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   301
<html>
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   302
<body>
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   303
foo<!!--[foo]--><!!--bla-->bar
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   304
<!!--[foo]--><!!--bla-->
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   305
foo
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   306
<!!--[foo]--><!!--bla-->
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   307
bar
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   308
<!!--[foo]--><!!--bla-->
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   309
<p>
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   310
foo bar &bla &froboz &amp; &amp foo
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   311
</p>
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   312
</body>
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   313
</html>
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   314
'.
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   315
     ].
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   316
     bodyElement := doc body.
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   317
     self assert:(bodyElement extractedText = 'foo bar foo bar foo bar &bla &froboz & &amp foo').
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   318
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   319
    "
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   320
     self new test06_comments
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   321
    "
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   322
cefeb09f2d49 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1975
diff changeset
   323
    "Created: / 16-07-2018 / 19:43:12 / Claus Gittinger"
359
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   324
! !
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   325
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   326
!HTMLParserTests class methodsFor:'documentation'!
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   327
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   328
version
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   329
    ^ '$Header$'
1988
5960dfd0abd7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
   330
!
5960dfd0abd7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
   331
5960dfd0abd7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
   332
version_CVS
5960dfd0abd7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
   333
    ^ '$Header$'
359
6bee96fa6cc1 initial checkin
Michael Beyl <mb@exept.de>
parents:
diff changeset
   334
! !
1550
419ac7b220a4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   335