protected <T extends HtmlElement> T getFirstMatchingElement(HtmlPage page, Class<T> elementClass, String id) { Set<T> inputs = getElements(page.getBody(), elementClass); for (T input : inputs) { if (input.getId().contains(id)) { return input; } } return null; }
protected <T extends HtmlElement> T getFirstMatchingElement(HtmlPage page, Class<T> elementClass, String id) { Set<T> inputs = getElements(page.getBody(), elementClass); for (T input : inputs) { if (input.getId().contains(id)) { return input; } } return null; }
/** * Returns the value of the <tt>bgColor</tt> attribute. * @return the value of the <tt>bgColor</tt> attribute * @see <a href="http://msdn.microsoft.com/en-us/library/ms533505.aspx">MSDN Documentation</a> */ public String jsxGet_bgColor() { String bgColor = getHtmlPage().getBody().getAttribute("bgColor"); if (bgColor == DomElement.ATTRIBUTE_NOT_DEFINED) { bgColor = "#ffffff"; } return bgColor; }
/** * Returns the value of the <tt>bgColor</tt> attribute. * @return the value of the <tt>bgColor</tt> attribute * @see <a href="http://msdn.microsoft.com/en-us/library/ms533505.aspx">MSDN Documentation</a> */ public String jsxGet_bgColor() { String bgColor = getHtmlPage().getBody().getAttribute("bgColor"); if (bgColor == DomElement.ATTRIBUTE_NOT_DEFINED) { bgColor = "#ffffff"; } return bgColor; }
/** * Returns the value of the <tt>bgColor</tt> attribute. * @return the value of the <tt>bgColor</tt> attribute * @see <a href="http://msdn.microsoft.com/en-us/library/ms533505.aspx">MSDN Documentation</a> */ public String jsxGet_bgColor() { String bgColor = getHtmlPage().getBody().getAttribute("bgColor"); if (bgColor == DomElement.ATTRIBUTE_NOT_DEFINED) { bgColor = "#ffffff"; } return bgColor; }
/** * {@inheritDoc} */ @Override public HTMLElement getActiveElement() { if (activeElement_ == null) { final HtmlElement body = getPage().getBody(); if (body != null) { activeElement_ = (HTMLElement) getScriptableFor(body); } } return activeElement_; }
@Test(groups = { "contexts" }) @SpecAssertion(section = "6.7.5", id = "id") public void testBeanWithDefaultQualifier() throws Exception { WebClient client = new WebClient(); HtmlPage page = client.getPage(getPath("builtin.jsf")); assert page.getBody().getTextContent().contains("Correct qualifier: true"); }
@Test(groups = INTEGRATION) @SpecAssertion(section = CONVERSATION, id = "id") public void testBeanWithDefaultQualifier() throws Exception { WebClient client = new WebClient(); HtmlPage page = client.getPage(getPath("builtin.jsf")); assert page.getBody().getTextContent().contains("Correct qualifier: true"); }
/** * Sets the value of the <tt>bgColor</tt> attribute. * @param bgColor the value of the <tt>bgColor</tt> attribute * @see <a href="http://msdn.microsoft.com/en-us/library/ms533505.aspx">MSDN Documentation</a> */ public void jsxSet_bgColor(final String bgColor) { final HTMLBodyElement body = (HTMLBodyElement) getHtmlPage().getBody().getScriptObject(); body.jsxSet_bgColor(bgColor); }
@Test(groups = { "contexts" }) @SpecAssertion(section = "6.7.5", id = "ie") public void testBeanWithNameJavaxEnterpriseContextConversation() throws Exception { WebClient client = new WebClient(); HtmlPage page = client.getPage(getPath("builtin.jsf")); assert page.getBody().getTextContent().contains("Correct name: true"); }
@Test(groups = INTEGRATION) @SpecAssertion(section = CONVERSATION, id = "ib") @SpecAssertion(section = CONVERSATION, id = "iaa") public void testBeanWithRequestScope() throws Exception { WebClient client = new WebClient(); HtmlPage page = client.getPage(getPath("builtin.jsf")); assert page.getBody().getTextContent().contains("Correct scope: true"); }
@Test(groups = INTEGRATION) @SpecAssertion(section = CONVERSATION, id = "l") @SpecAssertion(section = CONVERSATION_CONTEXT_EE, id = "e") public void testTransientConversationHasNullId() throws Exception { WebClient client = new WebClient(); HtmlPage page = client.getPage(getPath("builtin.jsf")); assert page.getBody().getTextContent().contains("Default conversation has null id: true"); }
/** * {@inheritDoc} */ @Override @JsxSetter({CHROME, FF}) public void setBgColor(final String color) { final HTMLBodyElement body = getPage().getBody().getScriptableObject(); body.setBgColor(color); }
/** * {@inheritDoc} */ @Override @JsxSetter({CHROME, FF}) public void setLinkColor(final String color) { final HTMLBodyElement body = getPage().getBody().getScriptableObject(); body.setLink(color); }
/** * {@inheritDoc} */ @Override @JsxSetter({CHROME, FF}) public void setVlinkColor(final String color) { final HTMLBodyElement body = getPage().getBody().getScriptableObject(); body.setVLink(color); }
/** * {@inheritDoc} */ @Override @JsxSetter({CHROME, FF}) public void setFgColor(final String color) { final HTMLBodyElement body = getPage().getBody().getScriptableObject(); body.setText(color); }
/** * {@inheritDoc} */ @Override @JsxSetter({CHROME, FF}) public void setAlinkColor(final String color) { final HTMLBodyElement body = getPage().getBody().getScriptableObject(); body.setALink(color); }
@Test(groups = { "contexts" }) @SpecAssertions({ @SpecAssertion(section = "6.7.5", id = "l"), @SpecAssertion(section = "6.7.4", id = "e") }) public void testTransientConversationHasNullId() throws Exception { WebClient client = new WebClient(); HtmlPage page = client.getPage(getPath("builtin.jsf")); assert page.getBody().getTextContent().contains("Default conversation has null id: true"); }
@Test(groups = INTEGRATION) @SpecAssertion(section = CONVERSATION, id = "m") public void testConversationHasDefaultTimeout() throws Exception { WebClient client = new WebClient(); HtmlPage page = client.getPage(getPath("cumulus.jsf")); assert !isLongRunning(page); // begin a conversation HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton"); page = beginConversationButton.click(); assert page.getBody().getTextContent().contains("Stratocumulus"); }
@Test(groups = INTEGRATION) @SpecAssertion(section = CONVERSATION, id = "q") public void testEndTransientConversationThrowsException() throws Exception { WebClient client = new WebClient(); HtmlPage page = client.getPage(getPath("cumulus.jsf")); assert !isLongRunning(page); // try ending a transient conversation HtmlSubmitInput endConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "endConversationAndSwallowException"); page = endConversationButton.click(); assert page.getBody().getTextContent().contains("Hello world!"); }