Partially externalize WebDriver tests

This change does a few things:

  1. Partially externalized WebDriver tests by using ChromeDriver
     as an implementation of WebDriver API in the external build.
  2. Refactored WebDriverRule.java to decouple the creation and
     using of WebDriver related stuff so we can have different
     implementations in internal and external builds.
  3. Refactored the usage of some internal libraries to have a
     central place to store all of them to make it easier to
     remove them in the external build.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=233661757
This commit is contained in:
shicong 2019-02-12 12:58:11 -08:00 committed by jianglai
parent 4097dae3b2
commit 76028ba1b4
75 changed files with 1743 additions and 28 deletions

View file

@ -26,31 +26,27 @@ import google.registry.module.frontend.FrontendServlet;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import javax.servlet.Filter;
/** Lightweight HTTP server for testing the Nomulus Admin and Registrar consoles. */
public final class RegistryTestServer {
// In most cases, the current working dir is ${projectRoot}/gradle/${subproject}
private static final String PROJECT_ROOT =
Optional.ofNullable(System.getProperty("test.projectRoot")).orElse("../../");
private static final String RESOURCES_DIR =
Optional.ofNullable(System.getProperty("test.resourcesDir")).orElse("build/resources/main");
public static final ImmutableMap<String, Path> RUNFILES =
new ImmutableMap.Builder<String, Path>()
.put(
"/index.html",
Paths.get(
"../domain_registry/java/google/registry/ui/html/index.html"))
.put(
"/error.html",
Paths.get(
"../domain_registry/java/google/registry/ui/html/error.html"))
.put(
"/assets/js/*",
Paths.get("../domain_registry/java/google/registry/ui"))
.put(
"/assets/css/*",
Paths.get("../domain_registry/java/google/registry/ui/css"))
.put("/assets/sources/*", Paths.get(".."))
.put(
"/assets/*",
Paths.get("../domain_registry/java/google/registry/ui/assets"))
.put("/index.html", Paths.get(PROJECT_ROOT, "/java/google/registry/ui/html/index.html"))
.put("/error.html", Paths.get(PROJECT_ROOT, "/java/google/registry/ui/html/error.html"))
.put("/assets/js/*", Paths.get(RESOURCES_DIR, "/google/registry/ui"))
.put("/assets/css/*", Paths.get(RESOURCES_DIR, "/google/registry/ui/css"))
.put("/assets/sources/*", Paths.get(PROJECT_ROOT))
.put("/assets/*", Paths.get(PROJECT_ROOT, "/java/google/registry/ui/assets"))
.build();
private static final ImmutableList<Route> ROUTES =