diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-22 20:44:24 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-22 20:44:24 +0000 |
commit | 0f560ae9c35c5a9f3b65cd95130b316d40c687c8 (patch) | |
tree | 532fc7435d29f23f65feb53218a463a1be54d255 /sca-java-2.x/trunk/samples/store/src | |
parent | 97a82f0659ad3a6f4e51d5c6fb2b675e036e360a (diff) |
Moving to most recent release of HtmlUnit (2.6) and adjusting tests based on api changes
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@915053 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/samples/store/src')
-rw-r--r-- | sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java b/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java index 8c66e28427..900bc3f582 100644 --- a/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java +++ b/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java @@ -37,6 +37,7 @@ import client.Shopper; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; +import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput; import com.gargoylesoftware.htmlunit.html.HtmlForm; @@ -90,27 +91,24 @@ public class StoreTestCase { @Test @Ignore public void testStoreWidget() throws FailingHttpStatusCodeException, MalformedURLException, IOException { - WebClient browser = new WebClient(BrowserVersion.FIREFOX_2); - browser.setRedirectEnabled(true); - browser.setThrowExceptionOnScriptError(false); + WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3); + webClient.setRedirectEnabled(true); + webClient.setThrowExceptionOnScriptError(false); + webClient.waitForBackgroundJavaScript(50000); + webClient.waitForBackgroundJavaScriptStartingBefore(50000); + webClient.setAjaxController(new NicelyResynchronizingAjaxController()); - HtmlPage page = (HtmlPage) browser.getPage("http://localhost:8080/store/store.html"); - - //delay to allow all javascript to be retrieved and loaded - try { - Thread.sleep(8000); - } catch (InterruptedException e) { - e.printStackTrace(); - } + HtmlPage page = (HtmlPage) webClient.getPage("http://localhost:8080/store/store.html"); HtmlForm form = (HtmlForm) page.getFormByName("catalogForm"); HtmlCheckBoxInput catalogItems = (HtmlCheckBoxInput) form.getInputByName("items"); - System.out.println(">>>" + catalogItems.getAttributeValue("value")); - Assert.assertEquals("Apple - $2.99", catalogItems.getAttributeValue("value")); + System.out.println(">>>" + catalogItems.getAttribute("value")); + Assert.assertEquals("Apple - $2.99", catalogItems.getAttribute("value")); + webClient.closeAllWindows(); } } |