Move selenium package to util.selenium package

This commit is contained in:
Julien Lancelot 2015-10-23 11:17:05 +02:00
parent 835566665b
commit 249a1dbe68
26 changed files with 60 additions and 66 deletions

View File

@ -26,7 +26,7 @@ import com.sonar.orchestrator.selenium.Selenese;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import selenium.SeleneseTest;
import util.selenium.SeleneseTest;
import static util.ItUtils.projectDir;

View File

@ -42,7 +42,7 @@ import org.sonar.wsclient.qualitygate.UpdateCondition;
import org.sonar.wsclient.services.PropertyQuery;
import org.sonar.wsclient.services.ResourceQuery;
import org.sonar.wsclient.user.UserParameters;
import selenium.SeleneseTest;
import util.selenium.SeleneseTest;
import static org.assertj.core.api.Assertions.assertThat;
import static util.ItUtils.projectDir;

View File

@ -26,7 +26,7 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.sonar.wsclient.services.PropertyQuery;
import org.sonar.wsclient.services.PropertyUpdateQuery;
import selenium.SeleneseTest;
import util.selenium.SeleneseTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@ -26,7 +26,7 @@ import com.sonar.orchestrator.selenium.Selenese;
import org.junit.ClassRule;
import org.junit.Test;
import org.sonar.wsclient.services.PropertyQuery;
import selenium.SeleneseTest;
import util.selenium.SeleneseTest;
import static org.assertj.core.api.Assertions.assertThat;
import static util.ItUtils.projectDir;

View File

@ -27,7 +27,7 @@ import com.sonar.orchestrator.selenium.Selenese;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import selenium.SeleneseTest;
import util.selenium.SeleneseTest;
import static util.ItUtils.projectDir;

View File

@ -29,7 +29,7 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.sonar.wsclient.SonarClient;
import org.sonar.wsclient.user.UserParameters;
import selenium.SeleneseTest;
import util.selenium.SeleneseTest;
import static util.ItUtils.projectDir;

View File

