Skip to content

Commit 982a6c6

Browse files
committed
another test
1 parent da9c39e commit 982a6c6

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* @author Ahmed Ashour
3030
* @author Marc Guillemot
3131
* @author Frank Danek
32+
* @author Ronald Brill
3233
*/
3334
@RunWith(BrowserRunner.class)
3435
public class HtmlNoScriptTest extends WebDriverTestCase {
@@ -150,4 +151,40 @@ public void formValues() throws Exception {
150151
assertFalse(webDriver.getCurrentUrl().contains("__webpage_no_js__"));
151152
}
152153

154+
/**
155+
* @throws Exception if the test fails
156+
*/
157+
@Test
158+
@Alerts("Has Script")
159+
public void jsDetection() throws Exception {
160+
final String html = DOCTYPE_HTML
161+
+ "<html>\n"
162+
+ "<head>\n"
163+
+ "<noscript>\n"
164+
+ " <meta http-equiv='refresh' content='0;url=" + URL_SECOND + "'>\n"
165+
+ "</noscript>\n"
166+
+ "<title>start</title>\n"
167+
+ "</head>\n"
168+
+ "<body onload='document.form.submit()'>\n"
169+
+ "<form name='form' action='" + URL_THIRD + "'></form>\n"
170+
+ "</body>\n"
171+
+ "</html>";
172+
173+
final String htmlNoScript = DOCTYPE_HTML
174+
+ "<html>\n"
175+
+ "<head><title>No Script\u00A7</title></head>\n"
176+
+ "<body></body>\n"
177+
+ "</html>";
178+
getMockWebConnection().setResponse(URL_SECOND, htmlNoScript);
179+
180+
final String htmlHasScript = DOCTYPE_HTML
181+
+ "<html>\n"
182+
+ "<head><title>Has Script\u00A7</title></head>\n"
183+
+ "<body></body>\n"
184+
+ "</html>";
185+
getMockWebConnection().setResponse(URL_THIRD, htmlHasScript);
186+
187+
loadPage2(html);
188+
verifyTitle2(DEFAULT_WAIT_TIME, getWebDriver(), getExpectedAlerts());
189+
}
153190
}

0 commit comments

Comments
 (0)