@Test
public void testComponentWideValidation() throws InterruptedException {
closeBrowser();
testAppFunctionalPage("/components/validation/componentWideValidation.jsf");
InputTextInspector doubleRangeInput = inputText("testForm:validDROnSubmit");
doubleRangeInput.type("1");
InputTextInspector urlInput = inputText("testForm:urlOnSubmit");
urlInput.type("not url");
ElementInspector submit = element("testForm:submitBt");
submit.click();
ElementInspector onSubmitMessage = element("testForm:inputOnSubmitMessage");
onSubmitMessage.assertContainsText("Value is required.");
ElementInspector dateChooserMessage = element("testForm:dchOnSubmitInput");
dateChooserMessage.assertContainsText("Value is required.");
ElementInspector doubleRangeMessage = element("testForm:ValidDROnSubmitMessage");
doubleRangeMessage.assertContainsText("Validation Error");
ElementInspector urlMessage = element("testForm:UrlOnSubmitMessage");
urlMessage.assertText("Validation error occurs Entered value is not url");
ElementInspector inputOffMessage = element("testForm:inputOffMessage");
inputOffMessage.assertText("");
ElementInspector dateChooserOffMessage = element("testForm:dchOffInput");
dateChooserOffMessage.assertText("");
ElementInspector dateRangeOffMessage = element("testForm:ValidDROffMessage");
dateRangeOffMessage.assertText("");
ElementInspector urlOffMessage = element("testForm:UrlOffMessage");
urlOffMessage.assertText("");
ElementInspector onDemandMessage = element("testForm:inputOnDemandMessage");
onDemandMessage.assertText("");
ElementInspector dateChooserOnDemandMessage = element("testForm:dchOnDemandInput");
dateChooserOnDemandMessage.assertText("");
ElementInspector doubleRangeOnDemandMessage = element("testForm:ValidDROnDemandMessage");
doubleRangeOnDemandMessage.assertText("");
ElementInspector urlOnDemandMessage = element("testForm:UrlOnDemandMessage");
urlOnDemandMessage.assertText("");
inputText("testForm:inputOnSubmit").clear();
inputText("testForm:inputOnSubmit").type("Text");
dateChooser("testForm:dchOnSubmit").field().type("Mar 20, 2007");
doubleRangeInput.clear();
doubleRangeInput.type("0.1");
urlInput.clear();
urlInput.type("http://www.teamdev.com");
InputTextInspector doubleRangeOffInput = inputText("testForm:validDROff");
doubleRangeOffInput.clear();
doubleRangeOffInput.type("1");
InputTextInspector urlOffInput = inputText("testForm:urlOff");
urlOffInput.clear();
urlOffInput.type("not url");
InputTextInspector dobleRangeOnDemandInput = inputText("testForm:validDROnDemand");
dobleRangeOnDemandInput.clear();
dobleRangeOnDemandInput.type("1");
InputTextInspector urlOnDemand = inputText("testForm:urlOnDemand");
urlOnDemand.clear();
urlOnDemand.type("not url");
submit.click();
waitForPageToLoad();
onSubmitMessage.assertText("");
dateChooserMessage.assertText("");
doubleRangeMessage.assertText("");
urlMessage.assertText("");
inputOffMessage.assertContainsText("Value is required.");
dateChooserOffMessage.assertContainsText("Value is required.");
assertTrue(dateRangeOffMessage.text().contains("Validation Error: Specified attribute is not between the expected values of 0.001 and 0.999.") ||
dateRangeOffMessage.text().contains("Validation Error"));
urlOffMessage.assertContainsText("Validation error occurs Entered value is not url");
onDemandMessage.assertContainsText("Value is required.");
dateChooserOnDemandMessage.assertContainsText("Value is required.");
assertTrue(doubleRangeOnDemandMessage.text().contains("Validation Error: Specified attribute is not between the expected values of 0.001 and 0.999.") ||
doubleRangeOnDemandMessage.text().contains("Validation Error"));
urlOnDemandMessage.assertText("Validation error occurs Entered value is not url");
inputText("testForm:inputOff").clear();
inputText("testForm:inputOff").type("Text");
dateChooser("testForm:dchOff").field().clear();
dateChooser("testForm:dchOff").field().type("Mar 20, 2007");
doubleRangeOffInput.clear();
doubleRangeOffInput.type("0.1");
inputText("testForm:urlOff").clear();
inputText("testForm:urlOff").type("http://www.teamdev.com");
inputText("testForm:inputOnDemand").clear();
inputText("testForm:inputOnDemand").type("Text");
dateChooser("testForm:dchOnDemand").field().clear();
dateChooser("testForm:dchOnDemand").field().type("Mar 20, 2007");
dobleRangeOnDemandInput.clear();
dobleRangeOnDemandInput.type("0.1");
urlOnDemand.clear();
urlOnDemand.type("http://www.teamdev.com");
submit.click();
waitForPageToLoad();
onSubmitMessage.assertText("");
dateChooserMessage.assertText("");
doubleRangeMessage.assertText("");