Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.WebClient.waitForBackgroundJavaScript()


        HtmlAnchor generatePasswordWithOptionsLink = getFirstLinkByText(form, "with options");
        generatePasswordWithOptionsLink.click();
        wc.waitForBackgroundJavaScript(10000L);
        assertFalse(StringUtils.isEmpty(page.getHtmlElementById("generatePasswordDiv").asText()));
        page.getHtmlElementById("cancelPasswordGenerationButton").click();
        wc.waitForBackgroundJavaScript(10000L);
        assertTrue(StringUtils.isEmpty(page.getHtmlElementById("generatePasswordDiv").asText()));
    }

    protected void testPasswordGenerationSubmit(HtmlPage page, String formId) throws IOException {
        WebClient wc = page.getWebClient();
View Full Code Here


        WebClient wc = page.getWebClient();
        HtmlForm form = page.getHtmlElementById(formId);
        form.getInputByName("password").setValueAttribute("");
        HtmlAnchor generatePasswordWithOptionsLink = getFirstLinkByText(form, "with options");
        generatePasswordWithOptionsLink.click();
        wc.waitForBackgroundJavaScript(10000L);
        page.getHtmlElementById("generatePasswordButton").click();
        wc.waitForBackgroundJavaScript(10000L);
        assertTrue(StringUtils.isEmpty(page.getHtmlElementById("generatePasswordDiv").asText()));
        assertEquals(8, form.getInputByName("password").getValueAttribute().length());
    }
View Full Code Here

        form.getInputByName("password").setValueAttribute("");
        HtmlAnchor generatePasswordWithOptionsLink = getFirstLinkByText(form, "with options");
        generatePasswordWithOptionsLink.click();
        wc.waitForBackgroundJavaScript(10000L);
        page.getHtmlElementById("generatePasswordButton").click();
        wc.waitForBackgroundJavaScript(10000L);
        assertTrue(StringUtils.isEmpty(page.getHtmlElementById("generatePasswordDiv").asText()));
        assertEquals(8, form.getInputByName("password").getValueAttribute().length());
    }
}
View Full Code Here

        HtmlPage page = goToChangePreferredTimeZonePage(wc);
        HtmlForm form = page.getHtmlElementById("changePreferredTimeZoneForm");
        assertEquals("GMT", form.getSelectByName("timeZoneId").asText());
        form.getSelectByName("timeZoneId").setSelectedAttribute("Europe/Paris", true);
        page = form.getInputByValue("Choose").click();
        wc.waitForBackgroundJavaScript(10000L);
        testTitle(page, "Preferences");
        testMessageExists(page, "The time zone has been changed.");
        WebAssert.assertElementNotPresent(page, "changePreferredTimeZoneForm");

        page = page.getAnchorByText("Choose your time zone").click();
View Full Code Here

        testTitle(page, "Preferences");
        testMessageExists(page, "The time zone has been changed.");
        WebAssert.assertElementNotPresent(page, "changePreferredTimeZoneForm");

        page = page.getAnchorByText("Choose your time zone").click();
        wc.waitForBackgroundJavaScript(10000L);
        form = page.getHtmlElementById("changePreferredTimeZoneForm");
        assertEquals("Europe/Paris", form.getSelectByName("timeZoneId").asText());
    }

    private void testCancel(boolean withJavascript) throws Exception {
View Full Code Here

        WebClient wc = startWebClient(false);
        wc.setJavaScriptEnabled(withJavascript);
        HtmlPage page = goToChangePreferredTimeZonePage(wc);
        HtmlForm form = page.getHtmlElementById("changePreferredTimeZoneForm");
        page = form.getInputByValue("Cancel").click();
        wc.waitForBackgroundJavaScript(10000L);
        testTitle(page, "Preferences");
        WebAssert.assertElementNotPresent(page, "changePreferredTimeZoneForm");
    }

    private HtmlPage goToChangePreferredTimeZonePage(WebClient wc) throws Exception {
View Full Code Here

        WebClient wc = startWebClient(false);
        login(wc);
        HtmlPage page = wc.getPage(url("/preferences/Preferences.action"));
        HtmlAnchor changePreferredLocaleLink = page.getAnchorByText("Choose your preferred language");
        changePreferredLocaleLink.click();
        wc.waitForBackgroundJavaScript(10000L);
        WebAssert.assertElementPresent(page, "changePreferredLocaleForm");
        testBasics(page);

        HtmlAnchor changePreferredTimeZoneLink = page.getAnchorByText("Choose your time zone");
        changePreferredTimeZoneLink.click();
View Full Code Here

        WebAssert.assertElementPresent(page, "changePreferredLocaleForm");
        testBasics(page);

        HtmlAnchor changePreferredTimeZoneLink = page.getAnchorByText("Choose your time zone");
        changePreferredTimeZoneLink.click();
        wc.waitForBackgroundJavaScript(10000L);
        WebAssert.assertElementNotPresent(page, "changePreferredLocaleForm");
        WebAssert.assertElementPresent(page, "changePreferredTimeZoneForm");
        WebAssert.assertElementNotPresent(page, "changePasswordPreferencesForm");
        WebAssert.assertElementNotPresent(page, "changePasswordGenerationPreferencesForm");
        testBasics(page);
View Full Code Here

        WebAssert.assertElementNotPresent(page, "changePasswordGenerationPreferencesForm");
        testBasics(page);

        HtmlAnchor changePasswordPreferencesLink = page.getAnchorByText("Password preferences");
        changePasswordPreferencesLink.click();
        wc.waitForBackgroundJavaScript(10000L);
        WebAssert.assertElementNotPresent(page, "changePreferredLocaleForm");
        WebAssert.assertElementNotPresent(page, "changePreferredTimeZoneForm");
        WebAssert.assertElementPresent(page, "changePasswordPreferencesForm");
        WebAssert.assertElementNotPresent(page, "changePasswordGenerationPreferencesForm");
        testBasics(page);
View Full Code Here

        WebAssert.assertElementNotPresent(page, "changePasswordGenerationPreferencesForm");
        testBasics(page);

        HtmlAnchor changePasswordGenerationPreferencesLink = page.getAnchorByText("Random password generation preferences");
        changePasswordGenerationPreferencesLink.click();
        wc.waitForBackgroundJavaScript(10000L);
        WebAssert.assertElementNotPresent(page, "changePreferredLocaleForm");
        WebAssert.assertElementNotPresent(page, "changePreferredTimeZoneForm");
        WebAssert.assertElementNotPresent(page, "changePasswordPreferencesForm");
        WebAssert.assertElementPresent(page, "changePasswordGenerationPreferencesForm");
        testBasics(page);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.