Search in sources :

Example 46 with NotYetImplemented

use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.

the class HTMLElementTest method clickAnElementThatDisappears.

/**
 * @throws Exception if the test fails
 */
@Test
@Alerts(DEFAULT = "mousedown-over-over\nmousedown-over-body\nmousedown-over-undefined\n" + "mouseup--body\nmouseup--undefined", FF = "mousedown-over-over\nmousedown-over-body\nmousedown-over-undefined\n" + "mouseup--body\nmouseup--undefined\nclick-body-body\nclick-body-undefined", FF_ESR = "mousedown-over-over\nmousedown-over-body\nmousedown-over-undefined\n" + "mouseup--body\nmouseup--undefined\nclick-body-body\nclick-body-undefined")
@NotYetImplemented
public void clickAnElementThatDisappears() throws Exception {
    final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "<html>\n" + "<head>\n" + "<title>Test</title>\n" + "<script>\n" + "  function handler(e) {\n" + "    var log = document.getElementById('log');\n" + "    log.innerHTML += '<p></p>';\n" + "    log.lastElementChild.textContent = e.type + '-' + e.target.id + '-' + e.currentTarget.id;\n" + "  }\n" + "  function test() {\n" + "    var over = document.getElementById('over');\n" + "    var body = document.body;\n" + "    var types = ['click', 'mousedown', 'mouseup'];\n" + "    for (var i = 0, type; (type = types[i]); ++i) {\n" + "      over.addEventListener(type, handler);\n" + "      body.addEventListener(type, handler);\n" + "      window.addEventListener(type, handler);\n" + "    }\n" + "    over.addEventListener('mousedown', function () {\n" + "      over.style.display = 'none';\n" + "    });\n" + "  }\n" + "</script>\n" + "</head>\n" + "<body id='body' onload='test()'>\n" + "  <div id='over'>abc</div>\n" + "  <div id='log'></div>\n" + "  </div>\n" + "</body>\n" + "</html>";
    final WebDriver webDriver = loadPage2(html);
    webDriver.findElement(By.id("over")).click();
    assertEquals(getExpectedAlerts()[0], webDriver.findElement(By.id("log")).getText());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) NotYetImplemented(com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented) HtmlPageTest(com.gargoylesoftware.htmlunit.html.HtmlPageTest) Test(org.junit.Test) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts)

Example 47 with NotYetImplemented

use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.

the class HTMLElementTest method setAttribute_eventHandlerNull.

/**
 * @throws Exception if the test fails
 */
@Test
@Alerts(DEFAULT = { "null", "inform('newHandler')", "null" }, IE = { "null", "inform('newHandler')", "" })
@NotYetImplemented(IE)
public void setAttribute_eventHandlerNull() throws Exception {
    final String html = "<html><head><script>\n" + LOG_TEXTAREA_FUNCTION + "  function inform(msg) {\n" + "    document.title += msg;\n" + "    document.title += '-';\n" + "  }\n" + "  function test() {\n" + "    var text = document.getElementById('login');\n" + "    var password = document.getElementById('password');\n" + "    log(text.getAttribute('onclick'));\n" + "    text.setAttribute('onclick', \"inform('newHandler')\");\n" + "    log(text.getAttribute('onclick'));\n" + "    text.setAttribute('onclick', null);\n" + "    log(text.getAttribute('onclick'));\n" + "  }\n" + "</script></head>\n" + "<body onload='test()'>\n" + "  <form>\n" + "    <input type='text' id='login' name='login'>\n" + "  </form>\n" + LOG_TEXTAREA + "</body></html>";
    final WebDriver driver = loadPageVerifyTextArea2(html);
    driver.findElement(By.id("login")).click();
    assertTitle(driver, "");
}
Also used : WebDriver(org.openqa.selenium.WebDriver) NotYetImplemented(com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented) HtmlPageTest(com.gargoylesoftware.htmlunit.html.HtmlPageTest) Test(org.junit.Test) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts)

Example 48 with NotYetImplemented

use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.

the class HTMLScriptElementTest method async2.

/**
 * @throws Exception if the test fails
 */
@Test
@Alerts("2 1")
@NotYetImplemented
public void async2() throws Exception {
    final String html = "<html><body>\n" + "<script>\n" + "  var s1 = document.createElement('script');\n" + "  s1.src = 'js1.js';\n" + "  s1.async = true;\n" + "  document.body.appendChild(s1);\n" + "</script>\n" + "<script src='js2.js'></script>\n" + "</body></html>\n";
    getMockWebConnection().setResponse(new URL(URL_FIRST, "js1.js"), "document.title += ' 1';");
    getMockWebConnection().setResponse(new URL(URL_FIRST, "js2.js"), "document.title += ' 2';");
    final WebDriver driver = loadPage2(html);
    assertTitle(driver, getExpectedAlerts()[0]);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) URL(java.net.URL) NotYetImplemented(com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented) Test(org.junit.Test) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts)

Example 49 with NotYetImplemented

use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.

the class HTMLOptionElement2Test method click2.

/**
 * @throws Exception if the test fails
 */
