Last active
August 29, 2015 13:59
-
-
Save alexandreaquiles/85ecbce951672970ecd4 to your computer and use it in GitHub Desktop.
Mudanças para exercício de Selenium do FJ-22.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.caelum.argentum; | |
import org.junit.After; | |
import org.junit.Assert; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
public class GeraGraficoTest { | |
private static final String URL = "http://localhost:8080/fj22-argentum-web/index.xhtml"; | |
private WebDriver driver; | |
@Before | |
public void setUp(){ | |
driver = new FirefoxDriver(); | |
} | |
@After | |
public void tearDown(){ | |
driver.close(); | |
} | |
@Test | |
public void testeAoGerarGraficoSemTituloUmaMensagemEhApresentada() { | |
driver.get(URL); | |
WebElement botaoGerarGrafico = driver.findElement(By.id("botaoGerarGrafico")); | |
botaoGerarGrafico.submit(); | |
WebElement mensagensDeErro = driver.findElement(By.id("mensagensDeErro")); | |
String textoDaMensagemDeErro = mensagensDeErro.getText(); | |
boolean existeMensagemDaMedia = textoDaMensagemDeErro.contains("Escolha uma média."); | |
Assert.assertTrue(existeMensagemDaMedia); | |
boolean existeMensagemDoIndicador = textoDaMensagemDeErro.contains("Escolha um indicador."); | |
Assert.assertTrue(existeMensagemDoIndicador); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- ... --> | |
<h:form prependId="false"> | |
<p:messages id="mensagensDeErro" autoUpdate="true" /> | |
<h:panelGrid columns="5"> | |
<!-- ... --> | |
<p:selectOneButton value="#{argentumBean.nomeMedia}" required="true" requiredMessage="Escolha uma média."> | |
<!-- ... --> | |
<p:selectOneButton value="#{argentumBean.nomeIndicadorBase}" required="true" requiredMessage="Escolha um indicador."> | |
<!-- ... --> | |
<p:commandButton id="botaoGerarGrafico" value="Gerar gráfico" update=":grafico" action="#{argentumBean.geraGrafico}" /> | |
<!-- ... --> | |
</h:panelGrid> | |
</h:form> | |
<!-- ... --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment