Skip to content

Commit 06c48d6

Browse files
committed
some tests are NYI
1 parent 09196f1 commit 06c48d6

1 file changed

Lines changed: 46 additions & 11 deletions

File tree

src/test/java/org/htmlunit/html/HtmlPage6Test.java

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.htmlunit.WebDriverTestCase;
2121
import org.htmlunit.junit.annotation.Alerts;
22+
import org.htmlunit.junit.annotation.HtmlUnitNYI;
2223
import org.htmlunit.util.MimeType;
2324
import org.htmlunit.util.NameValuePair;
2425
import org.junit.jupiter.api.Test;
@@ -108,6 +109,10 @@ public void refresh_MetaTag_no_url_label() throws Exception {
108109
*/
109110
@Test
110111
@Alerts({"wrong", "2", "§§URL§§abcd=§§URL§§second/"})
112+
@HtmlUnitNYI(CHROME = {"wrong", "2", "§§URL§§abcd=§§URL1§§second/"},
113+
EDGE = {"wrong", "2", "§§URL§§abcd=§§URL1§§second/"},
114+
FF = {"wrong", "2", "§§URL§§abcd=§§URL1§§second/"},
115+
FF_ESR = {"wrong", "2", "§§URL§§abcd=§§URL1§§second/"})
111116
public void refresh_MetaTag_wrong_url_label() throws Exception {
112117
testRefresh_MetaTag("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;abcd=§§URL§§\">");
113118
testRefresh_MetaTag("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; abcd=§§URL§§\">");
@@ -170,6 +175,19 @@ public void refresh_MetaTag_Double() throws Exception {
170175
testRefresh_MetaTag("<META HTTP-EQUIV='Refresh' CONTENT='1.2 ; URL=§§URL§§'>");
171176
}
172177

178+
/**
179+
* @throws Exception if an error occurs
180+
*/
181+
@Test
182+
@Alerts({"wrong", "2", "§§URL§§2;URL=§§URL§§second/"})
183+
@HtmlUnitNYI(CHROME = {"wrong", "2", "§§URL§§2;URL=§§URL1§§second/"},
184+
EDGE = {"wrong", "2", "§§URL§§2;URL=§§URL1§§second/"},
185+
FF = {"wrong", "2", "§§URL§§2;URL=§§URL1§§second/"},
186+
FF_ESR = {"wrong", "2", "§§URL§§2;URL=§§URL1§§second/"})
187+
public void refresh_MetaTag_DoubleComma() throws Exception {
188+
testRefresh_MetaTag("<META HTTP-EQUIV='Refresh' CONTENT='1,2;URL=§§URL§§'>");
189+
}
190+
173191
private void testRefresh_MetaTag(final String metaTag) throws Exception {
174192
final String firstContent = DOCTYPE_HTML
175193
+ "<html><head><title>first§</title>\n"
@@ -185,16 +203,21 @@ private void testRefresh_MetaTag(final String metaTag) throws Exception {
185203
getMockWebConnection().setDefaultResponse(wrongContent);
186204

187205
expandExpectedAlertsVariables(URL_FIRST);
206+
final String[] expectedAlerts = getExpectedAlerts();
207+
for (int i = 0; i < expectedAlerts.length; i++) {
208+
expectedAlerts[i] = expectedAlerts[i]
209+
.replaceAll("§§URL1§§", URL_FIRST.toExternalForm().replace("http://", "http:/"));
210+
}
211+
188212
final int count = getMockWebConnection().getRequestCount();
189213
final WebDriver driver = loadPage2(firstContent);
190214
if (useRealBrowser()) {
191215
Thread.sleep(DEFAULT_WAIT_TIME.multipliedBy(3).toMillis());
192216
}
193-
verifyTitle2(DEFAULT_WAIT_TIME, driver, getExpectedAlerts()[0]);
194-
assertEquals(Integer.parseInt(getExpectedAlerts()[1]), getMockWebConnection().getRequestCount() - count);
195-
if (getExpectedAlerts().length > 2) {
196-
final String exp = getExpectedAlerts()[2].replace("=http://", "=http:/");
197-
assertEquals(exp, getMockWebConnection().getLastWebRequest().getUrl().toString());
217+
verifyTitle2(DEFAULT_WAIT_TIME, driver, expectedAlerts[0]);
218+
assertEquals(Integer.parseInt(expectedAlerts[1]), getMockWebConnection().getRequestCount() - count);
219+
if (expectedAlerts.length > 2) {
220+
assertEquals(expectedAlerts[2], getMockWebConnection().getLastWebRequest().getUrl().toString());
198221
}
199222
}
200223

@@ -269,6 +292,10 @@ public void refresh_HttpResponseHeader_no_url_label() throws Exception {
269292
*/
270293
@Test
271294
@Alerts({"wrong", "2", "§§URL§§abcd=§§URL§§second/"})
295+
@HtmlUnitNYI(CHROME = {"wrong", "2", "§§URL§§abcd=§§URL1§§second/"},
296+
EDGE = {"wrong", "2", "§§URL§§abcd=§§URL1§§second/"},
297+
FF = {"wrong", "2", "§§URL§§abcd=§§URL1§§second/"},
298+
FF_ESR = {"wrong", "2", "§§URL§§abcd=§§URL1§§second/"})
272299
public void refresh_HttpResponseHeader_wrong_url_label() throws Exception {
273300
testRefresh_HttpResponseHeader("0;abcd=§§URL§§");
274301
testRefresh_HttpResponseHeader("0; abcd=§§URL§§");
@@ -329,12 +356,15 @@ public void refresh_HttpResponseHeader_Double() throws Exception {
329356
testRefresh_HttpResponseHeader("1.2 ; URL=§§URL§§");
330357
}
331358

332-
333359
/**
334360
* @throws Exception if an error occurs
335361
*/
336362
@Test
337363
@Alerts({"wrong", "2", "§§URL§§2;URL=§§URL§§second/"})
364+
@HtmlUnitNYI(CHROME = {"wrong", "2", "§§URL§§2;URL=§§URL1§§second/"},
365+
EDGE = {"wrong", "2", "§§URL§§2;URL=§§URL1§§second/"},
366+
FF = {"wrong", "2", "§§URL§§2;URL=§§URL1§§second/"},
367+
FF_ESR = {"wrong", "2", "§§URL§§2;URL=§§URL1§§second/"})
338368
public void refresh_HttpResponseHeader_DoubleComma() throws Exception {
339369
testRefresh_HttpResponseHeader("1,2;URL=§§URL§§");
340370
}
@@ -355,16 +385,21 @@ private void testRefresh_HttpResponseHeader(final String refreshHeader) throws E
355385
getMockWebConnection().setDefaultResponse(wrongContent);
356386

357387
expandExpectedAlertsVariables(URL_FIRST);
388+
final String[] expectedAlerts = getExpectedAlerts();
389+
for (int i = 0; i < expectedAlerts.length; i++) {
390+
expectedAlerts[i] = expectedAlerts[i]
391+
.replaceAll("§§URL1§§", URL_FIRST.toExternalForm().replace("http://", "http:/"));
392+
}
393+
358394
final int count = getMockWebConnection().getRequestCount();
359395
final WebDriver driver = loadPage2(URL_FIRST, StandardCharsets.ISO_8859_1);
360396
if (useRealBrowser()) {
361397
Thread.sleep(DEFAULT_WAIT_TIME.multipliedBy(3).toMillis());
362398
}
363-
verifyTitle2(DEFAULT_WAIT_TIME, driver, getExpectedAlerts()[0]);
364-
assertEquals(Integer.parseInt(getExpectedAlerts()[1]), getMockWebConnection().getRequestCount() - count);
365-
if (getExpectedAlerts().length > 2) {
366-
final String exp = getExpectedAlerts()[2].replace("=http://", "=http:/");
367-
assertEquals(exp, getMockWebConnection().getLastWebRequest().getUrl().toString());
399+
verifyTitle2(DEFAULT_WAIT_TIME, driver, expectedAlerts[0]);
400+
assertEquals(Integer.parseInt(expectedAlerts[1]), getMockWebConnection().getRequestCount() - count);
401+
if (expectedAlerts.length > 2) {
402+
assertEquals(expectedAlerts[2], getMockWebConnection().getLastWebRequest().getUrl().toString());
368403
}
369404
}
370405
}

0 commit comments

Comments
 (0)