From ae11ca9b007de9ea365eebe912ee53f94c27085d Mon Sep 17 00:00:00 2001 From: jleyba Date: Mon, 6 May 2019 16:26:39 -0700 Subject: [PATCH] [java] More progress building with bazel All of java/client/src should build with bazel. The java/client/test tree is a work in progress. Running tests is the current bottleneck as anything that tries to start a browser crashes due to the bazel sandbox: My latest results for `bazel test java/client/test/...`: //java/client/test/org/openqa/selenium/atoms:CompiledAtomsNotLeakingTest (cached) PASSED in 0.3s //java/client/test/org/openqa/selenium/atoms:InputAtomsTest (cached) PASSED in 0.4s //java/client/test/org/openqa/selenium/io:CircularOutputStreamTest (cached) PASSED in 0.7s //java/client/test/org/openqa/selenium/io:FileHandlerTest (cached) PASSED in 0.7s //java/client/test/org/openqa/selenium/io:TemporaryFilesystemTest (cached) PASSED in 0.7s //java/client/test/org/openqa/selenium/io:ZipTest (cached) PASSED in 0.7s //java/client/test/org/openqa/selenium/net:LinuxEphemeralPortRangeDetectorTest (cached) PASSED in 0.4s //java/client/test/org/openqa/selenium/net:NetworkUtilsTest (cached) PASSED in 0.4s //java/client/test/org/openqa/selenium/net:UrlCheckerTest (cached) PASSED in 1.1s //java/client/test/org/openqa/selenium/os:CommandLineTest (cached) PASSED in 3.0s //java/client/test/org/openqa/selenium/support:small-tests (cached) PASSED in 2.5s //java/client/test/org/openqa/selenium/testing:IgnoreComparatorUnitTest (cached) PASSED in 0.7s //java/client/test/org/openqa/selenium/support:large-tests FAILED in 12.2s --- BUILD.bazel | 0 copy_file.bzl | 11 ++ cpp/prebuilt/BUILD.bazel | 21 ++++ .../src/com/thoughtworks/selenium/BUILD.bazel | 58 ++++++++++ .../selenium/condition/BUILD.bazel | 11 ++ .../selenium/webdriven/BUILD.bazel | 105 +++++++++++++++++- .../selenium/webdriven/commands/BUILD.bazel | 14 +++ .../org/openqa/selenium/chrome/BUILD.bazel | 14 +++ .../org/openqa/selenium/devtools/BUILD.bazel | 1 + .../src/org/openqa/selenium/edge/BUILD.bazel | 11 ++ .../org/openqa/selenium/firefox/BUILD.bazel | 25 +++++ .../openqa/selenium/firefox/xpi/BUILD.bazel | 40 +++++++ .../src/org/openqa/selenium/ie/BUILD.bazel | 11 ++ .../src/org/openqa/selenium/io/BUILD.bazel | 4 + .../src/org/openqa/selenium/net/BUILD.bazel | 6 + .../src/org/openqa/selenium/opera/BUILD.bazel | 11 ++ .../src/org/openqa/selenium/os/BUILD.bazel | 2 + .../org/openqa/selenium/remote/BUILD.bazel | 1 + .../openqa/selenium/remote/http/BUILD.bazel | 4 + .../org/openqa/selenium/safari/BUILD.bazel | 13 +++ .../org/openqa/selenium/support/BUILD.bazel | 50 ++++++++- .../selenium/support/events/BUILD.bazel | 8 ++ .../openqa/selenium/support/ui/BUILD.bazel | 55 +++++++++ .../test/org/openqa/selenium/BUILD.bazel | 85 ++++++++++++++ .../org/openqa/selenium/atoms/BUILD.bazel | 46 ++++++++ .../atoms/CompiledAtomsNotLeakingTest.java | 20 ++-- .../openqa/selenium/atoms/InputAtomsTest.java | 5 +- .../selenium/atoms/JavaScriptLoader.java | 25 ++--- .../test/org/openqa/selenium/net/BUILD.bazel | 5 +- .../org/openqa/selenium/support/BUILD.bazel | 74 ++++++++++++ .../org/openqa/selenium/testing/BUILD.bazel | 76 +++++++++++++ .../selenium/testing/JUnit4TestBase.java | 2 + .../selenium/testing/drivers/BUILD.bazel | 40 +++++++ javascript/atoms/fragments/BUILD.bazel | 9 +- javascript/selenium-atoms/BUILD.bazel | 54 ++++----- javascript/webdriver/atoms/BUILD.bazel | 26 ++++- third_party/firebug/BUILD.bazel | 6 + third_party/java/service/BUILD.bazel | 20 +++- third_party/js/selenium/BUILD.bazel | 18 +++ third_party/js/sizzle/BUILD.bazel | 8 ++ 40 files changed, 914 insertions(+), 81 deletions(-) create mode 100644 BUILD.bazel create mode 100644 copy_file.bzl create mode 100644 cpp/prebuilt/BUILD.bazel create mode 100644 java/client/src/com/thoughtworks/selenium/BUILD.bazel create mode 100644 java/client/src/com/thoughtworks/selenium/condition/BUILD.bazel create mode 100644 java/client/src/com/thoughtworks/selenium/webdriven/commands/BUILD.bazel create mode 100644 java/client/src/org/openqa/selenium/chrome/BUILD.bazel create mode 100644 java/client/src/org/openqa/selenium/edge/BUILD.bazel create mode 100644 java/client/src/org/openqa/selenium/firefox/BUILD.bazel create mode 100644 java/client/src/org/openqa/selenium/firefox/xpi/BUILD.bazel create mode 100644 java/client/src/org/openqa/selenium/ie/BUILD.bazel create mode 100644 java/client/src/org/openqa/selenium/opera/BUILD.bazel create mode 100644 java/client/src/org/openqa/selenium/safari/BUILD.bazel create mode 100644 java/client/src/org/openqa/selenium/support/events/BUILD.bazel create mode 100644 java/client/src/org/openqa/selenium/support/ui/BUILD.bazel create mode 100644 java/client/test/org/openqa/selenium/atoms/BUILD.bazel create mode 100644 java/client/test/org/openqa/selenium/support/BUILD.bazel create mode 100644 java/client/test/org/openqa/selenium/testing/BUILD.bazel create mode 100644 third_party/firebug/BUILD.bazel create mode 100644 third_party/js/selenium/BUILD.bazel create mode 100644 third_party/js/sizzle/BUILD.bazel diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/copy_file.bzl b/copy_file.bzl new file mode 100644 index 0000000000000..618010add33c6 --- /dev/null +++ b/copy_file.bzl @@ -0,0 +1,11 @@ +def copy_file(name, src, out = None, **kwargs): + if out == None: + out = src + + native.genrule( + name = name, + srcs = [src], + outs = [out], + cmd = "cp $< $@", + **kwargs + ) diff --git a/cpp/prebuilt/BUILD.bazel b/cpp/prebuilt/BUILD.bazel new file mode 100644 index 0000000000000..81b60a53ce6a5 --- /dev/null +++ b/cpp/prebuilt/BUILD.bazel @@ -0,0 +1,21 @@ +load("//:copy_file.bzl", "copy_file") + +copy_file( + name = "noblur32", + out = "i386/x_ignore_nofocus.so", + src = "i386/libnoblur.so", + visibility = [ + "//dotnet/src/webdriver:__pkg__", + "//java/client/src/org/openqa/selenium/firefox/xpi:__pkg__", + ], +) + +copy_file( + name = "noblur64", + out = "amd64/x_ignore_nofocus.so", + src = "amd64/libnoblur64.so", + visibility = [ + "//dotnet/src/webdriver:__pkg__", + "//java/client/src/org/openqa/selenium/firefox/xpi:__pkg__", + ], +) diff --git a/java/client/src/com/thoughtworks/selenium/BUILD.bazel b/java/client/src/com/thoughtworks/selenium/BUILD.bazel new file mode 100644 index 0000000000000..3541c6e0592df --- /dev/null +++ b/java/client/src/com/thoughtworks/selenium/BUILD.bazel @@ -0,0 +1,58 @@ +java_library( + name = "api", + srcs = [ + "CommandProcessor.java", + "Selenium.java", + "SeleniumException.java", + "Wait.java", + ], + visibility = [ + "//java/client/src/com/thoughtworks/selenium/condition:__pkg__", + ], +) + +java_library( + name = "selenium", + srcs = [ + "BrowserConfigurationOptions.java", + "DefaultRemoteCommand.java", + "DefaultSelenium.java", + "HttpCommandProcessor.java", + "RemoteCommand.java", + "ScreenshotListener.java", + "SeleneseTestBase.java", + "SeleneseTestCase.java", + "SeleneseTestNgHelper.java", + "SeleniumLogLevels.java", + ], + visibility = [ + "//java/client/src/com/thoughtworks/selenium:__subpackages__", + "//java/client/test/com/thoughtworks/selenium:__subpackages__", + "//java/server/src/com/thoughtworks/selenium:__pkg__", + ], + exports = [ + ":api", + ], + deps = [ + ":api", + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/edge", + "//java/client/src/org/openqa/selenium/net", + "//third_party/java/guava", + "//third_party/java/junit", + "//third_party/java/testng", + ], +) + +java_library( + name = "leg-rc", + visibility = [ + "//visibility:public", + ], + exports = [ + ":api", + ":selenium", + "//java/client/src/com/thoughtworks/selenium/condition", + "//java/client/src/com/thoughtworks/selenium/webdriven", + ], +) diff --git a/java/client/src/com/thoughtworks/selenium/condition/BUILD.bazel b/java/client/src/com/thoughtworks/selenium/condition/BUILD.bazel new file mode 100644 index 0000000000000..f1a9da927f457 --- /dev/null +++ b/java/client/src/com/thoughtworks/selenium/condition/BUILD.bazel @@ -0,0 +1,11 @@ +java_library( + name = "condition", + srcs = glob(["*.java"]), + visibility = [ + "//java/client/src/com/thoughtworks/selenium:__pkg__", + ], + deps = [ + "//java/client/src/com/thoughtworks/selenium:api", + "//third_party/java/junit", + ], +) diff --git a/java/client/src/com/thoughtworks/selenium/webdriven/BUILD.bazel b/java/client/src/com/thoughtworks/selenium/webdriven/BUILD.bazel index d7a470d1b44b4..5ec0fce352bea 100644 --- a/java/client/src/com/thoughtworks/selenium/webdriven/BUILD.bazel +++ b/java/client/src/com/thoughtworks/selenium/webdriven/BUILD.bazel @@ -1 +1,104 @@ -exports_files(["htmlutils.js", "injectableSelenium.js"]) +load("//:copy_file.bzl", "copy_file") + +exports_files([ + "htmlutils.js", + "injectableSelenium.js", +]) + +java_library( + name = "webdriven", + srcs = [ + "CompoundMutator.java", + "ExplodingSupplier.java", + "FunctionDeclaration.java", + "SeleniumMutator.java", + "VariableDeclaration.java", + "WebDriverBackedSelenium.java", + "WebDriverCommandProcessor.java", + ], + resources = [ + "htmlutils.js", + "injectableSelenium.js", + ":findElement", + ":findOption", + ":fireEvent", + ":fireEventAt", + ":getAttribute", + ":getText", + ":linkLocator", + ":isElementPresent", + ":isSomethingSelected", + ":isTextPresent", + ":isVisible", + ":setCursorPosition", + ":type", + # TODO(simons): remove sizzle. There are no longer any browsers that need it. + ":sizzle", + ], + visibility = [ + "//java/client/src/com/thoughtworks/selenium:__subpackages__", + "//java/client/test/com/thoughtworks/selenium:__subpackages__", + "//java/server/src/com/thoughtworks/selenium/webdriven:__pkg__", + "//java/server/src/org/openqa/grid/selenium:__pkg__", + "//java/server/src/org/openqa/selenium/server/htmlrunner:__pkg__", + ], + exports = [ + ":emulation-api", + "//java/client/src/com/thoughtworks/selenium/webdriven/commands", + ], + deps = [ + ":emulation-api", + "//java/client/src/com/thoughtworks/selenium", + "//java/client/src/com/thoughtworks/selenium/webdriven/commands", + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/remote", + "//third_party/java/guava", + ], +) + +java_library( + name = "emulation-api", + srcs = [ + "ElementFinder.java", + "JavascriptLibrary.java", + "ScriptMutator.java", + "SeleneseCommand.java", + "Timer.java", + "Windows.java", + ], + visibility = [ + "//java/client/src/com/thoughtworks/selenium:__subpackages__", + "//java/client/test/com/thoughtworks/selenium:__subpackages__", + ], + deps = [ + "//java/client/src/com/thoughtworks/selenium", + "//java/client/src/org/openqa/selenium:core", + "//third_party/java/guava", + ], +) + +[copy_file( + name = name, + src = "//javascript/selenium-atoms:%s.js" % name, + out = "%s.js" % name, +) for name in [ + "findElement", + "findOption", + "fireEvent", + "fireEventAt", + "getAttribute", + "getText", + "linkLocator", + "isElementPresent", + "isSomethingSelected", + "isTextPresent", + "isVisible", + "setCursorPosition", + "type", +]] + +copy_file( + name = "sizzle", + src = "//third_party/js/sizzle", + out = "sizzle.js", +) diff --git a/java/client/src/com/thoughtworks/selenium/webdriven/commands/BUILD.bazel b/java/client/src/com/thoughtworks/selenium/webdriven/commands/BUILD.bazel new file mode 100644 index 0000000000000..dad345a884b5e --- /dev/null +++ b/java/client/src/com/thoughtworks/selenium/webdriven/commands/BUILD.bazel @@ -0,0 +1,14 @@ +java_library( + name = "commands", + srcs = glob(["*.java"]), + visibility = [ + "//java/client/src/com/thoughtworks/selenium/webdriven:__pkg__", + ], + deps = [ + "//java/client/src/com/thoughtworks/selenium", + "//java/client/src/com/thoughtworks/selenium/webdriven:emulation-api", + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/io", + "//third_party/java/guava", + ], +) diff --git a/java/client/src/org/openqa/selenium/chrome/BUILD.bazel b/java/client/src/org/openqa/selenium/chrome/BUILD.bazel new file mode 100644 index 0000000000000..150ace460f5c7 --- /dev/null +++ b/java/client/src/org/openqa/selenium/chrome/BUILD.bazel @@ -0,0 +1,14 @@ +java_library( + name = "chrome", + srcs = glob(["*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/devtools", + "//java/client/src/org/openqa/selenium/json", + "//java/client/src/org/openqa/selenium/remote", + "//java/client/src/org/openqa/selenium/remote/http", + "//third_party/java/guava", + "//third_party/java/service", + ], +) diff --git a/java/client/src/org/openqa/selenium/devtools/BUILD.bazel b/java/client/src/org/openqa/selenium/devtools/BUILD.bazel index 6a4ac3cd49672..ecdf9f826c62e 100644 --- a/java/client/src/org/openqa/selenium/devtools/BUILD.bazel +++ b/java/client/src/org/openqa/selenium/devtools/BUILD.bazel @@ -2,6 +2,7 @@ java_library( name = "devtools", srcs = glob(["*.java"]), visibility = [ + "//java/client/src/org/openqa/selenium/chrome:__pkg__", "//java/client/src/org/openqa/selenium/remote:__pkg__", ], deps = [ diff --git a/java/client/src/org/openqa/selenium/edge/BUILD.bazel b/java/client/src/org/openqa/selenium/edge/BUILD.bazel new file mode 100644 index 0000000000000..5108360328765 --- /dev/null +++ b/java/client/src/org/openqa/selenium/edge/BUILD.bazel @@ -0,0 +1,11 @@ +java_library( + name = "edge", + srcs = glob(["*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/remote", + "//third_party/java/guava", + "//third_party/java/service", + ], +) diff --git a/java/client/src/org/openqa/selenium/firefox/BUILD.bazel b/java/client/src/org/openqa/selenium/firefox/BUILD.bazel new file mode 100644 index 0000000000000..f1880af08e8ba --- /dev/null +++ b/java/client/src/org/openqa/selenium/firefox/BUILD.bazel @@ -0,0 +1,25 @@ +load("//:copy_file.bzl", "copy_file") + +java_library( + name = "firefox", + srcs = glob(["*.java"]), + resources = [":prefs"], + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/io", + "//java/client/src/org/openqa/selenium/json", + "//java/client/src/org/openqa/selenium/net", + "//java/client/src/org/openqa/selenium/os", + "//java/client/src/org/openqa/selenium/remote", + "//java/client/src/org/openqa/selenium/remote/http", + "//third_party/java/guava", + "//third_party/java/service", + ], +) + +copy_file( + name = "prefs", + src = "//third_party/js/selenium:webdriver.json", + out = "webdriver_prefs.json", +) diff --git a/java/client/src/org/openqa/selenium/firefox/xpi/BUILD.bazel b/java/client/src/org/openqa/selenium/firefox/xpi/BUILD.bazel new file mode 100644 index 0000000000000..01185f3534cc6 --- /dev/null +++ b/java/client/src/org/openqa/selenium/firefox/xpi/BUILD.bazel @@ -0,0 +1,40 @@ +load("//:copy_file.bzl", "copy_file") + +java_library( + name = "xpi", + srcs = glob(["*.java"]), + resources = [ + ":amd64", + ":i386", + ":webdriver_xpi", + ], + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/firefox", + "//java/client/src/org/openqa/selenium/io", + "//java/client/src/org/openqa/selenium/net", + "//java/client/src/org/openqa/selenium/os", + "//java/client/src/org/openqa/selenium/remote", + "//third_party/java/guava", + "//third_party/java/service", + ], +) + +copy_file( + name = "webdriver_xpi", + src = "//third_party/js/selenium:webdriver_xpi", + out = "webdriver.xpi", +) + +copy_file( + name = "i386", + src = "//cpp/prebuilt:noblur32", + out = "x86/x_ignore_nofocus.so", +) + +copy_file( + name = "amd64", + src = "//cpp/prebuilt:noblur64", + out = "amd64/x_ignore_nofocus.so", +) diff --git a/java/client/src/org/openqa/selenium/ie/BUILD.bazel b/java/client/src/org/openqa/selenium/ie/BUILD.bazel new file mode 100644 index 0000000000000..ef3c7e5b4877a --- /dev/null +++ b/java/client/src/org/openqa/selenium/ie/BUILD.bazel @@ -0,0 +1,11 @@ +java_library( + name = "ie", + srcs = glob(["*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/remote", + "//third_party/java/guava", + "//third_party/java/service", + ], +) diff --git a/java/client/src/org/openqa/selenium/io/BUILD.bazel b/java/client/src/org/openqa/selenium/io/BUILD.bazel index 55e6cccdc84ab..2c894cfde2f1d 100644 --- a/java/client/src/org/openqa/selenium/io/BUILD.bazel +++ b/java/client/src/org/openqa/selenium/io/BUILD.bazel @@ -2,9 +2,13 @@ java_library( name = "io", srcs = glob(["*.java"]), visibility = [ + "//java/client/src/com/thoughtworks/selenium/webdriven/commands:__pkg__", + "//java/client/src/org/openqa/selenium/firefox:__pkg__", + "//java/client/src/org/openqa/selenium/firefox/xpi:__pkg__", "//java/client/src/org/openqa/selenium/os:__pkg__", "//java/client/src/org/openqa/selenium/remote:__pkg__", "//java/client/test/org/openqa/selenium/environment:__pkg__", + "//java/client/test/org/openqa/selenium/firefox:__pkg__", "//java/client/test/org/openqa/selenium/io:__pkg__", ], deps = [ diff --git a/java/client/src/org/openqa/selenium/net/BUILD.bazel b/java/client/src/org/openqa/selenium/net/BUILD.bazel index bf22fe440139f..f1f30f657866c 100644 --- a/java/client/src/org/openqa/selenium/net/BUILD.bazel +++ b/java/client/src/org/openqa/selenium/net/BUILD.bazel @@ -2,9 +2,15 @@ java_library( name = "net", srcs = glob(["*.java"]), visibility = [ + "//java/client/src/com/thoughtworks/selenium:__pkg__", + "//java/client/src/org/openqa/selenium/firefox:__pkg__", + "//java/client/src/org/openqa/selenium/firefox/xpi:__pkg__", "//java/client/src/org/openqa/selenium/remote:__pkg__", + "//java/client/src/org/openqa/selenium/safari:__pkg__", + "//java/client/test/org/openqa/selenium:__pkg__", "//java/client/test/org/openqa/selenium/environment:__pkg__", "//java/client/test/org/openqa/selenium/net:__pkg__", + "//java/client/test/org/openqa/selenium/testing/drivers:__pkg__", ], deps = [ "//java/client/src/org/openqa/selenium:core", diff --git a/java/client/src/org/openqa/selenium/opera/BUILD.bazel b/java/client/src/org/openqa/selenium/opera/BUILD.bazel new file mode 100644 index 0000000000000..5eb75d38ab53d --- /dev/null +++ b/java/client/src/org/openqa/selenium/opera/BUILD.bazel @@ -0,0 +1,11 @@ +java_library( + name = "opera", + srcs = glob(["*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/remote", + "//third_party/java/guava", + "//third_party/java/service", + ], +) diff --git a/java/client/src/org/openqa/selenium/os/BUILD.bazel b/java/client/src/org/openqa/selenium/os/BUILD.bazel index 9e1e776f3dac6..a1ea51da5f989 100644 --- a/java/client/src/org/openqa/selenium/os/BUILD.bazel +++ b/java/client/src/org/openqa/selenium/os/BUILD.bazel @@ -3,6 +3,8 @@ java_library( srcs = glob(["*.java"]), visibility = [ "//java/client/src/org/openqa/selenium:__pkg__", + "//java/client/src/org/openqa/selenium/firefox:__pkg__", + "//java/client/src/org/openqa/selenium/firefox/xpi:__pkg__", "//java/client/src/org/openqa/selenium/remote:__pkg__", "//java/client/test/org/openqa/selenium:__subpackages__", "//java/client/test/org/openqa/selenium/build:__pkg__", diff --git a/java/client/src/org/openqa/selenium/remote/BUILD.bazel b/java/client/src/org/openqa/selenium/remote/BUILD.bazel index 77b39667ce9bb..31455535ab030 100644 --- a/java/client/src/org/openqa/selenium/remote/BUILD.bazel +++ b/java/client/src/org/openqa/selenium/remote/BUILD.bazel @@ -60,6 +60,7 @@ java_library( exports = [ ":api", ":capabilities", + ":remote-lib", ], deps = [ ":api", diff --git a/java/client/src/org/openqa/selenium/remote/http/BUILD.bazel b/java/client/src/org/openqa/selenium/remote/http/BUILD.bazel index 3f8409ef0df27..d82ed6e8a0907 100644 --- a/java/client/src/org/openqa/selenium/remote/http/BUILD.bazel +++ b/java/client/src/org/openqa/selenium/remote/http/BUILD.bazel @@ -2,10 +2,14 @@ java_library( name = "http", srcs = glob(["*.java"]), visibility = [ + "//java/client/src/org/openqa/selenium/chrome:__pkg__", "//java/client/src/org/openqa/selenium/devtools:__pkg__", + "//java/client/src/org/openqa/selenium/firefox:__pkg__", "//java/client/src/org/openqa/selenium/remote:__subpackages__", + "//java/client/src/org/openqa/selenium/safari:__pkg__", "//java/client/test/org/openqa/selenium/environment:__pkg__", "//java/client/test/org/openqa/selenium/net:__pkg__", + "//java/client/test/org/openqa/selenium/testing/drivers:__pkg__", ], deps = [ "//java/client/src/org/openqa/selenium:core", diff --git a/java/client/src/org/openqa/selenium/safari/BUILD.bazel b/java/client/src/org/openqa/selenium/safari/BUILD.bazel new file mode 100644 index 0000000000000..b43cca7518f25 --- /dev/null +++ b/java/client/src/org/openqa/selenium/safari/BUILD.bazel @@ -0,0 +1,13 @@ +java_library( + name = "safari", + srcs = glob(["*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/net", + "//java/client/src/org/openqa/selenium/remote", + "//java/client/src/org/openqa/selenium/remote/http", + "//third_party/java/guava", + "//third_party/java/service", + ], +) diff --git a/java/client/src/org/openqa/selenium/support/BUILD.bazel b/java/client/src/org/openqa/selenium/support/BUILD.bazel index a39a748e17dca..93eaf4a2d14b8 100644 --- a/java/client/src/org/openqa/selenium/support/BUILD.bazel +++ b/java/client/src/org/openqa/selenium/support/BUILD.bazel @@ -1,5 +1,51 @@ -# Empty library so third_party/java/selenium:htmlunit-driver will build. java_library( name = "support", - visibility = ["//third_party/java/selenium:__pkg__"], + srcs = [ + "Color.java", + "Colors.java", + "ThreadGuard.java", + ], + visibility = ["//visibility:public"], + exports = [ + ":page-factory", + "//java/client/src/org/openqa/selenium/support/events", + "//java/client/src/org/openqa/selenium/support/ui:clock", + "//java/client/src/org/openqa/selenium/support/ui:components", + "//java/client/src/org/openqa/selenium/support/ui:elements", + "//java/client/src/org/openqa/selenium/support/ui:wait", + ], + deps = [ + ":page-factory", + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/support/events", + "//java/client/src/org/openqa/selenium/support/ui:clock", + "//java/client/src/org/openqa/selenium/support/ui:components", + "//java/client/src/org/openqa/selenium/support/ui:elements", + "//java/client/src/org/openqa/selenium/support/ui:wait", + ], +) + +java_library( + name = "page-factory", + srcs = [ + "AbstractFindByBuilder.java", + "ByIdOrName.java", + "CacheLookup.java", + "FindAll.java", + "FindBy.java", + "FindBys.java", + "How.java", + "PageFactory.java", + "PageFactoryFinder.java", + ] + glob([ + "pagefactory/*.java", + "pagefactory/internal/*.java", + ]), + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/support/ui:clock", + "//java/client/src/org/openqa/selenium/support/ui:components", + "//third_party/java/guava", + ], ) diff --git a/java/client/src/org/openqa/selenium/support/events/BUILD.bazel b/java/client/src/org/openqa/selenium/support/events/BUILD.bazel new file mode 100644 index 0000000000000..1b78c000ecab9 --- /dev/null +++ b/java/client/src/org/openqa/selenium/support/events/BUILD.bazel @@ -0,0 +1,8 @@ +java_library( + name = "events", + srcs = glob(["**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + ], +) diff --git a/java/client/src/org/openqa/selenium/support/ui/BUILD.bazel b/java/client/src/org/openqa/selenium/support/ui/BUILD.bazel new file mode 100644 index 0000000000000..20ba56b411e91 --- /dev/null +++ b/java/client/src/org/openqa/selenium/support/ui/BUILD.bazel @@ -0,0 +1,55 @@ +java_library( + name = "clock", + srcs = [ + "Sleeper.java", + ], + visibility = ["//visibility:public"], + deps = [ + "//third_party/java/guava", + ], +) + +java_library( + name = "components", + srcs = [ + "LoadableComponent.java", + "SlowLoadableComponent.java", + ], + visibility = ["//visibility:public"], + deps = [ + ":clock", + "//java/client/src/org/openqa/selenium:core", + ], +) + +java_library( + name = "elements", + srcs = [ + "ISelect.java", + "Quotes.java", + "Select.java", + "UnexpectedTagNameException.java", + ], + visibility = ["//visibility:public"], + deps = [ + "//java/client/src/org/openqa/selenium:core", + ], +) + +java_library( + name = "wait", + srcs = [ + "ExpectedCondition.java", + "ExpectedConditions.java", + "FluentWait.java", + "Wait.java", + "WebDriverWait.java", + ], + visibility = ["//visibility:public"], + deps = [ + ":clock", + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/remote", + "//third_party/java/guava", + ], +) diff --git a/java/client/test/org/openqa/selenium/BUILD.bazel b/java/client/test/org/openqa/selenium/BUILD.bazel index 05c8266334ad0..dae5a337ac7da 100644 --- a/java/client/test/org/openqa/selenium/BUILD.bazel +++ b/java/client/test/org/openqa/selenium/BUILD.bazel @@ -2,8 +2,93 @@ test_suite( name = "small-tests", tags = ["manual"], tests = [ + "//java/client/test/org/openqa/selenium/atoms:SmallTests", "//java/client/test/org/openqa/selenium/io:SmallTests", "//java/client/test/org/openqa/selenium/net:SmallTests", "//java/client/test/org/openqa/selenium/os:AllTests", + "//java/client/test/org/openqa/selenium/support:small-tests", + "//java/client/test/org/openqa/selenium/testing:SmallTests", + ], +) + +java_library( + name = "large-tests", + srcs = ["StandardSeleniumTests.java"], + visibility = [ + "//java/client/test:__subpackages__", + ], + deps = [ + ":tests", + "//java/client/src/org/openqa/selenium:core", + "//java/client/test/org/openqa/selenium/environment", + "//java/client/test/org/openqa/selenium/support:tests", + "//java/client/test/org/openqa/selenium/testing:test-base", + "//third_party/java/junit", + ], +) + +java_library( + name = "helpers", + srcs = [ + "ParallelTestRunner.java", + "StubDriver.java", + "WaitingConditions.java", + "WrappedWebElement.java", + ], + visibility = [ + "//java/client/test:__subpackages__", + "//java/server/test:__subpackages__", + ], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/support/ui:wait", + "//java/client/test/org/openqa/selenium/environment", + "//third_party/java/guava", + "//third_party/java/junit", + ], +) + +java_library( + name = "tests", + srcs = glob([ + "*Test.java", + "html5/*.java", + "internal/*Test.java", + "interactions/*.java", + "interactions/touch/*Test.java", + "io/*Test.java", + "logging/*.java", + "net/*Test.java", + "os/*Test.java", + ]) + [ + "interactions/touch/TouchTestBase.java", + ], + visibility = [ + "//java/client/test:__subpackages__", + ], + deps = [ + ":helpers", + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/ie", + "//java/client/src/org/openqa/selenium/json", + "//java/client/src/org/openqa/selenium/net", + "//java/client/src/org/openqa/selenium/remote", + "//java/client/src/org/openqa/selenium/support", + "//java/client/src/org/openqa/selenium/support/ui:wait", + "//java/client/test/org/openqa/selenium/build", + "//java/client/test/org/openqa/selenium/environment", + "//java/client/test/org/openqa/selenium/net", + "//java/client/test/org/openqa/selenium/support:tests", + "//java/client/test/org/openqa/selenium/testing:annotations", + "//java/client/test/org/openqa/selenium/testing:test-base", + "//java/client/test/org/openqa/selenium/testing/drivers", + "//third_party/java/assertj", + "//third_party/java/guava", + "//third_party/java/jetty", + "//third_party/java/junit", + "//third_party/java/littleshoot:littleproxy", + "//third_party/java/mockito:mockito-core", + "//third_party/java/netty:netty-all", + "//third_party/java/servlet:javax.servlet-api", ], ) diff --git a/java/client/test/org/openqa/selenium/atoms/BUILD.bazel b/java/client/test/org/openqa/selenium/atoms/BUILD.bazel new file mode 100644 index 0000000000000..451ddec8f43fa --- /dev/null +++ b/java/client/test/org/openqa/selenium/atoms/BUILD.bazel @@ -0,0 +1,46 @@ +load("//:copy_file.bzl", "copy_file") +load("//java:rules.bzl", "java_test_suite") + +copy_file( + name = "execute_script", + src = "//javascript/atoms/fragments:execute_script.js", + out = "execute_script.js", +) + +copy_file( + name = "atoms_inputs", + src = "//javascript/webdriver/atoms:inputs_bin.js", + out = "atoms_inputs.js", +) + +java_library( + name = "lib", + srcs = ["JavaScriptLoader.java"], + deps = [ + "//java/client/test/org/openqa/selenium/build", + "//third_party/java/guava", + "//third_party/java/hamcrest:hamcrest-core", + "//third_party/java/junit", + ], +) + +java_test_suite( + name = "SmallTests", + size = "small", + srcs = glob(["*Test.java"]), + resources = [ + ":atoms_inputs", + ":execute_script", + ], + deps = [ + ":lib", + "//java/client/src/org/openqa/selenium/json", + "//java/client/test/org/openqa/selenium:helpers", + "//java/client/test/org/openqa/selenium/build", + "//third_party/java/assertj", + "//third_party/java/guava", + "//third_party/java/htmlunit", + "//third_party/java/htmlunit:htmlunit-core-js", + "//third_party/java/junit", + ], +) diff --git a/java/client/test/org/openqa/selenium/atoms/CompiledAtomsNotLeakingTest.java b/java/client/test/org/openqa/selenium/atoms/CompiledAtomsNotLeakingTest.java index 567128f89dc65..4622bf4780d02 100644 --- a/java/client/test/org/openqa/selenium/atoms/CompiledAtomsNotLeakingTest.java +++ b/java/client/test/org/openqa/selenium/atoms/CompiledAtomsNotLeakingTest.java @@ -33,10 +33,6 @@ public class CompiledAtomsNotLeakingTest { - private static final String FRAGMENT_TASK = - "//javascript/atoms/fragments:execute_script"; - private static final String FRAGMENT_PATH = - JavaScriptLoader.taskToBuildOutput(FRAGMENT_TASK); private static final String RESOURCE_PATH = "/org/openqa/selenium/atoms/execute_script.js"; private static String fragment; @@ -45,7 +41,7 @@ public class CompiledAtomsNotLeakingTest { @BeforeClass public static void loadFragment() throws IOException { - fragment = JavaScriptLoader.loadResource(RESOURCE_PATH, FRAGMENT_TASK); + fragment = JavaScriptLoader.loadResource(RESOURCE_PATH); } @Before @@ -72,22 +68,22 @@ public void prepareGlobalObject() { @Test public void fragmentWillNotLeakVariablesToEnclosingScopes() { ContextFactory.getGlobal().call(context -> { - eval(context, "(" + fragment + ")()", FRAGMENT_PATH); + eval(context, "(" + fragment + ")()", RESOURCE_PATH); assertThat(eval(context, "_")).isEqualTo(1234); - eval(context, "(" + fragment + ").call(this)", FRAGMENT_PATH); + eval(context, "(" + fragment + ").call(this)", RESOURCE_PATH); assertThat(eval(context, "_")).isEqualTo(1234); - eval(context, "(" + fragment + ").apply(this,[])", FRAGMENT_PATH); + eval(context, "(" + fragment + ").apply(this,[])", RESOURCE_PATH); assertThat(eval(context, "_")).isEqualTo(1234); - eval(context, "(" + fragment + ").call(null)", FRAGMENT_PATH); + eval(context, "(" + fragment + ").call(null)", RESOURCE_PATH); assertThat(eval(context, "_")).isEqualTo(1234); - eval(context, "(" + fragment + ").apply(null,[])", FRAGMENT_PATH); + eval(context, "(" + fragment + ").apply(null,[])", RESOURCE_PATH); assertThat(eval(context, "_")).isEqualTo(1234); - eval(context, "(" + fragment + ").call({})", FRAGMENT_PATH); + eval(context, "(" + fragment + ").call({})", RESOURCE_PATH); assertThat(eval(context, "_")).isEqualTo(1234); return null; }); @@ -102,7 +98,7 @@ public void nestedFragmentsShouldNotLeakVariables() { String nestedScript = String.format("(%s).call(null, %s, ['return 1+2;'], true)", fragment, fragment); - String jsonResult = (String) eval(context, nestedScript, FRAGMENT_PATH); + String jsonResult = (String) eval(context, nestedScript, RESOURCE_PATH); Map result = new Json().toType(jsonResult, Json.MAP_TYPE); diff --git a/java/client/test/org/openqa/selenium/atoms/InputAtomsTest.java b/java/client/test/org/openqa/selenium/atoms/InputAtomsTest.java index 4192c709f7b86..cd92c8edbe7c3 100644 --- a/java/client/test/org/openqa/selenium/atoms/InputAtomsTest.java +++ b/java/client/test/org/openqa/selenium/atoms/InputAtomsTest.java @@ -37,11 +37,10 @@ public class InputAtomsTest { private static final String RESOURCE_PATH = "/org/openqa/selenium/atoms/atoms_inputs.js"; - private static final String RESOURCE_TASK = "//javascript/webdriver/atoms:inputs"; @Test public void exportsTheExpectedNames() throws IOException { - final String source = JavaScriptLoader.loadResource(RESOURCE_PATH, RESOURCE_TASK); + final String source = JavaScriptLoader.loadResource(RESOURCE_PATH); ContextFactory.getGlobal().call(new ContextAction() { private ScriptableObject global; @@ -55,7 +54,7 @@ public Object run(Context context) { assertThat((Object) eval(context, "window")).isEqualTo(global); assertThat((Object) eval(context, "this === window")).isEqualTo(true); - eval(context, source, JavaScriptLoader.taskToBuildOutput(RESOURCE_TASK)); + eval(context, source, RESOURCE_PATH); assertFunction(context, "webdriver.atoms.inputs.sendKeys"); assertFunction(context, "webdriver.atoms.inputs.click"); diff --git a/java/client/test/org/openqa/selenium/atoms/JavaScriptLoader.java b/java/client/test/org/openqa/selenium/atoms/JavaScriptLoader.java index c5404132a54c5..478731976e6ad 100644 --- a/java/client/test/org/openqa/selenium/atoms/JavaScriptLoader.java +++ b/java/client/test/org/openqa/selenium/atoms/JavaScriptLoader.java @@ -18,16 +18,13 @@ package org.openqa.selenium.atoms; import static java.nio.charset.StandardCharsets.UTF_8; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assume.assumeThat; import com.google.common.io.Resources; -import org.openqa.selenium.build.Build; -import org.openqa.selenium.build.InProject; - import java.io.IOException; import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; /** * Utility class for loading JavaScript resources. @@ -35,19 +32,11 @@ class JavaScriptLoader { private JavaScriptLoader() {} // Utility class. - static String loadResource(String resourcePath, String resourceTask) throws IOException { + static String loadResource(String resourcePath) throws IOException { URL resourceUrl = JavaScriptLoader.class.getResource(resourcePath); - if (resourceUrl != null) { - return Resources.toString(resourceUrl, UTF_8); - } - new Build().of(resourceTask).go(); - - Path topDir = InProject.locate("Rakefile").getParent(); - Path builtFile = topDir.resolve(taskToBuildOutput(resourceTask)); - return new String(Files.readAllBytes(builtFile), UTF_8); - } - - static String taskToBuildOutput(String taskName) { - return taskName.replace("//", "build/") .replace(":", "/") + ".js"; + assumeThat( + "Resource not found; are you running with `bazel test`? " + resourcePath, + resourceUrl, notNullValue()); + return Resources.toString(resourceUrl, UTF_8); } } diff --git a/java/client/test/org/openqa/selenium/net/BUILD.bazel b/java/client/test/org/openqa/selenium/net/BUILD.bazel index d4fb8dbf33f69..98c48258bddfb 100644 --- a/java/client/test/org/openqa/selenium/net/BUILD.bazel +++ b/java/client/test/org/openqa/selenium/net/BUILD.bazel @@ -1,8 +1,9 @@ load("//java:rules.bzl", "java_test_suite") java_library( - name = "lib", + name = "net", srcs = ["StubNetworkInterfaceProvider.java"], + visibility = ["//java/client/test/org/openqa/selenium:__pkg__"], deps = [ "//java/client/src/org/openqa/selenium/net", ], @@ -13,7 +14,7 @@ java_test_suite( size = "small", srcs = glob(["*Test.java"]), deps = [ - ":lib", + ":net", "//java/client/src/org/openqa/selenium:core", "//java/client/src/org/openqa/selenium/net", "//java/client/src/org/openqa/selenium/remote/http", diff --git a/java/client/test/org/openqa/selenium/support/BUILD.bazel b/java/client/test/org/openqa/selenium/support/BUILD.bazel new file mode 100644 index 0000000000000..d8711f1519d46 --- /dev/null +++ b/java/client/test/org/openqa/selenium/support/BUILD.bazel @@ -0,0 +1,74 @@ +java_test( + name = "small-tests", + size = "small", + srcs = [ + "SmallTests.java", + ], + test_class = "org.openqa.selenium.support.SmallTests", + visibility = [ + "//java/client/test/org/openqa/selenium:__pkg__", + ], + deps = [ + ":tests", + "//third_party/java/junit", + ], +) + +java_test( + name = "large-tests", + srcs = [ + "LargeTests.java", + ], + jvm_flags = [ + "-Dselenium.browser=ff", + "-Dorg.openqa.selenium.environment.webserver.ignoreMissingJsRoots=true", + ], + local = True, + test_class = "org.openqa.selenium.support.LargeTests", + deps = [ + ":tests", + "//java/client/src/org/openqa/selenium/firefox", + "//java/client/src/org/openqa/selenium/remote", + "//java/client/test/org/openqa/selenium/testing:test-base", + "//third_party/java/guava", + "//third_party/java/junit", + ], +) + +java_library( + name = "tests", + srcs = glob(["**/*Test.java"]), + visibility = ["//java/client/test/org/openqa/selenium:__pkg__"], + deps = [ + ":clock", + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/remote", + "//java/client/src/org/openqa/selenium/support", + "//java/client/src/org/openqa/selenium/support:page-factory", + "//java/client/src/org/openqa/selenium/support/events", + "//java/client/src/org/openqa/selenium/support/ui:clock", + "//java/client/src/org/openqa/selenium/support/ui:components", + "//java/client/src/org/openqa/selenium/support/ui:elements", + "//java/client/src/org/openqa/selenium/support/ui:wait", + "//java/client/test/org/openqa/selenium:helpers", + "//java/client/test/org/openqa/selenium/testing:annotations", + "//java/client/test/org/openqa/selenium/testing:test-base", + "//java/client/test/org/openqa/selenium/testing/drivers:browser", + "//third_party/java/assertj", + "//third_party/java/guava", + "//third_party/java/junit", + "//third_party/java/mockito:mockito-core", + ], +) + +java_library( + name = "clock", + srcs = [ + "ui/TickingClock.java", + ], + visibility = [ + "//java/client/test:__subpackages__", + "//java/server/test:__subpackages__", + ], + deps = ["//java/client/src/org/openqa/selenium/support/ui:clock"], +) diff --git a/java/client/test/org/openqa/selenium/testing/BUILD.bazel b/java/client/test/org/openqa/selenium/testing/BUILD.bazel new file mode 100644 index 0000000000000..e9f5f1a90f41d --- /dev/null +++ b/java/client/test/org/openqa/selenium/testing/BUILD.bazel @@ -0,0 +1,76 @@ +load("//java:rules.bzl", "java_test_suite") + +java_library( + name = "annotations", + srcs = [ + "Ignore.java", + "IgnoreList.java", + "NeedsFreshDriver.java", + "NeedsLocalEnvironment.java", + "NoDriverAfterTest.java", + "NoDriverBeforeTest.java", + "NotYetImplemented.java", + "NotYetImplementedList.java", + "SwitchToTopAfterTest.java", + ], + visibility = [ + "//java/client/test:__subpackages__", + ], + deps = [ + "//java/client/src/org/openqa/selenium:core", + "//java/client/test/org/openqa/selenium/testing/drivers:browser", + ], +) + +java_library( + name = "test-base", + srcs = [ + "IgnoreComparator.java", + "JUnit4TestBase.java", + "NotificationRule.java", + "Pages.java", + "SeleniumTestRunner.java", + "StaticResources.java", + "TestIgnorance.java", + "TestUtilities.java", + ], + visibility = [ + "//java/client/test:__subpackages__", + "//java/server/test:__subpackages__", + ], + deps = [ + ":annotations", + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/json", + "//java/client/src/org/openqa/selenium/remote", + "//java/client/src/org/openqa/selenium/support/ui:wait", + "//java/client/test/org/openqa/selenium/build", + "//java/client/test/org/openqa/selenium/environment", + "//java/client/test/org/openqa/selenium/testing/drivers", + "//java/client/test/org/openqa/selenium/testing/drivers:browser", + "//third_party/java/assertj", + "//third_party/java/github:org.eclipse.egit.github.core", + "//third_party/java/guava", + "//third_party/java/junit", + "//third_party/java/okhttp3:okhttp", + "//third_party/java/selenium:htmlunit-driver", + ], +) + +java_test_suite( + name = "SmallTests", + srcs = ["IgnoreComparatorUnitTest.java"], + visibility = [ + "//java/client/test/org/openqa/selenium:__pkg__", + ], + deps = [ + ":test-base", + "//java/client/src/org/openqa/selenium:core", + "//java/client/test/org/openqa/selenium/testing:annotations", + "//java/client/test/org/openqa/selenium/testing/drivers", + "//java/client/test/org/openqa/selenium/testing/drivers:browser", + "//third_party/java/guava", + "//third_party/java/junit", + "//third_party/java/mockito:mockito-core", + ], +) diff --git a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java b/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java index 1cd5ef93abf5f..4399da0d42447 100644 --- a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java +++ b/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java @@ -193,7 +193,9 @@ public void evaluate() throws Throwable { } private void createDriver() { + System.out.println("CREATING DRIVER"); driver = actuallyCreateDriver(); + System.out.println("CREATED " + driver); wait = new WebDriverWait(driver, 10); shortWait = new WebDriverWait(driver, 5); } diff --git a/java/client/test/org/openqa/selenium/testing/drivers/BUILD.bazel b/java/client/test/org/openqa/selenium/testing/drivers/BUILD.bazel index 957dae8463958..1317b622491da 100644 --- a/java/client/test/org/openqa/selenium/testing/drivers/BUILD.bazel +++ b/java/client/test/org/openqa/selenium/testing/drivers/BUILD.bazel @@ -8,3 +8,43 @@ java_library( "//java/server/test:__subpackages__", ], ) + +java_library( + name = "drivers", + srcs = glob([ + "*Driver.java", + "*Supplier.java", + ]) + [ + "Browser.java", + "OutOfProcessSeleniumServer.java", + "WebDriverBuilder.java", + ], + visibility = [ + "//java/client/test:__subpackages__", + "//java/server/test:__subpackages__", + ], + deps = [ + ":browser", + "//java/client/src/org/openqa/selenium:core", + "//java/client/src/org/openqa/selenium/chrome", + "//java/client/src/org/openqa/selenium/edge", + "//java/client/src/org/openqa/selenium/firefox", + "//java/client/src/org/openqa/selenium/ie", + "//java/client/src/org/openqa/selenium/os", + "//java/client/src/org/openqa/selenium/json", + "//java/client/src/org/openqa/selenium/net", + "//java/client/src/org/openqa/selenium/remote/http", + "//java/client/src/org/openqa/selenium/opera", + "//java/client/src/org/openqa/selenium/remote", + "//java/client/src/org/openqa/selenium/safari", + "//java/client/src/org/openqa/selenium/support", + "//java/client/test/org/openqa/selenium:helpers", + "//java/client/test/org/openqa/selenium/build", + "//java/client/test/org/openqa/selenium/testing:annotations", + # "//java/server/src/org/openqa/grid/selenium", + "//third_party/java/guava", + "//third_party/java/junit", + "//third_party/java/selenium:htmlunit-driver", + "//third_party/java/okhttp3:okhttp", + ], +) diff --git a/javascript/atoms/fragments/BUILD.bazel b/javascript/atoms/fragments/BUILD.bazel index 2e04a7f80669a..7b91c95ea258d 100644 --- a/javascript/atoms/fragments/BUILD.bazel +++ b/javascript/atoms/fragments/BUILD.bazel @@ -13,6 +13,7 @@ closure_fragment( name = "execute_script", function = "bot.inject.executeScript", module = "bot.inject", + visibility = ["//java/client/test/org/openqa/selenium/atoms:__pkg__"], deps = [ "//javascript/atoms:inject", ], @@ -22,13 +23,13 @@ closure_fragment( name = "is-displayed", function = "bot.dom.isShown", module = "bot.dom", - deps = [ - "//javascript/atoms:dom", - ], visibility = [ + "//dotnet/src/webdriver:__pkg__", "//java/client/src/org/openqa/selenium/remote:__pkg__", "//py:__pkg__", - "//dotnet/src/webdriver:__pkg__", + ], + deps = [ + "//javascript/atoms:dom", ], ) diff --git a/javascript/selenium-atoms/BUILD.bazel b/javascript/selenium-atoms/BUILD.bazel index 47eae24c17a53..38d41ef93938a 100644 --- a/javascript/selenium-atoms/BUILD.bazel +++ b/javascript/selenium-atoms/BUILD.bazel @@ -1,6 +1,14 @@ load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary", "closure_js_library") load("//javascript:fragment.bzl", "closure_fragment") +package_group( + name = "webdriver_backed_selenium_implementations", + packages = [ + "//dotnet/src/webdriverbackedselenium", + "//java/client/src/com/thoughtworks/selenium/webdriven", + ], +) + closure_js_library( name = "deps", srcs = glob(["*.js"]), @@ -43,46 +51,39 @@ closure_fragment( name = "findElement", function = "core.locators.findElement", module = "core.locators", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "findOption", function = "core.select.option.findOption", module = "core.select.option", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "fireEvent", function = "core.events.fire", module = "core.events", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "fireEventAt", function = "core.events.fireAt", module = "core.events", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "getAttribute", function = "core.element.getAttribute", module = "core.element", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], ) @@ -90,66 +91,55 @@ closure_fragment( name = "getText", function = "core.text.getText", module = "core.text.getText", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "linkLocator", function = "core.text.linkLocator", module = "core.text", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "isSomethingSelected", function = "core.select.isSomethingSelected", module = "core.select", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "isElementPresent", function = "core.locators.isElementPresent", module = "core.locators", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "isTextPresent", function = "core.text.isTextPresent", module = "core.text", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "isVisible", function = "core.browserbot.isVisible", module = "core.browserbot", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) closure_fragment( name = "setCursorPosition", function = "core.text.setCursorPosition", module = "core.text", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], ) @@ -157,8 +147,6 @@ closure_fragment( name = "type", function = "core.events.setValue", module = "core.events", + visibility = [":webdriver_backed_selenium_implementations"], deps = [":deps"], - visibility = [ - "//dotnet/src/webdriverbackedselenium:__pkg__", - ], ) diff --git a/javascript/webdriver/atoms/BUILD.bazel b/javascript/webdriver/atoms/BUILD.bazel index 49cf35b24b987..21b02fb01e8ec 100644 --- a/javascript/webdriver/atoms/BUILD.bazel +++ b/javascript/webdriver/atoms/BUILD.bazel @@ -1,6 +1,22 @@ -load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary", "closure_js_library") load("//javascript:fragment.bzl", "closure_fragment") +closure_js_binary( + name = "inputs_bin", + visibility = [ + "//java/client/test/org/openqa/selenium/atoms:__pkg__", + ], + deps = [ + ":inputs_exports", + ], +) + +closure_js_library( + name = "inputs_exports", + srcs = ["exports/inputs.js"], + deps = [":atoms-lib"], +) + closure_js_library( name = "atoms-lib", srcs = glob([ @@ -23,12 +39,12 @@ closure_fragment( name = "get-attribute", function = "webdriver.atoms.element.attribute.get", module = "webdriver.atoms.element", - deps = [ - ":atoms-lib", - ], visibility = [ + "//dotnet/src/webdriver:__pkg__", "//java/client/src/org/openqa/selenium/remote:__pkg__", "//py:__pkg__", - "//dotnet/src/webdriver:__pkg__", + ], + deps = [ + ":atoms-lib", ], ) diff --git a/third_party/firebug/BUILD.bazel b/third_party/firebug/BUILD.bazel new file mode 100644 index 0000000000000..a7343702ba5bc --- /dev/null +++ b/third_party/firebug/BUILD.bazel @@ -0,0 +1,6 @@ +licenses(["notice"]) + +exports_files( + ["firebug-1.5.0-fx.xpi"], + visibility = ["//java/client/test/org/openqa/selenium/firefox:__pkg__"], +) diff --git a/third_party/java/service/BUILD.bazel b/third_party/java/service/BUILD.bazel index 33c96812bc067..fcb71476e1442 100644 --- a/third_party/java/service/BUILD.bazel +++ b/third_party/java/service/BUILD.bazel @@ -5,12 +5,30 @@ licenses(["notice"]) package(default_visibility = ["//visibility:public"]) maven_java_import( - name = "auto-service", + name = "auto_service", coords = "com.google.auto.service:auto-service:jar:1.0-rc4", jar = "auto-service-1.0-rc4.jar", srcjar = "auto-service-1.0-rc4-sources.jar", + visibility = ["//visibility:private"], deps = [ "//third_party/java/auto:auto-common", "//third_party/java/guava", ], ) + +java_plugin( + name = "plugin", + processor_class = "com.google.auto.service.processor.AutoServiceProcessor", + visibility = ["//visibility:private"], + deps = [ + ":auto_service", + "//third_party/java/auto:auto-common", + "//third_party/java/guava", + ], +) + +java_library( + name = "service", + exported_plugins = [":plugin"], + exports = [":auto_service"], +) diff --git a/third_party/js/selenium/BUILD.bazel b/third_party/js/selenium/BUILD.bazel new file mode 100644 index 0000000000000..5ac89c3827f07 --- /dev/null +++ b/third_party/js/selenium/BUILD.bazel @@ -0,0 +1,18 @@ +load("//:copy_file.bzl", "copy_file") + +copy_file( + name = "webdriver_xpi", + src = "webdriver-3.141.59.xpi", + out = "webdriver.xpi", + visibility = [ + "//java/client/src/org/openqa/selenium/firefox/xpi:__pkg__", + ], +) + +exports_files( + ["webdriver.json"], + visibility = [ + "//dotnet/src/webdriver:__pkg__", + "//java/client/src/org/openqa/selenium/firefox:__pkg__", + ], +) diff --git a/third_party/js/sizzle/BUILD.bazel b/third_party/js/sizzle/BUILD.bazel new file mode 100644 index 0000000000000..db12bc59f3f55 --- /dev/null +++ b/third_party/js/sizzle/BUILD.bazel @@ -0,0 +1,8 @@ +filegroup( + name = "sizzle", + srcs = ["sizzle.js"], + visibility = [ + "//java/client/src/com/thoughtworks/selenium/webdriven:__pkg__", + "//javascript/selenium-core:__pkg__", + ], +)