Better regexp support for Selenium its

This commit is contained in:
David Gageot 2015-09-02 14:43:28 +02:00
parent 7bf080b812
commit b7d62595b9
2 changed files with 6 additions and 4 deletions

View File

@ -27,6 +27,7 @@ import com.sonar.orchestrator.selenium.Selenese;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import selenium.SeleneseTest;
import static util.ItUtils.projectDir;
@ -53,8 +54,7 @@ public class I18nTest {
"/ui/i18n/french-pack.html",
"/ui/i18n/locale-with-france-country.html",
"/ui/i18n/locale-with-swiss-country.html").build();
// Use the old runner because it fails with the new Selenium runner
orchestrator.executeSelenese(selenese);
new SeleneseTest(selenese).runOn(orchestrator);
}
}

View File

@ -270,7 +270,8 @@ public class SeleneseTest {
}
if (pattern.startsWith("regexp:")) {
find(selector).should().match(Pattern.compile(pattern.substring(7)));
String expectedRegEx = pattern.replaceFirst("regexp:", ".*") + ".*";
find(selector).should().match(Pattern.compile(expectedRegEx, Pattern.DOTALL));
return;
}
@ -287,7 +288,8 @@ public class SeleneseTest {
}
if (pattern.startsWith("regexp:")) {
find(selector).should().not().match(Pattern.compile(pattern.substring(7)));
String expectedRegEx = pattern.replaceFirst("regexp:", ".*") + ".*";
find(selector).should().not().match(Pattern.compile(expectedRegEx, Pattern.DOTALL));
return;
}