Search in sources :

Example 1 with HtmlUnitNYI

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

the class HtmlAreaTest method isDisplayedEmptyCircle.

/**
 * @throws Exception if an error occurs
 */
@Test
@Alerts(DEFAULT = { "false", "false", "true" }, IE = { "false", "false", "false" })
@HtmlUnitNYI(IE = { "false", "false", "true" })
public void isDisplayedEmptyCircle() throws Exception {
    final String html = "<html><head><title>Page A</title></head>\n" + "<body>\n" + "  <img id='myImg' usemap='#imgmap'" + " src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAA" + "HElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='>\n" + "  <map id='myMap' name='imgmap'>\n" + "    <area id='myArea1' shape='circle' coords='0,0,0'>\n" + "    <area id='myArea2' shape='circle' >\n" + "    <area id='myArea3' shape='circle' coords='0,0,0.8'>\n" + "  </map>\n" + "</body></html>";
    final String[] expected = getExpectedAlerts();
    setExpectedAlerts(new String[] {});
    final WebDriver driver = loadPage2(html);
    boolean displayed = driver.findElement(By.id("myArea1")).isDisplayed();
    assertEquals(Boolean.parseBoolean(expected[0]), displayed);
    displayed = driver.findElement(By.id("myArea2")).isDisplayed();
    assertEquals(Boolean.parseBoolean(expected[1]), displayed);
    displayed = driver.findElement(By.id("myArea3")).isDisplayed();
    assertEquals(Boolean.parseBoolean(expected[2]), displayed);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) BuggyWebDriver(com.gargoylesoftware.htmlunit.junit.BrowserRunner.BuggyWebDriver) Test(org.junit.Test) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts) HtmlUnitNYI(com.gargoylesoftware.htmlunit.junit.BrowserRunner.HtmlUnitNYI)

Example 2 with HtmlUnitNYI

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

the class FocusableElement2Test method bodyLoad.

/**
 * @throws Exception if the test fails
 */
@Test
@Alerts(DEFAULT = { "body", "active: body", "onload", "active: body", "onfocus:[object Window]", "active: body" }, CHROME = { "body", "active: body", "onload", "active: body" }, EDGE = { "body", "active: body", "onload", "active: body" }, IE = { "body", "active: null", "onfocusin:body", "active: body", "onload", "active: body", "onfocus:[object Window]", "active: body" })
@HtmlUnitNYI(FF = { "body", "active: body", "onload", "active: body" }, FF_ESR = { "body", "active: body", "onload", "active: body" }, IE = { "body", "active: body", "onload", "active: body" })
public // TODO FF & FF68 fail due to wrong body vs. window event handling
void bodyLoad() throws Exception {
    final String html = "<html>\n" + "  <head>\n" + "    <script>\n" + logger() + "      function test() {\n" + "        log('onload');\n" + "      }\n" + "    </script>\n" + "  </head>\n" + "  <body id='body' onload='test()' " + logEvents("") + ">\n" + "    <script>\n" + "      log('body');" + "    </script>\n" + "  </body>\n" + "</html>\n";
    final WebDriver driver = loadPage2(html);
    assertTitle(driver, String.join(";", getExpectedAlerts()) + (getExpectedAlerts().length > 0 ? ";" : ""));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Test(org.junit.Test) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts) HtmlUnitNYI(com.gargoylesoftware.htmlunit.junit.BrowserRunner.HtmlUnitNYI)

Example 3 with HtmlUnitNYI

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

the class FocusableElement2Test method bodySwitchFromBodyToNotFocusable.

/**
 * @throws Exception if the test fails
 */
