Skip to content

Commit 2c818aa

Browse files
committed
get rid of NotYetImplemented
1 parent bd8a832 commit 2c818aa

File tree

6 files changed

+42
-55
lines changed

6 files changed

+42
-55
lines changed

src/test/java/org/htmlunit/javascript/host/Location2Test.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.htmlunit.junit.BrowserRunner;
2626
import org.htmlunit.junit.annotation.Alerts;
2727
import org.htmlunit.junit.annotation.HtmlUnitNYI;
28-
import org.htmlunit.junit.annotation.NotYetImplemented;
2928
import org.htmlunit.util.MimeType;
3029
import org.htmlunit.util.NameValuePair;
3130
import org.junit.Test;
@@ -438,7 +437,10 @@ public void hashEncoding() throws Exception {
438437
*/
439438
@Test
440439
@Alerts({"#myDataTable=foo%3Dojkoj", "§§URL§§#myDataTable=foo%3Dojkoj"})
441-
@NotYetImplemented
440+
@HtmlUnitNYI(CHROME = {"#myDataTable=foo=ojkoj", "§§URL§§#myDataTable=foo%3Dojkoj"},
441+
EDGE = {"#myDataTable=foo=ojkoj", "§§URL§§#myDataTable=foo%3Dojkoj"},
442+
FF = {"#myDataTable=foo=ojkoj", "§§URL§§#myDataTable=foo%3Dojkoj"},
443+
FF_ESR = {"#myDataTable=foo=ojkoj", "§§URL§§#myDataTable=foo%3Dojkoj"})
442444
public void hashEncoding2() throws Exception {
443445
final String html = DOCTYPE_HTML
444446
+ "<html><body>\n"
@@ -991,19 +993,21 @@ public void onHashChangeJS() throws Exception {
991993
* @throws Exception if the test fails
992994
*/
993995
@Test
994-
@Alerts("§§URL§§test.html")
995-
//real browsers don't show the alert, since it is quickly closed through JavaScript
996-
@NotYetImplemented
996+
@Alerts({"opened", "closed", "href changed", "§§URL§§test.html"})
997997
public void locationAfterOpenClosePopup() throws Exception {
998998
final String html = DOCTYPE_HTML
999999
+ "<html>\n"
10001000
+ "<head>\n"
10011001
+ " <title>test</title>\n"
10021002
+ " <script>\n"
1003+
+ LOG_SESSION_STORAGE_FUNCTION
10031004
+ " function test() {\n"
10041005
+ " var win = window.open('" + URL_SECOND + "','test','',true);\n"
1006+
+ " log('opened');\n"
10051007
+ " win.close();\n"
1008+
+ " log('closed');\n"
10061009
+ " location.href = 'test.html';\n"
1010+
+ " log('href changed');\n"
10071011
+ " }\n"
10081012
+ " </script>\n"
10091013
+ "</head>\n"
@@ -1016,7 +1020,8 @@ public void locationAfterOpenClosePopup() throws Exception {
10161020
+ "<head>\n"
10171021
+ " <title>popup with script</title>\n"
10181022
+ " <script>\n"
1019-
+ " alert('the root of all evil');\n"
1023+
+ LOG_SESSION_STORAGE_FUNCTION
1024+
+ " log('the root of all evil');\n"
10201025
+ " </script>\n"
10211026
+ "</head>\n"
10221027
+ "<body>Popup</body>\n"
@@ -1035,13 +1040,9 @@ public void locationAfterOpenClosePopup() throws Exception {
10351040
expandExpectedAlertsVariables(URL_FIRST);
10361041
final WebDriver driver = loadPage2(html);
10371042
driver.findElement(By.id("click")).click();
1038-
try {
1039-
assertEquals(getExpectedAlerts()[0], driver.getCurrentUrl());
1040-
}
1041-
finally {
1042-
releaseResources();
1043-
shutDownAll();
1044-
}
1043+
1044+
verifySessionStorage2(driver, getExpectedAlerts()[0], getExpectedAlerts()[1], getExpectedAlerts()[2]);
1045+
assertEquals(getExpectedAlerts()[3], driver.getCurrentUrl());
10451046
}
10461047

10471048
/**

src/test/java/org/htmlunit/javascript/host/StorageTest.java

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@
1414
*/
1515
package org.htmlunit.javascript.host;
1616

17-
import java.util.List;
18-
1917
import org.htmlunit.WebDriverTestCase;
2018
import org.htmlunit.junit.BrowserRunner;
2119
import org.htmlunit.junit.annotation.Alerts;
22-
import org.htmlunit.junit.annotation.BuggyWebDriver;
2320
import org.htmlunit.junit.annotation.HtmlUnitNYI;
24-
import org.htmlunit.junit.annotation.NotYetImplemented;
2521
import org.junit.Test;
2622
import org.junit.runner.RunWith;
2723
import org.openqa.selenium.WebDriver;
@@ -252,14 +248,11 @@ public void sessionStorage() throws Exception {
252248
* @throws Exception if the test fails
253249
*/
254250
@Test
255-
@Alerts("I was here")
256-
@BuggyWebDriver(CHROME = "",
257-
EDGE = "",
258-
FF = "",
259-
FF_ESR = "")
260-
// The way ChromeDriver and FFDriver start the real browsers clears the LocalStorage somehow.
261-
// But when executed manually the LocalStorage is shared.
262-
@NotYetImplemented
251+
@Alerts({"", "I was here§"})
252+
@HtmlUnitNYI(CHROME = {"", "null§"},
253+
EDGE = {"", "null§"},
254+
FF = {"", "null§"},
255+
FF_ESR = {"", "null§"})
263256
// TODO somehow persist the LocalStorage
264257
public void localStorageShouldBeShared() throws Exception {
265258
final String html1 = DOCTYPE_HTML
@@ -271,33 +264,26 @@ public void localStorageShouldBeShared() throws Exception {
271264
+ " localStorage.setItem('hello', 'I was here');\n"
272265
+ "} catch(e) { logEx(e); }\n"
273266
+ "</script></body></html>";
274-
final WebDriver driver = loadPage2(html1);
275-
final List<String> alerts = getCollectedAlerts(driver);
267+
268+
WebDriver driver = loadPage2(html1);
269+
assertEquals(getExpectedAlerts()[0], driver.getTitle());
270+
releaseResources();
276271

277272
final String html2 = DOCTYPE_HTML
278273
+ "<html><body><script>\n"
274+
+ LOG_TITLE_FUNCTION
279275
+ "try {\n"
280276
+ " log(localStorage.getItem('hello'));\n"
281277
+ "} catch(e) { logEx(e); }\n"
282278
+ "</script></body></html>";
283-
releaseResources();
284-
285279
getMockWebConnection().setResponse(URL_FIRST, html2);
286280

287281
// we have to control 2nd driver by ourself
288-
WebDriver driver2 = null;
289-
try {
290-
driver2 = buildWebDriver();
291-
driver2.get(URL_FIRST.toString());
292-
final List<String> newAlerts = getCollectedAlerts(driver2);
293-
alerts.addAll(newAlerts);
294-
assertEquals(getExpectedAlerts(), alerts);
295-
}
296-
finally {
297-
driver2.close();
298-
if (!(driver2 instanceof HtmlUnitDriver)) {
299-
shutDownAll();
300-
}
282+
driver = loadPage2(html2);
283+
assertEquals(getExpectedAlerts()[1], driver.getTitle());
284+
285+
if (!(driver instanceof HtmlUnitDriver)) {
286+
shutDownAll();
301287
}
302288
}
303289

src/test/java/org/htmlunit/javascript/host/canvas/CanvasRenderingContext2DTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
*/
1515
package org.htmlunit.javascript.host.canvas;
1616

17-
import static org.htmlunit.junit.annotation.TestedBrowser.CHROME;
18-
import static org.htmlunit.junit.annotation.TestedBrowser.EDGE;
19-
2017
import java.io.InputStream;
2118
import java.util.Collections;
2219

@@ -25,7 +22,6 @@
2522
import org.htmlunit.junit.BrowserRunner;
2623
import org.htmlunit.junit.annotation.Alerts;
2724
import org.htmlunit.junit.annotation.HtmlUnitNYI;
28-
import org.htmlunit.junit.annotation.NotYetImplemented;
2925
import org.htmlunit.util.MimeType;
3026
import org.junit.Test;
3127
import org.junit.runner.RunWith;
@@ -925,7 +921,8 @@ public void createRadialGradient() throws Exception {
925921
@Alerts(DEFAULT = {"1", "0.5", "0", "0.699999988079071", "0"},
926922
CHROME = {"1", "0.5", "0", "0.7", "0"},
927923
EDGE = {"1", "0.5", "0", "0.7", "0"})
928-
@NotYetImplemented({CHROME, EDGE})
924+
@HtmlUnitNYI(CHROME = {"1", "0.5", "0", "0.699999988079071", "0"},
925+
EDGE = {"1", "0.5", "0", "0.699999988079071", "0"})
929926
public void globalAlpha() throws Exception {
930927
final String html = DOCTYPE_HTML
931928
+ "<html><head><script>\n"

src/test/java/org/htmlunit/javascript/host/html/HTMLOptionElement2Test.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
*/
1515
package org.htmlunit.javascript.host.html;
1616

17-
import static org.htmlunit.junit.annotation.TestedBrowser.FF;
18-
import static org.htmlunit.junit.annotation.TestedBrowser.FF_ESR;
19-
2017
import org.htmlunit.WebDriverTestCase;
2118
import org.htmlunit.junit.BrowserRunner;
2219
import org.htmlunit.junit.annotation.Alerts;
@@ -1312,7 +1309,8 @@ public void selectAndAttribute() throws Exception {
13121309
"false-selected", "false-null", "false-true"},
13131310
FF_ESR = {"false-null", "true-true", "true-null",
13141311
"false-selected", "false-null", "false-true"})
1315-
@NotYetImplemented({FF, FF_ESR})
1312+
@HtmlUnitNYI(FF = {"false-null", "true-true", "true-null", "false-selected", "false-null", "true-true"},
1313+
FF_ESR = {"false-null", "true-true", "true-null", "false-selected", "false-null", "true-true"})
13161314
public void setSelectedAttribute() throws Exception {
13171315
final String html = DOCTYPE_HTML
13181316
+ "<html>\n"

src/test/java/org/htmlunit/javascript/host/html/HTMLScriptElementTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.htmlunit.junit.BrowserRunner;
2222
import org.htmlunit.junit.annotation.Alerts;
2323
import org.htmlunit.junit.annotation.HtmlUnitNYI;
24-
import org.htmlunit.junit.annotation.NotYetImplemented;
2524
import org.htmlunit.util.MimeType;
2625
import org.junit.Test;
2726
import org.junit.runner.RunWith;
@@ -1223,7 +1222,10 @@ public void asyncWithoutSrc() throws Exception {
12231222
*/
12241223
@Test
12251224
@Alerts("2 1")
1226-
@NotYetImplemented
1225+
@HtmlUnitNYI(CHROME = "1 2",
1226+
EDGE = "1 2",
1227+
FF = "1 2",
1228+
FF_ESR = "1 2")
12271229
public void async2() throws Exception {
12281230
final String html = DOCTYPE_HTML
12291231
+ "<html><body>\n"

src/test/java/org/htmlunit/javascript/host/performance/PerformanceTimingTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.htmlunit.WebDriverTestCase;
1818
import org.htmlunit.junit.BrowserRunner;
1919
import org.htmlunit.junit.annotation.Alerts;
20-
import org.htmlunit.junit.annotation.NotYetImplemented;
20+
import org.htmlunit.junit.annotation.HtmlUnitNYI;
2121
import org.junit.Test;
2222
import org.junit.runner.RunWith;
2323
import org.openqa.selenium.By;
@@ -350,7 +350,10 @@ public void dom() throws Exception {
350350
*/
351351
@Test
352352
@Alerts("[object Object]")
353-
@NotYetImplemented
353+
@HtmlUnitNYI(CHROME = {},
354+
EDGE = {},
355+
FF = {},
356+
FF_ESR = {})
354357
public void toJSON() throws Exception {
355358
final String html = DOCTYPE_HTML
356359
+ "<html>\n"

0 commit comments

Comments
 (0)