Skip to content

Commit 309ffba

Browse files
committed
sarissa 0.9.9.7 tests added
1 parent f49f175 commit 309ffba

29 files changed

+3573
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2002-2024 Gargoyle Software Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* https://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
package org.htmlunit.libraries;
16+
17+
import org.htmlunit.WebDriverTestCase;
18+
import org.htmlunit.junit.BrowserRunner;
19+
import org.htmlunit.junit.BrowserRunner.Alerts;
20+
import org.junit.Test;
21+
import org.junit.runner.RunWith;
22+
import org.openqa.selenium.By;
23+
import org.openqa.selenium.WebDriver;
24+
import org.openqa.selenium.WebElement;
25+
26+
/**
27+
* Tests for 0.9.9.3 version of <a href="http://sarissa.sourceforge.net">Sarissa</a>.
28+
*
29+
* @author Ahmed Ashour
30+
* @author Marc Guillemot
31+
* @author Frank Danek
32+
* @author Ronald Brill
33+
*/
34+
@RunWith(BrowserRunner.class)
35+
public class Sarissa0997Test extends WebDriverTestCase {
36+
37+
/**
38+
* @throws Exception if an error occurs
39+
*/
40+
@Test
41+
@Alerts({"++++++++++++++++++", "+", "+", "+", "+++", "++", "++++++++"})
42+
public void sarissa() throws Exception {
43+
startWebServer("src/test/resources/libraries/sarissa/0.9.9.7", null, null);
44+
final String url = URL_FIRST + "test/testsarissa.html";
45+
46+
final WebDriver driver = getWebDriver();
47+
driver.get(url);
48+
49+
driver.switchTo().alert().dismiss();
50+
51+
verify(driver, "SarissaTestCase", getExpectedAlerts()[0]);
52+
verify(driver, "XmlHttpRequestTestCase", getExpectedAlerts()[1]);
53+
verify(driver, "XMLSerializerTestCase", getExpectedAlerts()[2]);
54+
verify(driver, "DOMParserTestCase", getExpectedAlerts()[3]);
55+
verify(driver, "XMLDocumentTestCase", getExpectedAlerts()[4]);
56+
verify(driver, "XMLElementTestCase", getExpectedAlerts()[5]);
57+
verify(driver, "XSLTProcessorTestCase", getExpectedAlerts()[6]);
58+
}
59+
60+
/**
61+
* @param expectedResult empty for successful test or in the form of "+++F+++"
62+
* for failing tests (see the results in a real browser)
63+
*/
64+
private static void verify(final WebDriver driver, final String testName, final String expectedResult) {
65+
final WebElement div =
66+
driver.findElement(By.xpath("//div[@class='placeholder' and a[@name='#" + testName + "']]"));
67+
68+
String text = div.getText();
69+
text = text.substring(0, text.indexOf(String.valueOf(expectedResult.length()))).trim();
70+
assertEquals(testName + " Results\n" + expectedResult, text);
71+
}
72+
}
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
body {
21+
margin: 0px;
22+
padding: 0px;
23+
}
24+
img {
25+
border:none;
26+
}
27+
table {
28+
padding:0px;
29+
width: 100%;
30+
margin-left: -2px;
31+
margin-right: -2px;
32+
}
33+
acronym {
34+
cursor: help;
35+
border-bottom: 1px dotted #feb;
36+
}
37+
table.bodyTable th, table.bodyTable td {
38+
padding: 2px 4px 2px 4px;
39+
vertical-align: top;
40+
}
41+
div.clear{
42+
clear:both;
43+
visibility: hidden;
44+
}
45+
div.clear hr{
46+
display: none;
47+
}
48+
#bannerLeft, #bannerRight {
49+
font-size: xx-large;
50+
font-weight: bold;
51+
}
52+
#bannerLeft img, #bannerRight img {
53+
margin: 0px;
54+
}
55+
.xleft, #bannerLeft img {
56+
float:left;
57+
}
58+
.xright, #bannerRight {
59+
float:right;
60+
}
61+
#banner {
62+
padding: 0px;
63+
}
64+
#banner img {
65+
border: none;
66+
}
67+
#breadcrumbs {
68+
padding: 3px 10px 3px 10px;
69+
}
70+
#leftColumn {
71+
width: 170px;
72+
float:left;
73+
overflow: auto;
74+
}
75+
#bodyColumn {
76+
margin-right: 1.5em;
77+
margin-left: 197px;
78+
}
79+
#legend {
80+
padding: 8px 0 8px 0;
81+
}
82+
#navcolumn {
83+
padding: 8px 4px 0 8px;
84+
}
85+
#navcolumn h5 {
86+
margin: 0;
87+
padding: 0;
88+
font-size: small;
89+
}
90+
#navcolumn ul {
91+
margin: 0;
92+
padding: 0;
93+
font-size: small;
94+
}
95+
#navcolumn li {
96+
list-style-type: none;
97+
background-image: none;
98+
background-repeat: no-repeat;
99+
background-position: 0 0.4em;
100+
padding-left: 16px;
101+
list-style-position: outside;
102+
line-height: 1.2em;
103+
font-size: smaller;
104+
}
105+
#navcolumn li.expanded {
106+
background-image: url(../images/expanded.gif);
107+
}
108+
#navcolumn li.collapsed {
109+
background-image: url(../images/collapsed.gif);
110+
}
111+
#navcolumn li.none {
112+
text-indent: -1em;
113+
margin-left: 1em;
114+
}
115+
#poweredBy {
116+
text-align: center;
117+
}
118+
#navcolumn img {
119+
margin-top: 10px;
120+
margin-bottom: 3px;
121+
}
122+
#poweredBy img {
123+
display:block;
124+
margin: 20px 0 20px 17px;
125+
}
126+
#search img {
127+
margin: 0px;
128+
display: block;
129+
}
130+
#search #q, #search #btnG {
131+
border: 1px solid #999;
132+
margin-bottom:10px;
133+
}
134+
#search form {
135+
margin: 0px;
136+
}
137+
#lastPublished {
138+
font-size: x-small;
139+
}
140+
.navSection {
141+
margin-bottom: 2px;
142+
padding: 8px;
143+
}
144+
.navSectionHead {
145+
font-weight: bold;
146+
font-size: x-small;
147+
}
148+
.section {
149+
padding: 4px;
150+
}
151+
#footer {
152+
padding: 3px 10px 3px 10px;
153+
font-size: x-small;
154+
}
155+
#breadcrumbs {
156+
font-size: x-small;
157+
margin: 0pt;
158+
}
159+
.source {
160+
padding: 12px;
161+
margin: 1em 7px 1em 7px;
162+
}
163+
.source pre {
164+
margin: 0px;
165+
padding: 0px;
166+
}
167+
#navcolumn img.imageLink, .imageLink {
168+
padding-left: 0px;
169+
padding-bottom: 0px;
170+
padding-top: 0px;
171+
padding-right: 2px;
172+
border: 0px;
173+
margin: 0px;
174+
}

0 commit comments

Comments
 (0)