@Test
@Alerts(DEFAULT = { "onfocus:[object Window]", "active: body", "before", "active: body", "after", "active: body" }, CHROME = { "before", "active: body", "after", "active: body" }, EDGE = { "before", "active: body", "after", "active: body" }, IE = { "onfocusin:body", "active: body", "onfocus:[object Window]", "active: body", "before", "active: body", "after", "active: body" })
@HtmlUnitNYI(FF = { "before", "active: body", "after", "active: body" }, FF_ESR = { "before", "active: body", "after", "active: body" }, IE = { "before", "active: body", "after", "active: body" })
public // TODO FF & FF68 fail due to wrong body vs. window event handling
void bodySwitchFromBodyToNotFocusable() throws Exception {
    final String html = "<html>\n" + "  <head>\n" + "    <script>\n" + logger() + "      function test() {\n" + "        log('before');\n" + "        document.getElementById('focusId').focus();\n" + "        document.getElementById('focusId').blur();\n" + "        log('after');\n" + "      }\n" + "    </script>\n" + "  </head>\n" + "  <body id='body' onload='setTimeout(test, 10)' " + logEvents("") + ">\n" + "    <div id='focusId' " + logEvents("F") + ">div</div>\n" + "  </body>\n" + "</html>\n";
    final WebDriver driver = loadPage2(html);
    assertTitle(driver, String.join(";", getExpectedAlerts()) + (getExpectedAlerts().length > 0 ? ";" : ""));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Test(org.junit.Test) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts) HtmlUnitNYI(com.gargoylesoftware.htmlunit.junit.BrowserRunner.HtmlUnitNYI)

Example 4 with HtmlUnitNYI

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

the class FocusableElement2Test method bodySwitchFromBodyToFocusable.

/**
 * @throws Exception if the test fails
 */
@Test
@Alerts(DEFAULT = { "onfocus:[object Window]", "active: body", "before", "active: body", "onfocusF:focusId", "active: focusId", "onfocusinF:focusId", "active: focusId", "onfocusin:focusId", "active: focusId", "onblurF:focusId", "active: body", "onfocusoutF:focusId", "active: body", "onfocusout:focusId", "active: body", "after", "active: body" }, CHROME = { "before", "active: body", "onfocusF:focusId", "active: focusId", "onfocusinF:focusId", "active: focusId", "onfocusin:focusId", "active: focusId", "onblurF:focusId", "active: body", "onfocusoutF:focusId", "active: body", "onfocusout:focusId", "active: body", "after", "active: body" }, EDGE = { "before", "active: body", "onfocusF:focusId", "active: focusId", "onfocusinF:focusId", "active: focusId", "onfocusin:focusId", "active: focusId", "onblurF:focusId", "active: body", "onfocusoutF:focusId", "active: body", "onfocusout:focusId", "active: body", "after", "active: body" }, IE = { "onfocusin:body", "active: body", "onfocus:[object Window]", "active: body", "before", "active: body", "onfocusout:body", "active: focusId", "onfocusinF:focusId", "active: focusId", "onfocusin:focusId", "active: focusId", "onfocusoutF:focusId", "active: body", "onfocusout:focusId", "active: body", "onfocusin:body", "active: body", "after", "active: body", "onfocusF:focusId", "active: body", "onblurF:focusId", "active: body" })
@HtmlUnitNYI(FF = { "before", "active: body", "onfocusF:focusId", "active: focusId", "onfocusinF:focusId", "active: focusId", "onfocusin:focusId", "active: focusId", "onblurF:focusId", "active: body", "onfocusoutF:focusId", "active: body", "onfocusout:focusId", "active: body", "after", "active: body" }, FF_ESR = { "before", "active: body", "onfocusF:focusId", "active: focusId", "onfocusinF:focusId", "active: focusId", "onfocusin:focusId", "active: focusId", "onblurF:focusId", "active: body", "onfocusoutF:focusId", "active: body", "onfocusout:focusId", "active: body", "after", "active: body" }, IE = { "before", "active: body", "onfocusout:body", "active: body", "onfocusinF:focusId", "active: body", "onfocusin:focusId", "active: body", "onfocusF:focusId", "active: focusId", "onfocusoutF:focusId", "active: body", "onfocusout:focusId", "active: body", "onblurF:focusId", "active: body", "after", "active: body" })
public // TODO FF & FF68 fail due to wrong body vs. window event handling
void bodySwitchFromBodyToFocusable() throws Exception {
    final String html = "<html>\n" + "  <head>\n" + "    <script>\n" + logger() + "      function test() {\n" + "        log('before');\n" + "        document.getElementById('focusId').focus();\n" + "        document.getElementById('focusId').blur();\n" + "        log('after');\n" + "      }\n" + "    </script>\n" + "  </head>\n" + "  <body id='body' onload='setTimeout(test, 10)' " + logEvents("") + ">\n" + "    <input type='text' id='focusId' " + logEvents("F") + ">\n" + "  </body>\n" + "</html>\n";
    final WebDriver driver = loadPage2(html);
    assertTitle(driver, String.join(";", getExpectedAlerts()) + (getExpectedAlerts().length > 0 ? ";" : ""));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Test(org.junit.Test) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts) HtmlUnitNYI(com.gargoylesoftware.htmlunit.junit.BrowserRunner.HtmlUnitNYI)

