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
public class GoogleSearchTest { | |
private DefaultSelenium selenium; | |
@Before | |
public void startSeleniumClient() { | |
selenium = new DefaultSelenium("localhost", 4444, "firefox", "http://www.google.com"); | |
selenium.start(); | |
} |
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
public class GoogleSearchTest { | |
private DefaultSelenium selenium; | |
private GoogleSearchPage googleSearchPage; | |
@Before | |
public void startSeleniumClient() { | |
selenium = new DefaultSelenium("localhost", 4444, "firefox", "http://www.google.com"); | |
googleSearchPage = new GoogleSearchPage(selenium); | |
selenium.start(); |
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
@Test | |
public void searchQueryShouldBePartOfTheTitleOfTheResultPage() { | |
assertThat(new GoogleSearchPage(selenium) | |
.searchFor("Selenium OpenQA") | |
.title(), | |
containsString("Selenium OpenQA")); | |
} |
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
public class GoogleAplicationDriver extends TestWatchman { | |
private DefaultSelenium selenium; | |
@Override | |
public void starting(FrameworkMethod method) { | |
selenium = new DefaultSelenium("localhost", 4444, "firefox", "http://www.google.com"); | |
selenium.start(); | |
} | |
@Override |
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
public class GoogleSearchTest { | |
@Rule | |
GoogleAplicationDriver googleAplicationDriver = new GoogleAplicationDriver(); | |
@Test | |
public void searchQueryShouldBePartOfTheTitleOfTheResultPage() { | |
GoogleResultPage googleResultPage = googleAplicationDriver | |
.goToSearchPage() | |
.searchFor("Selenium OpenQA") |
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
String mensaje = "El usuario Alfredo Casado tiene el dni: 123456798P"; | |
assertTrue(mensaje.contains("Alfredo Casado")); | |
assertTrue(mensaje.contains("123456798P")); |
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
String mensaje = "El usuario Alfredo Casado tiene el dni: 123456798P"; | |
assertThat(mensaje, allOf(containsString("Alfredo Casado"), | |
containsString("123456798P"))); |
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
Expected: (a string containing "Alfredo Casado" and a string containing "123456798P") | |
got: "El usuario Alfredo Casado tiene el dni: 123556798P" | |
) |
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
assertThat(mensaje, allOf(containsString(WITH_EXPECTED_USER_NAME), | |
containsString(WITH_EXPECTED_DNI))); |
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
Set<String> cesta = new HashSet(); | |
cesta.add("manzana"); | |
cesta.add("platano"); | |
cesta.add("fresa"); | |
assertTrue(cesta.contains("manzana") || cesta.contains("pera")); |
OlderNewer