use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.HtmlUnitNYI in project htmlunit by HtmlUnit.
the class PolymerWebComponentsTest method hello.
/**
* See https://github.com/HtmlUnit/htmlunit/issues/23.
*
* @throws Exception if an error occurs
*/
@Test
@Alerts("Hello Unicorn :)")
@HtmlUnitNYI(CHROME = "", EDGE = "", FF = "", FF_ESR = "", IE = "")
public void hello() throws Exception {
final String url = URL_FIRST + "index.html";
final WebDriver driver = getWebDriver();
driver.get(url);
// for real FF
Thread.sleep(200);
assertEquals(getExpectedAlerts()[0], driver.findElement(By.tagName("body")).getText());
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.HtmlUnitNYI in project htmlunit by HtmlUnit.
the class HtmxTest method htmx.
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = "passes:412failures:0", IE = "passes:17failures:396")
@HtmlUnitNYI(CHROME = "passes:411failures:1", EDGE = "passes:411failures:1", FF = "passes:411failures:1", FF_ESR = "passes:411failures:1")
public void htmx() throws Exception {
startWebServer("src/test/resources/libraries/htmx/htmx-1.6.1", null, null);
final long runTime = 42 * DEFAULT_WAIT_TIME;
final long endTime = System.currentTimeMillis() + runTime;
try {
final WebDriver webDriver = getWebDriver();
if (getWebDriver() instanceof HtmlUnitDriver) {
getWebWindowOf((HtmlUnitDriver) getWebDriver()).getWebClient().getOptions().setThrowExceptionOnScriptError(false);
}
final String url = URL_FIRST + "test/index.html";
webDriver.get(url);
String lastStats = "";
while (lastStats.length() == 0 || !lastStats.startsWith(getExpectedAlerts()[0])) {
Thread.sleep(100);
if (System.currentTimeMillis() > endTime) {
lastStats = "HtmxTest runs too long (longer than " + runTime / 1000 + "s) - " + getResultElementText(webDriver);
break;
}
lastStats = getResultElementText(webDriver);
}
// bug hunting
/*
if (getWebDriver() instanceof HtmlUnitDriver) {
final WebClient webClient = getWebWindowOf((HtmlUnitDriver) getWebDriver()).getWebClient();
final Page page = webClient.getCurrentWindow().getEnclosedPage();
System.out.println(((HtmlPage) page).asNormalizedText());
}
*/
assertTrue(lastStats + "\n\n" + getErrors(webDriver), lastStats.startsWith(getExpectedAlerts()[0]));
} catch (final Exception e) {
e.printStackTrace();
Throwable t = e;
while ((t = t.getCause()) != null) {
t.printStackTrace();
}
throw e;
}
}
Aggregations