List of usage examples for org.openqa.selenium.support.ui ExpectedConditions textToBePresentInElement
public static ExpectedCondition<Boolean> textToBePresentInElement(final WebElement element, final String text)
From source file:org.apache.deltaspike.test.jsf.impl.injection.uc001.InjectionDroneTest.java
License:Apache License
@Test @RunAsClient// w w w .j av a 2 s. c om public void testConverterWithError() throws MalformedURLException { driver.get(new URL(contextPath, "testValidatorConverter.xhtml").toString()); WebElement convertedValue = driver.findElement(By.id("converter:convertedValue")); convertedValue.sendKeys("String Value"); WebElement testConveterButton = driver.findElement(By.id("converter:testConveterButton")); testConveterButton.click(); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("converter:errorMessage"), "Value is not an Integer") .apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.injection.uc001.InjectionDroneTest.java
License:Apache License
@Test @RunAsClient//from w ww . j a v a 2 s . c om public void testValidator() throws MalformedURLException { driver.get(new URL(contextPath, "testValidatorConverter.xhtml").toString()); WebElement convertedValue = driver.findElement(By.id("validator:stringValue")); convertedValue.sendKeys("DeltaSpike"); WebElement testConveterButton = driver.findElement(By.id("validator:testValidatorButton")); testConveterButton.click(); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.injection.uc001.InjectionDroneTest.java
License:Apache License
@Test @RunAsClient//from ww w . ja v a2 s . c om public void testValidatorWithError() throws MalformedURLException { driver.get(new URL(contextPath, "testValidatorConverter.xhtml").toString()); WebElement convertedValue = driver.findElement(By.id("validator:stringValue")); convertedValue.sendKeys("Wrong Value"); WebElement testConveterButton = driver.findElement(By.id("validator:testValidatorButton")); testConveterButton.click(); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("validator:errorMessage"), "Not a valid value").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.injection.uc004.InjectionDroneTest.java
License:Apache License
@Test @RunAsClient//from w w w .j a v a2 s . c o m public void testValidatorWithError() throws MalformedURLException { driver.get(new URL(contextPath, "testValidatorConverter.xhtml").toString()); WebElement convertedValue = driver.findElement(By.id("validator:stringValue")); convertedValue.sendKeys("Wrong Value"); WebElement testConveterButton = driver.findElement(By.id("validator:testValidatorButton")); testConveterButton.click(); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("validator:errorMessage"), "The valid value should be DeltaSpike") .apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.message.JsfMessageTest.java
License:Apache License
@Test @RunAsClient//from w w w .ja v a 2 s . c om public void testEnglishMessages() throws Exception { driver.get(new URL(contextPath, "page.xhtml").toString()); //X comment this in if you like to debug the server //X I've already reported ARQGRA-213 for it //X System.out.println("contextpath= " + contextPath); //X Thread.sleep(600000L); // check the JSF FacesMessages Assert.assertNotNull(ExpectedConditions.presenceOfElementLocated(By.xpath("id('messages')")).apply(driver)); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.xpath("id('messages')/ul/li[1]"), "message with details warnInfo!") .apply(driver)); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.xpath("id('messages')/ul/li[2]"), "message without detail but parameter errorInfo.").apply(driver)); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.xpath("id('messages')/ul/li[3]"), "a simple message without a param.") .apply(driver)); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.xpath("id('messages')/ul/li[4]"), "simple message with a string param fatalInfo.").apply(driver)); // check the free message usage Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("test:valueOutput"), "a simple message without a param.") .apply(driver)); // and also the usage via direct EL invocation Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("test:elOutput"), "a simple message without a param.") .apply(driver)); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("test:elOutputWithParam"), "simple message with a string param hiho.").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.message.JsfMessageTest.java
License:Apache License
@Test @RunAsClient//from w w w.ja v a 2 s .com public void testGermanMessages() throws Exception { driver.get(new URL(contextPath, "page.xhtml?lang=de").toString()); // check the JSF FacesMessages Assert.assertNotNull(ExpectedConditions.presenceOfElementLocated(By.xpath("id('messages')")).apply(driver)); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.xpath("id('messages')/ul/li[1]"), "Nachricht mit Details warnInfo!") .apply(driver)); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.xpath("id('messages')/ul/li[2]"), "Nachricht ohne Details aber mit Parameter errorInfo.").apply(driver)); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.xpath("id('messages')/ul/li[3]"), "Einfache Nachricht ohne Parameter.") .apply(driver)); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.xpath("id('messages')/ul/li[4]"), "Einfache Nachricht mit String Parameter fatalInfo.").apply(driver)); // check the free message usage Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("test:valueOutput"), "Einfache Nachricht ohne Parameter.") .apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.scope.mapped.MappedJsfContextTest.java
License:Apache License
@Test @RunAsClient//from ww w. j a v a 2 s. c o m public void testViewScopedContext() throws Exception { driver.get(new URL(contextPath, "page.xhtml?req=47&sess=48&app=49").toString()); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("test:reqValue"), "47").apply(driver)); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("test:sessValue"), "48").apply(driver)); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("test:appValue"), "49").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.scope.view.ViewScopedContextTest.java
License:Apache License
@Test @RunAsClient//ww w . ja v a2 s . c o m public void testViewScopedContext() throws Exception { driver.get(new URL(contextPath, "page.xhtml").toString()); WebElement inputField = driver.findElement(By.id("test:valueInput")); inputField.sendKeys("23"); WebElement button = driver.findElement(By.id("test:saveButton")); button.click(); Assert.assertTrue( ExpectedConditions.textToBePresentInElement(By.id("test:valueOutput"), "23").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.scope.viewaccess.ViewAccessScopedWebAppTest.java
License:Apache License
@Test @RunAsClient/*from ww w . jav a 2 s . c o m*/ public void testForward() throws Exception { driver.get(new URL(contextPath, "page1.xhtml").toString()); WebElement inputFieldX = driver.findElement(By.id("testForm1:valueInputX")); inputFieldX.sendKeys("abc"); WebElement inputFieldY = driver.findElement(By.id("testForm1:valueInputY")); inputFieldY.sendKeys("xyz"); WebElement button = driver.findElement(By.id("testForm1:next")); button.click(); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("valueX"), "abc").apply(driver)); button = driver.findElement(By.id("testForm2:back")); button.click(); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("valueOutputX"), "abc").apply(driver)); Assert.assertFalse(ExpectedConditions.textToBePresentInElement(By.id("valueOutputY"), "xyz").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.scope.viewaccess.ViewAccessScopedWithFViewActionWebAppTest.java
License:Apache License
@Test @RunAsClient/*www. j a v a2 s . c o m*/ public void testForward() throws Exception { driver.get(new URL(contextPath, "index.xhtml").toString()); WebElement inputFieldX = driver.findElement(By.id("form:firstValue")); inputFieldX.sendKeys("abc"); WebElement inputFieldY = driver.findElement(By.id("form:secondValue")); inputFieldY.sendKeys("xyz"); WebElement button = driver.findElement(By.id("form:next")); button.click(); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("firstValue"), "abc").apply(driver)); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("secondValue"), "xyz").apply(driver)); }