use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class ElementOffsetHeightTest method offsetHeightLineBreaks.
/**
* Try to do a line break if width is fixed.
*
* @throws Exception if the test fails
*/
@Test
@Alerts(DEFAULT = "12, 27, 44, 60, 80, 108, 126, 161, 208, 216, 270, 288, 340, 407", FF = "14, 30, 48, 60, 80, 108, 126, 161, 208, 224, 279, 297, 350, 418", FF_ESR = "14, 30, 48, 60, 80, 108, 126, 161, 208, 224, 279, 297, 350, 418", IE = "14, 28, 46, 55, 81, 110, 124, 161, 202, 221, 269, 290, 345, 405")
// we will see other results on unix
@NotYetImplemented
public void offsetHeightLineBreaks() throws Exception {
final String html = "<html><head><body>\n" + " <div id='myDiv' style='width: 400px'>" + "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt " + "ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo " + "dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor " + "sit amet.</div>\n" + " <textarea id='myTextarea' cols='120' rows='20'></textarea>\n" + "<script>\n" + " var div = document.getElementById('myDiv');\n" + " var array = [];\n" + " for (var i = 6; i <= 32; i+=2) {\n" + " div.style.fontSize = i + 'px';\n" + " array.push(div.offsetHeight);\n" + " }\n" + " document.getElementById('myTextarea').value = array.join(', ');\n" + "</script>\n" + "</body></html>";
final WebDriver driver = loadPage2(html);
final String actual = driver.findElement(By.id("myTextarea")).getAttribute("value");
assertEquals(getExpectedAlerts()[0], actual);
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class DOMImplementationTest method createHTMLDocumentInnerAddImgAddDocToIframe.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts("before1")
@NotYetImplemented
public void createHTMLDocumentInnerAddImgAddDocToIframe() throws Exception {
final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "<html>\n" + "<head>\n" + " <script>\n" + " function test() {\n" + " try {\n" + " var frame = document.getElementById('theFrame');\n" + " var doc = document.implementation.createHTMLDocument('test');\n" + " doc.body.innerHTML = '<img src=\"x\" onerror=\"window.parent.document.title += 1\">';\n" + // Copy the new HTML document into the frame
" var destDocument = frame.contentDocument;\n" + " var srcNode = doc.documentElement;\n" + " var newNode = destDocument.importNode(srcNode, true);\n" + " destDocument.replaceChild(newNode, destDocument.documentElement);\n" + // + " alert('before');\n"
" window.parent.document.title += 'before';" + " } catch(e) { window.parent.document.title += 'exception'; }\n" + " }\n" + "</script>\n" + "</head>\n" + "<body onload='test()'>\n" + " <iframe id='theFrame' src='about:blank' />" + "</body></html>";
getMockWebConnection().setDefaultResponse("Error: not found", 404, "Not Found", MimeType.TEXT_HTML);
final WebDriver driver = loadPage2(html);
assertTitle(driver, getExpectedAlerts()[0]);
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class HTMLElement2Test method setActiveAndFocus.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts(DEFAULT = { "First: body1", "Second:", "Second: body1 setActive not available" }, IE = { "First: body1", "Second:", "Second: body1 text1 [object HTMLButtonElement] text2 [object Window] onfocus text2" })
// alert conflicts with focus/blur
@NotYetImplemented(IE)
public void setActiveAndFocus() throws Exception {
final String firstHtml = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "<html>\n" + "<head>\n" + " <title>First: </title>\n" + " <script>var win2;</script>\n" + "</head>\n" + "<body id='body1' onload='document.title += \" \" + document.activeElement.id'>\n" + "<form name='form1'>\n" + " <input id='text1' onfocus='document.title += \" onfocus text1\"; win2.focus();'>\n" + " <button id='button1' onClick='win2=window.open(\"" + URL_SECOND + "\", \"second\");'>Click me</a>\n" + "</form>\n" + "</body></html>";
final String secondHtml = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "<html>\n" + "<head>\n" + " <title>Second: </title>\n" + "</head>\n" + "<body id='body2'>\n" + " <input id='text2' onfocus='document.title += \" onfocus text2\"'>\n" + " <button id='button2' onClick='doTest();'>Click me</a>\n" + " <script>\n" + " function doTest() {\n" + " var elem = opener.document.getElementById('text1');\n" + " document.title += ' ' + opener.document.activeElement.id;\n" + " if (!elem.setActive) { document.title += ' setActive not available'; return; }\n" + " elem.setActive();\n" + " document.title += ' ' + opener.document.activeElement.id;\n" + " document.title += ' ' + document.activeElement;\n" + " document.getElementById('text2').setActive();\n" + " document.title += ' ' + document.activeElement.id;\n" + " document.title += ' ' + opener;\n" + " opener.focus();\n" + " }\n" + " </script>\n" + "</body></html>";
getMockWebConnection().setResponse(URL_SECOND, secondHtml);
try {
final WebDriver driver = loadPage2(firstHtml);
assertTitle(driver, getExpectedAlerts()[0]);
driver.findElement(By.id("button1")).click();
driver.switchTo().window("second");
assertTitle(driver, getExpectedAlerts()[1]);
driver.findElement(By.id("button2")).click();
assertTitle(driver, getExpectedAlerts()[2]);
} finally {
shutDownRealIE();
}
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class HTMLDocumentWrite2Test method writeInNewWindowAndReadFormCollection.
/**
* Regression test for bug 2921851.
* @throws Exception if the test fails
*/
@Test
@NotYetImplemented
public // TODO [IE]SINGLE-VS-BULK test runs when executed as single but breaks as bulk
void writeInNewWindowAndReadFormCollection() throws Exception {
final String html = "<html><head>\n" + "<script>\n" + "function test() {\n" + " var newWin = window.open('', 'myPopup', '');\n" + " var newDoc = newWin.document;\n" + " newDoc.write('<html><body><form name=newForm></form></body></html>');\n" + " document.title = '#' + newDoc.forms.length;\n" + "}\n" + "</script></head>\n" + "<body onload='test()'>\n" + "</body></html>";
try {
final WebDriver driver = loadPageWithAlerts2(html);
assertTitle(driver, "#1");
} finally {
shutDownRealIE();
}
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class HTMLFrameElement2Test method windowLocationSetOnload.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts({ "OnloadTest", "header -> content -> frameSet", "content\nClick for new frame content with onload", "header -> content -> frameSet -> onloadFrame", "onloadFrame\nNew content loaded..." })
@NotYetImplemented
public void windowLocationSetOnload() throws Exception {
final String html = "<html><head><title>OnloadTest</title></head>\n" + "<frameset rows='50,*' onLoad=\"top.header.addToFrameOrder('frameSet');\">\n" + " <frame name='header' src='header.html'>\n" + " <frame name='content' id='content' " + "src=\"javascript:window.location='content.html'\">\n" + "</frameset>\n" + "</html>";
final String headerFrame = "<html><head><title>headerFrame</title></head>\n" + "<script type='text/javascript'>\n" + " function addToFrameOrder(frame) {\n" + " var spacer = ' -> ';\n" + " var frameOrder = document.getElementById('frameOrder').innerHTML;\n" + " if (frameOrder == '') {spacer = '';}\n" + " document.getElementById('frameOrder').innerHTML = frameOrder + spacer + frame;\n" + " }\n" + "</script>\n" + "<body onload=\"addToFrameOrder('header');\">\n" + " <div id='frameOrder'></div>\n" + "</body></html>";
final String contentFrame = "<html><head><title>contentFrame</title></head>\n" + "<body onload=\"top.header.addToFrameOrder('content');\">\n" + " <h3>content</h3>\n" + " <a name='onloadFrameAnchor' href='onload.html' " + "target='content'>Click for new frame content with onload</a>\n" + "</body></html>";
final String onloadFrame = "<html><head><title>onloadFrame</title></head>\n" + "<body onload=\"top.header.addToFrameOrder('onloadFrame');\">\n" + " <h3>onloadFrame</h3>\n" + " <p id='newContent'>New content loaded...</p>\n" + "</body></html>";
getMockWebConnection().setResponse(new URL(URL_FIRST, "header.html"), headerFrame);
getMockWebConnection().setResponse(new URL(URL_FIRST, "content.html"), contentFrame);
getMockWebConnection().setResponse(new URL(URL_FIRST, "onload.html"), onloadFrame);
final WebDriver driver = loadPage2(html);
// top frame
assertTitle(driver, getExpectedAlerts()[0]);
// header frame
driver.switchTo().frame("header");
assertEquals(getExpectedAlerts()[1], driver.findElement(By.id("frameOrder")).getText());
// content frame
driver.switchTo().defaultContent();
driver.switchTo().frame("content");
assertEquals(getExpectedAlerts()[2], driver.findElement(By.tagName("body")).getText());
driver.findElement(By.name("onloadFrameAnchor")).click();
driver.switchTo().defaultContent();
driver.switchTo().frame("header");
assertEquals(getExpectedAlerts()[3], driver.findElement(By.id("frameOrder")).getText());
driver.switchTo().defaultContent();
driver.switchTo().frame("content");
assertEquals(getExpectedAlerts()[4], driver.findElement(By.tagName("body")).getText());
}
Aggregations