]> source.dussan.org Git - sonarqube.git/commitdiff
Better regexp support for Selenium its
authorDavid Gageot <david@gageot.net>
Wed, 2 Sep 2015 12:43:28 +0000 (14:43 +0200)
committerDavid Gageot <david@gageot.net>
Wed, 2 Sep 2015 17:29:12 +0000 (19:29 +0200)
it/it-tests/src/test/java/administration/suite/ui/I18nTest.java
it/it-tests/src/test/java/selenium/SeleneseTest.java

index 14a9ec84f4dd4b0b1df40c6dfea83dd1ea9b9fa0..13bd580806658b926ae7ad0b1b201f45c44d8742 100644 (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);
   }
 
 }
index 6db97d04de3382d39e3c353e26df8af2b252a8b9..39e36a4c767271ac6b3a36a262c70604759e0535 100644 (file)
@@ -291,7 +291,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;
     }
 
@@ -308,7 +309,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;
     }