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