Example 5 with HtmlUnitNYI

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

the class FocusableElement2Test method body.

/**
 * @throws Exception if the test fails
 */
@Test
@Alerts(DEFAULT = { "onfocus:[object Window]", "active: focusId", "before", "active: focusId", "after", "active: focusId" }, CHROME = { "before", "active: focusId", "after", "active: focusId" }, EDGE = { "before", "active: focusId", "after", "active: focusId" }, IE = { "onfocusin:focusId", "active: focusId", "onfocus:[object Window]", "active: focusId", "before", "active: focusId", "after", "active: focusId" })
@HtmlUnitNYI(FF = { "before", "active: focusId", "after", "active: focusId" }, FF_ESR = { "before", "active: focusId", "after", "active: focusId" }, IE = { "before", "active: focusId", "onfocusout:focusId", "active: focusId", "after", "active: focusId" })
public // TODO FF & FF68 fail due to wrong body vs. window event handling
void body() throws Exception {
    final String html = "<html>\n" + "  <head>\n" + "    <script>\n" + logger() + "      function test() {\n" + "        log('before');\n" + "        document.getElementById('focusId').focus();\n" + "        document.getElementById('focusId').focus();\n" + "        document.getElementById('focusId').blur();\n" + "        document.getElementById('focusId').blur();\n" + "        log('after');\n" + "      }\n" + "    </script>\n" + "  </head>\n" + "  <body id='focusId' onload='setTimeout(test, 10)' " + logEvents("") + ">\n" + "  </body>\n" + "</html>\n";
    final WebDriver driver = loadPage2(html);
    assertTitle(driver, String.join(";", getExpectedAlerts()) + (getExpectedAlerts().length > 0 ? ";" : ""));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Test(org.junit.Test) Alerts(com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts) HtmlUnitNYI(com.gargoylesoftware.htmlunit.junit.BrowserRunner.HtmlUnitNYI)

Aggregations

Alerts (com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts)72 HtmlUnitNYI (com.gargoylesoftware.htmlunit.junit.BrowserRunner.HtmlUnitNYI)72 Test (org.junit.Test)68 WebDriver (org.openqa.selenium.WebDriver)54 HtmlPageTest (com.gargoylesoftware.htmlunit.html.HtmlPageTest)14 URL (java.net.URL)14 WebElement (org.openqa.selenium.WebElement)14 BuggyWebDriver (com.gargoylesoftware.htmlunit.junit.BrowserRunner.BuggyWebDriver)11 NameValuePair (com.gargoylesoftware.htmlunit.util.NameValuePair)9 ArrayList (java.util.ArrayList)7 InputStream (java.io.InputStream)5 HtmlUnitDriver (org.openqa.selenium.htmlunit.HtmlUnitDriver)5 Method (java.lang.reflect.Method)2 HashMap (java.util.HashMap)2 Servlet (javax.servlet.Servlet)2 HttpServlet (javax.servlet.http.HttpServlet)2 Page (com.gargoylesoftware.htmlunit.Page)1 UnexpectedPage (com.gargoylesoftware.htmlunit.UnexpectedPage)1 WebWindow (com.gargoylesoftware.htmlunit.WebWindow)1 DomNode (com.gargoylesoftware.htmlunit.html.DomNode)1