@Test
@Alerts(DEFAULT = "opt-a; opt-b", CHROME = "opt-b")
@BuggyWebDriver("opt-a; b;")
@NotYetImplemented
public // what happens when running the test manually in the browser.
void click2() throws Exception {
    final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "<html><head><title>foo</title><script>\n" + "  function log(x) {\n" + "    document.getElementById('log_').value += x + '; ';\n" + "  }\n" + "  function init() {\n" + "    s = document.getElementById('s');\n" + "    s.addEventListener('click', handle, false);\n" + "  }\n" + "  function handle(event) {\n" + "    log(s.options[s.selectedIndex].value);\n" + "  }\n" + "</script></head>\n" + "<body onload='init()'>\n" + "<form>\n" + "  <textarea id='log_' rows='4' cols='50'></textarea>\n" + "  <select id='s'>\n" + "    <option value='opt-a'>A</option>\n" + "    <option id='opt-b' value='b'>B</option>\n" + "    <option value='opt-c'>C</option>\n" + "  </select>\n" + "</form>\n" + "</body></html>";
    final WebDriver driver = loadPage2(html);
    driver.findElement(By.id("s")).click();
    driver.findElement(By.id("opt-b")).click();
    final List<String> alerts = new LinkedList<>();
    final WebElement log = driver.findElement(By.id("log_"));
    alerts.add(log.getAttribute("value").trim());
    assertEquals(getExpectedAlerts(), alerts);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) BuggyWebDriver(com.gargoylesoftware.htmlunit.junit.BrowserRunner.BuggyWebDriver) WebElement(org.openqa.selenium.WebElement) LinkedList(java.util.LinkedList) NotYetImplemented(com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented) HtmlPageTest(com.gargoylesoftware.htmlunit.html.HtmlPageTest) Test(org.junit.Test) BuggyWebDriver(com.gargoylesoftware.htmlunit.junit.BrowserRunner.BuggyWebDriver) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts)

Example 50 with NotYetImplemented

use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.

the class XMLSerializerTest method nameSpaces.

/**
 * @throws Exception if the test fails
 */
@Test
@Alerts(DEFAULT = "no ActiveX", IE = {})
@NotYetImplemented(IE)
public // so far we are not able to add the XML header
void nameSpaces() throws Exception {
    final String expectedString = getExpectedAlerts().length != 0 ? "" : "<?xml32version=\"1.0\"?>\\r\\n<xsl:stylesheet32version=\"1.0\"32" + "xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\\r\\n9<xsl:template32match=\"/\">\\r\\n99<html>" + "\\r\\n999<body>\\r\\n999</body>\\r\\n99</html>\\r\\n9</xsl:template>\\r\\n</xsl:stylesheet>\\r\\n";
    final String serializationText = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\\r\\n" + "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\\r\\n" + "  <xsl:template match=\"/\">\\r\\n" + "  <html>\\r\\n" + "    <body>\\r\\n" + "    </body>\\r\\n" + "  </html>\\r\\n" + "  </xsl:template>\\r\\n" + "</xsl:stylesheet>";
    final WebDriver driver = loadPageVerifyTitle2(constructPageContent(serializationText));
    final WebElement textArea = driver.findElement(By.id("myTextArea"));
    assertEquals(expectedString, textArea.getAttribute("value"));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) MSXMLTestHelper.callSerializeXMLDOMDocumentToString(com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestHelper.callSerializeXMLDOMDocumentToString) MSXMLTestHelper.callLoadXMLDOMDocumentFromString(com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestHelper.callLoadXMLDOMDocumentFromString) WebElement(org.openqa.selenium.WebElement) NotYetImplemented(com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented) Test(org.junit.Test) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts)

Aggregations

NotYetImplemented (com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented)66 Test (org.junit.Test)65 Alerts (com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts)54 WebDriver (org.openqa.selenium.WebDriver)54 HtmlPageTest (com.gargoylesoftware.htmlunit.html.HtmlPageTest)16 URL (java.net.URL)15 BuggyWebDriver (com.gargoylesoftware.htmlunit.junit.BrowserRunner.BuggyWebDriver)12 WebElement (org.openqa.selenium.WebElement)11 ArrayList (java.util.ArrayList)6 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)5 HtmlUnitDriver (org.openqa.selenium.htmlunit.HtmlUnitDriver)5 MockWebConnection (com.gargoylesoftware.htmlunit.MockWebConnection)4 MSXMLTestHelper.callLoadXMLDOMDocumentFromString (com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestHelper.callLoadXMLDOMDocumentFromString)4 NameValuePair (com.gargoylesoftware.htmlunit.util.NameValuePair)4 WebClient (com.gargoylesoftware.htmlunit.WebClient)3 InputStream (java.io.InputStream)3 CollectingAlertHandler (com.gargoylesoftware.htmlunit.CollectingAlertHandler)2 MSXMLTestHelper.callSerializeXMLDOMDocumentToString (com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestHelper.callSerializeXMLDOMDocumentToString)2 HtmlElement (com.gargoylesoftware.htmlunit.html.HtmlElement)2 File (java.io.File)2