Skip to content

Instantly share code, notes, and snippets.

View framiere's full-sized avatar

Florent Ramière framiere

View GitHub Profile
@framiere
framiere / CompTest.java
Created March 18, 2011 18:46
funky comparator
class Sort extends Comp<Person> {{r = t1.getName().compareTo(t2.getName());}}
List<Person> sortedPersons = from(with(Sort.class)).sortedCopy(asList(john, joe));
<!--Ajouter la property-->
<sonar.jacoco.itReportPath>${project.build.directory}/jacoco-it.exec</sonar.jacoco.itReportPath>
<!-- Ajout du plugin jacoco et configuration de l'agent -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.6.2.201302030002</version>
<configuration>
<propertyName>jacoco.agent.argLine</propertyName>
@Test
public void casUsageFonctionnel(WebDriver driver) {
String baseUrl = "http://localhost:8080";
driver.get(baseUrl + "/books/");
driver.findElement(By.id("form:selectAccounts")).click();
assertEquals("Identification", driver.getTitle());
driver.findElement(By.id("j_username")).clear();
driver.findElement(By.id("j_username")).sendKeys("admin");
driver.findElement(By.id("login")).click();
assertEquals("Application books", driver.getTitle());
user
open /books/
clickAndWait id=form:selectAccounts
assertTitle Identification
type id=j_username admin
clickAndWait id=login
assertTitle Application books
clickAndWait id=form:selectAccounts
assertTitle Recherche de Compte Utilisateur
click //div[@id='form:username_panel']/ul/li
@Test
public void accountTest() {
logInAsAdmin();
selectAccounts();
selectHomer();
updateUsernamePasswordAndEmail();
updateAdress();
addAdminRole();
addGodRole();
addDocument();
public class LoginPage {
@FindBy(id = "j_username")
public WebElement user;
@FindBy(id = "j_password")
public WebElement password;
@FindBy(id = "login")
public WebElement loginButton;
public void login(String userValue, String passwordValue) {
user.clear();
public class ScenarioIT extends SeleniumTest {
// account
AccountSearch accountSearch;
AccountEdit accountEdit;
// document
DocumentSearch documentSearch;
DocumentEdit documentEdit;
// role
webClient.hasMessage("Saved " + userName + " successfully in database");
public void waitUntilRemoved(final By by) {
try {
until(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver from) {
from.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
try {
return from.findElements(by).isEmpty();
} catch (NoSuchElementException e) {
return true;