use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class HtmlIsIndex2Test method simpleScriptable.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts(DEFAULT = "[object HTMLUnknownElement]", IE = "null")
@NotYetImplemented(IE)
public void simpleScriptable() throws Exception {
final String html = "<html><head>\n" + "<script>\n" + LOG_TITLE_FUNCTION + " function test() {\n" + " log(document.getElementById('myId'));\n" + " }\n" + "</script>\n" + "</head>\n" + "<body onload='test()'>\n" + " <form id='form1' method='post'>\n" + " <isindex id='myId' prompt='enterSomeText'></isindex>\n" + " </form>\n" + "</body></html>";
final WebDriver driver = loadPageVerifyTitle2(html);
if (driver instanceof HtmlUnitDriver) {
final HtmlPage page = (HtmlPage) getWebWindowOf((HtmlUnitDriver) driver).getEnclosedPage();
assertTrue(HtmlUnknownElement.class.isInstance(page.getHtmlElementById("myId")));
}
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class Event3Test method ie_EventBubbling.
/**
* Test for event bubbling in IE.
* @throws Exception if the test fails
*/
@Test
// TODO: in IE no click event can be registered for the window
@NotYetImplemented
@Alerts({ "span bubbling", "div", "div bubbling" })
public void ie_EventBubbling() throws Exception {
final String content = "<html><head><title>foo</title>\n" + "<script>\n" + "function t(_s) {\n" + " return function() { alert(_s) };\n" + "}\n" + "function init() {\n" + " window.attachEvent('onclick', t('window bubbling'));\n" + " var oDiv = document.getElementById('theDiv');\n" + " oDiv.attachEvent('onclick', t('div bubbling'));\n" + " var oSpan = document.getElementById('theSpan');\n" + " oSpan.attachEvent('onclick', t('span bubbling'));\n" + "}\n" + "</script>\n" + "</head><body onload='init()'>\n" + "<div onclick=\"alert('div')\" id='theDiv'>\n" + "<span id='theSpan'>blabla</span>\n" + "</div>\n" + "</body></html>";
final List<String> collectedAlerts = new ArrayList<>();
final HtmlPage page = loadPage(content, collectedAlerts);
page.getHtmlElementById("theSpan").click();
assertEquals(getExpectedAlerts(), collectedAlerts);
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class EventTest method document_focus.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts(DEFAULT = "activeElement BODY", FF = { "activeElement BODY", "focus #document", "handler: activeElement BODY" }, FF_ESR = { "activeElement BODY", "focus #document", "handler: activeElement BODY" }, IE = { "activeElement BODY", "focus BODY", "handler: activeElement BODY" })
// http://code.google.com/p/selenium/issues/detail?id=4665
@NotYetImplemented({ IE, FF, FF_ESR })
public void document_focus() throws Exception {
final String html = "<html>\n" + "<head>\n" + "<script>\n" + " function test() {\n" + " handle(document);\n" + " log('activeElement ' + document.activeElement.nodeName);\n" + " }\n" + " function handle(obj) {\n" + " obj.addEventListener('focus', handler, true);\n" + " }\n" + " function handler(e) {\n" + " var src = e.srcElement;\n" + " if (!src)\n" + " src = e.target;\n" + " log(e.type + ' ' + src.nodeName);\n" + " log('handler: activeElement ' + document.activeElement.nodeName);\n" + " }\n" + " function log(x) {\n" + " document.getElementById('log').value += x + '\\n';\n" + " }\n" + "</script>\n" + "</head>\n" + "<body onload='test()'>\n" + " <textarea id='log' cols='80' rows='40'></textarea>\n" + "</body></html>";
final WebDriver driver = loadPage2(html);
final String text = driver.findElement(By.id("log")).getAttribute("value").trim().replaceAll("\r", "");
assertEquals(String.join("\n", getExpectedAlerts()), text);
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class XMLDocumentTest method svg.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts(DEFAULT = "[object XMLDocument]", IE = "[object Document]")
@NotYetImplemented
public void svg() throws Exception {
final String svg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<svg xmlns=\"http://www.w3.org/2000/svg\">\n" + " <rect id=\"rect\" width=\"50\" height=\"50\" fill=\"green\" onclick=\"alert(document)\"/>\n" + "</svg>";
final WebDriver driver = loadPage2(svg, URL_FIRST, MimeType.TEXT_XML, ISO_8859_1);
driver.findElement(By.id("rect")).click();
verifyAlerts(driver, getExpectedAlerts());
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class XMLHttpRequest3Test method streaming.
/**
* Regression test for bug 1209686 (onreadystatechange not called with partial data when emulating FF).
* @throws Exception if an error occurs
*/
@Test
@NotYetImplemented
public void streaming() throws Exception {
final Map<String, Class<? extends Servlet>> servlets = new HashMap<>();
servlets.put("/test", StreamingServlet.class);
final String resourceBase = "./src/test/resources/com/gargoylesoftware/htmlunit/javascript/host";
startWebServer(resourceBase, null, servlets);
final WebClient client = getWebClient();
final HtmlPage page = client.getPage(URL_FIRST + "XMLHttpRequestTest_streaming.html");
assertEquals(0, client.waitForBackgroundJavaScriptStartingBefore(1000));
final HtmlElement body = page.getBody();
assertEquals(10, body.asNormalizedText().split("\n").length);
}
Aggregations