@ -27,7 +27,7 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import selenium.SeleneseTest;
import util.selenium.SeleneseTest;
public class ManualRulesTest {

View File

@ -24,8 +24,8 @@ import org.sonar.wsclient.services.Resource;
import org.sonar.wsclient.services.ResourceQuery;
import org.subethamail.wiser.Wiser;
import org.subethamail.wiser.WiserMessage;
import selenium.SeleneseTest;
import util.ItUtils;
import util.selenium.SeleneseTest;
import static org.assertj.core.api.Assertions.assertThat;
import static util.ItUtils.projectDir;

View File

@ -19,8 +19,8 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.wsclient.services.Server;
import org.sonar.wsclient.services.ServerQuery;
import selenium.SeleneseTest;
import util.ItUtils;
import util.selenium.SeleneseTest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;

View File

@ -22,7 +22,7 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.sonar.wsclient.services.Server;
import org.sonar.wsclient.services.ServerQuery;
import selenium.SeleneseTest;
import util.selenium.SeleneseTest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;

View File

@ -23,8 +23,8 @@ import org.junit.rules.ExpectedException;
import org.sonar.wsclient.base.HttpException;
import org.sonar.wsclient.services.PropertyDeleteQuery;
import org.sonar.wsclient.services.PropertyUpdateQuery;
import selenium.SeleneseTest;
import util.ItUtils;
import util.selenium.SeleneseTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@ -13,7 +13,7 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.sonar.wsclient.services.Plugin;
import org.sonar.wsclient.services.UpdateCenterQuery;
import selenium.SeleneseTest;
import util.selenium.SeleneseTest;
import static org.assertj.core.api.Assertions.assertThat;
import static util.ItUtils.pluginArtifact;

View File

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import org.openqa.selenium.firefox.FirefoxDriver;

View File

@ -17,8 +17,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebElement;
@ -26,10 +29,6 @@ import org.openqa.selenium.internal.FindsByCssSelector;
import org.openqa.selenium.internal.FindsById;
import org.openqa.selenium.internal.FindsByName;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
public class ByCssSelectorOrByNameOrById extends By implements Serializable {
private static final long serialVersionUID = -3910258723099459239L;

View File

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
public interface Consumer<T> {
void accept(T t);

View File

@ -17,12 +17,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import com.google.common.base.Function;
import org.openqa.selenium.WebElement;
import java.util.Collection;
import org.openqa.selenium.WebElement;
class ElementFilter {
private static final ElementFilter ANY = new ElementFilter("", new Function<Collection<WebElement>, Collection<WebElement>>() {

View File

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import java.util.ArrayList;
import java.util.List;

View File

@ -17,22 +17,21 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.collect.FluentIterable;
import java.util.Collection;
import java.util.List;
import java.util.NoSuchElementException;
import javax.annotation.Nullable;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.NoSuchElementException;
class LazyDomElement {
private final SeleniumDriver driver;
private final By selector;
@ -169,4 +168,4 @@ class LazyDomElement {
public String toString() {
return Text.toString(selector) + filter.getDescription();
}
}
}

View File

@ -17,19 +17,19 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import com.google.common.base.*;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.collect.FluentIterable;
import org.openqa.selenium.WebElement;
import javax.annotation.Nullable;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.regex.Pattern;
import static selenium.Text.plural;
import static selenium.WebElementHelper.text;
import javax.annotation.Nullable;
import org.openqa.selenium.WebElement;
class LazyShould {
private final LazyDomElement element;
@ -78,7 +78,7 @@ class LazyShould {
return !elements.isEmpty() && FluentIterable.from(elements).anyMatch(new Predicate<WebElement>() {
@Override
public boolean apply(WebElement element) {
return regexp.matcher(text(element)).matches();
return regexp.matcher(WebElementHelper.text(element)).matches();
}
});
}
@ -90,7 +90,7 @@ class LazyShould {
@Nullable
@Override
public String apply(@Nullable WebElement element) {
return text(element);
return WebElementHelper.text(element);
}
});
}
@ -107,9 +107,9 @@ class LazyShould {
@Override
public boolean apply(@Nullable WebElement element) {
if (text.startsWith("exact:")) {
return text(element).equals(text.substring(6));
return WebElementHelper.text(element).equals(text.substring(6));
}
return text(element).contains(text);
return WebElementHelper.text(element).contains(text);
}
});
}
@ -120,7 +120,7 @@ class LazyShould {
return "It contains " + statuses(elements, new Function<WebElement, String>() {
@Override
public String apply(WebElement element) {
return text(element);
return WebElementHelper.text(element);
}
});
}
@ -139,7 +139,7 @@ class LazyShould {
new Function<List<WebElement>, String>() {
@Override
public String apply(List<WebElement> elements) {
return "It contains " + plural(elements.size(), "element");
return "It contains " + Text.plural(elements.size(), "element");
}
});
}

View File

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import java.util.NoSuchElementException;

View File

@ -17,18 +17,17 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import java.util.NoSuchElementException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.InvalidElementStateException;
import org.openqa.selenium.NotFoundException;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriverException;
import java.util.NoSuchElementException;
import java.util.concurrent.TimeUnit;
import static java.util.concurrent.TimeUnit.SECONDS;
class Retry {

View File

@ -17,10 +17,16 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.selenium.Selenese;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import org.assertj.core.util.Strings;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
@ -29,18 +35,11 @@ import org.openqa.selenium.By;
import org.openqa.selenium.NotFoundException;
import org.openqa.selenium.WebElement;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Objects.requireNonNull;
import static java.util.regex.Pattern.DOTALL;
import static org.assertj.core.api.Assertions.assertThat;
import static selenium.Retry._30_SECONDS;
import static util.selenium.Retry._30_SECONDS;
public class SeleneseTest {
private final Selenese suite;

View File

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
public interface SeleniumDriver extends org.openqa.selenium.WebDriver, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.internal.FindsById, org.openqa.selenium.internal.FindsByClassName, org.openqa.selenium.internal.FindsByLinkText, org.openqa.selenium.internal.FindsByName, org.openqa.selenium.internal.FindsByCssSelector, org.openqa.selenium.internal.FindsByTagName, org.openqa.selenium.internal.FindsByXPath, org.openqa.selenium.interactions.HasInputDevices, org.openqa.selenium.HasCapabilities, org.openqa.selenium.TakesScreenshot {
}

View File

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import com.google.common.base.Joiner;
import org.openqa.selenium.By;

View File

@ -17,10 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.UnreachableBrowserException;
package util.selenium;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
@ -29,6 +26,8 @@ import java.lang.reflect.Proxy;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.UnreachableBrowserException;
class ThreadSafeDriver {
private ThreadSafeDriver() {
@ -78,4 +77,4 @@ class ThreadSafeDriver {
return interfaces.toArray(new Class[interfaces.size()]);
}
}
}

View File

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package selenium;
package util.selenium;
import org.openqa.selenium.WebElement;