diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 0d2235f2..2bae7e3e 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -1,26 +1,136 @@ --- -platforms: - ubuntu2204: - build_targets: - - "//..." - test_flags: - - "--test_tag_filters=-noci,-external,-native,-sauce" - test_targets: - - "//..." - macos: - build_targets: - - "//..." - test_flags: - - "--test_tag_filters=-noci,-sauce,-external,-native" - test_targets: - - "//..." - windows: - build_flags: - - "--enable_runfiles" - build_targets: - - "//..." - test_flags: - - "--test_tag_filters=-noci,-sauce,-external,-native" - - "--enable_runfiles" - test_targets: - - "//..." +tasks: + web_testing_go_ubuntu2004: + name: "rules_web_testing_go in ubuntu" + platform: ubuntu2004 + shell_commands: + - "sudo apt -y update && sudo apt -y install libasound2" + - "sudo apt -y update && sudo apt -y install libatk-bridge2.0-0" + - "sudo apt -y update && sudo apt -y install libatk1.0-0" + - "sudo apt -y update && sudo apt -y install libc6" + - "sudo apt -y update && sudo apt -y install libcairo2" + - "sudo apt -y update && sudo apt -y install libcups2" + - "sudo apt -y update && sudo apt -y install libdbus-1-3" + - "sudo apt -y update && sudo apt -y install libexpat1" + - "sudo apt -y update && sudo apt -y install libfontconfig1" + - "sudo apt -y update && sudo apt -y install libgbm1" + - "sudo apt -y update && sudo apt -y install libgcc1" + - "sudo apt -y update && sudo apt -y install libglib2.0-0" + - "sudo apt -y update && sudo apt -y install libgtk-3-0" + - "sudo apt -y update && sudo apt -y install libnspr4" + - "sudo apt -y update && sudo apt -y install libnss3" + - "sudo apt -y update && sudo apt -y install libpango-1.0-0" + - "sudo apt -y update && sudo apt -y install libpangocairo-1.0-0" + - "sudo apt -y update && sudo apt -y install libstdc++6" + - "sudo apt -y update && sudo apt -y install libx11-6" + - "sudo apt -y update && sudo apt -y install libx11-xcb1" + - "sudo apt -y update && sudo apt -y install libxcb1" + - "sudo apt -y update && sudo apt -y install libxcomposite1" + - "sudo apt -y update && sudo apt -y install libxcursor1" + - "sudo apt -y update && sudo apt -y install libxdamage1" + - "sudo apt -y update && sudo apt -y install libxext6" + - "sudo apt -y update && sudo apt -y install libxfixes3" + - "sudo apt -y update && sudo apt -y install libxi6" + - "sudo apt -y update && sudo apt -y install libxrandr2" + - "sudo apt -y update && sudo apt -y install libxrender1" + - "sudo apt -y update && sudo apt -y install libxss1" + - "sudo apt -y update && sudo apt -y install libxtst6" + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: ["..."] + test_targets: ["..."] + working_directory: web_testing_go + web_testing_go_macos: + name: "rules_web_testing_go in macos" + platform: macos + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: ["..." ] + test_targets: [ "..." ] + working_directory: web_testing_go + web_testing_go_windows: + name: "rules_web_testing_go in windows" + platform: windows + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: [ "..." ] + test_targets: [ "..." ] + working_directory: web_testing_go + web_testing_scala_ubuntu2004: + name: "rules_web_testing_scala in ubuntu" + platform: ubuntu2004 + shell_commands: + - "sudo apt -y update && sudo apt -y install libxcb1" + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: ["..."] + test_targets: ["..."] + working_directory: web_testing_scala + web_testing_scala_macos: + name: "rules_web_testing_scala in macos" + platform: macos + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: [ "..." ] + test_targets: [ "..." ] + working_directory: web_testing_scala + web_testing_scala_windows: + name: "rules_web_testing_scala in windows" + platform: windows + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: [ "..." ] + test_targets: [ "..." ] + working_directory: web_testing_scala + web_testing_java_ubuntu2004: + name: "rules_web_testing_java in ubuntu" + platform: ubuntu2004 + shell_commands: + - "sudo apt -y update && sudo apt -y install libxcb1" + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: [ "..." ] + test_targets: [ "..." ] + working_directory: web_testing_java + web_testing_java_macos: + name: "rules_web_testing_java in macos" + platform: macos + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: [ "..." ] + test_targets: [ "..." ] + working_directory: web_testing_java + web_testing_java_windows: + name: "rules_web_testing_java in windows" + platform: windows + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: [ "..." ] + test_targets: [ "..." ] + working_directory: web_testing_java + web_testing_python_ubuntu2004: + name: "rules_web_testing_python in ubuntu" + platform: ubuntu2004 + shell_commands: + - "sudo apt -y update && sudo apt -y install libxcb1" + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: [ "..." ] + test_targets: [ "..." ] + working_directory: web_testing_python + web_testing_python_macos: + name: "rules_web_testing_python in macos" + platform: macos + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: [ "..." ] + test_targets: [ "..." ] + working_directory: web_testing_python + web_testing_python_windows: + name: "rules_web_testing_python in windows" + platform: windows + test_flags: + - "--test_tag_filters=-noci,-sauce" + build_targets: [ "..." ] + test_targets: [ "..." ] + working_directory: web_testing_python diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 00000000..9dad43df --- /dev/null +++ b/.bazelignore @@ -0,0 +1,4 @@ +web_testing_go +web_testing_java +web_testing_python +web_testing_scala diff --git a/BUILD.bazel b/BUILD.bazel index af1d9d52..ab52bbb1 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -15,7 +15,6 @@ ################################################################################ # load("@bazel_gazelle//:def.bzl", "gazelle") -load("@python_versions//3.11:defs.bzl", "compile_pip_requirements") licenses(["notice"]) # Apache 2.0 @@ -25,11 +24,3 @@ gazelle( name = "gazelle", prefix = "github.com/bazelbuild/rules_webtesting", ) - -compile_pip_requirements( - name = "requirements", - requirements_in = "requirements.in", - requirements_txt = "requirements_lock.txt", - requirements_windows = "requirements_lock_windows.txt", -) - diff --git a/MODULE.bazel b/MODULE.bazel index 17754659..ac865778 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,80 +4,26 @@ module( ) bazel_dep(name = "bazel_skylib", version = "1.7.1") + bazel_dep(name = "platforms", version = "0.0.10") ##### Go dependencies ##### bazel_dep(name = "rules_go", version = "0.51.0-rc1", repo_name = "io_bazel_rules_go") + bazel_dep(name = "gazelle", version = "0.40.0", repo_name = "bazel_gazelle") go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps") + go_deps.from_file(go_mod = "//:go.mod") # All *direct* Go dependencies of the module have to be listed explicitly. -use_repo( - go_deps, - "com_github_gorilla_mux", - "com_github_tebeka_selenium", -) - -##### Java dependencies ##### -bazel_dep(name = "rules_jvm_external", version = "6.6") - -maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") -maven.install( - artifacts = [ - "com.google.guava:guava:33.2.1-jre", - "org.seleniumhq.selenium:selenium-remote-driver:4.27.0", - "org.seleniumhq.selenium:selenium-api:4.27.0", - "junit:junit:4.13.2", - ], -) -use_repo(maven, "maven") - -##### Python dependencies ##### -bazel_dep(name = "rules_python", version = "1.0.0") - -python = use_extension("@rules_python//python/extensions:python.bzl", "python") -python.toolchain( - is_default = True, - python_version = "3.11", -) -use_repo(python, "python_3_11", "python_versions") - -pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") -pip.parse( - hub_name = "rules_webtesting_py_deps", - python_version = "3.11", - requirements_lock = "//:requirements_lock.txt", - requirements_windows = "requirements_lock_windows.txt", -) -use_repo(pip, "rules_webtesting_py_deps") - -##### Scala dependencies ##### -bazel_dep(name = "rules_scala", repo_name = "io_bazel_rules_scala") - -# TODO: Switch to a release version once it's available in BCR. -# Otherwise, the root module has to declare the same override. -git_override( - module_name = "rules_scala", - commit = "219e63983e8e483e66ebf70372969ba227382001", - remote = "https://github.com/mbland/rules_scala", -) - -scala_deps = use_extension( - "@io_bazel_rules_scala//scala/extensions:deps.bzl", - "scala_deps", -) -scala_deps.settings( - fetch_sources = True, -) -scala_deps.toolchains( - scalatest = True, -) +use_repo(go_deps, "com_github_gorilla_mux", "com_github_tebeka_selenium") ##### Browsers dependencies ##### browser_repositories = use_extension("//web:extension.bzl", "browser_repositories_extension") + browser_repositories.install(version = "0.3.4") + use_repo( browser_repositories, "com_saucelabs_sauce_connect_linux_x64", diff --git a/README.md b/README.md index adf6569c..c0e84d03 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,14 @@ WebDriver. ## Configure your Bazel project -For all languages, you need to add the following to your MODULE.bazel file: +For each language , you need to add the following to your MODULE.bazel file: ```bzl -bazel_dep(name = "rules_webtesting", version = "0.4.0") +bazel_dep(name = "rules_webtesting_${language}", version = "0.4.0") +``` +For example for Java: +```bzl +bazel_dep(name = "rules_webtesting_java", version = "0.4.0") ``` ## Write your tests @@ -77,7 +81,7 @@ import ( "testing" "github.com/tebeka/selenium" - "github.com/bazelbuild/rules_webtesting/go/webtest" + "github.com/bazelbuild/rules_web_testing_go/webtest" ) func TestWebApp(t *testing.T) { @@ -100,7 +104,7 @@ In your BUILD files, load the correct language specific build rule and create a test target using it: ```bzl -load("@rules_webtesting//web:py.bzl", "py_web_test_suite") +load("@rules_web_testing_python//web:py.bzl", "py_web_test_suite") py_web_test_suite( name = "browser_test", diff --git a/browsers/BUILD.bazel b/browsers/BUILD.bazel index f8d5a280..ada9253b 100644 --- a/browsers/BUILD.bazel +++ b/browsers/BUILD.bazel @@ -50,9 +50,6 @@ browser( browser( name = "chromium-local", metadata = "chromium-local.json", - required_tags = [ - "native", - ], deps = [ "//go/wsl", "//third_party/chromedriver", diff --git a/go/bazel/BUILD.bazel b/go/bazel/BUILD.bazel index 2df1344b..df42180d 100644 --- a/go/bazel/BUILD.bazel +++ b/go/bazel/BUILD.bazel @@ -22,6 +22,6 @@ go_library( name = "go_default_library", srcs = ["bazel.go"], importpath = "github.com/bazelbuild/rules_webtesting/go/bazel", - visibility = ["//go:__subpackages__"], + visibility = ["//visibility:public"], deps = ["//go/cmdhelper:go_default_library"], ) diff --git a/go/metadata/BUILD.bazel b/go/metadata/BUILD.bazel index 99a5d16b..181da00e 100644 --- a/go/metadata/BUILD.bazel +++ b/go/metadata/BUILD.bazel @@ -25,7 +25,7 @@ go_library( "web_test_files.go", ], importpath = "github.com/bazelbuild/rules_webtesting/go/metadata", - visibility = ["//go:__subpackages__"], + visibility = ["//visibility:public"], deps = [ "//go/bazel:go_default_library", "//go/httphelper:go_default_library", @@ -39,7 +39,7 @@ go_test( "extension_test.go", "metadata_test.go", ], - data = ["//testdata"], + data = ["@rules_webtesting//testdata"], embed = [":go_default_library"], - deps = ["//go/bazel:go_default_library"], + deps = ["@rules_webtesting//go/bazel:go_default_library"], ) diff --git a/go/web/BUILD.bazel b/go/web/BUILD.bazel new file mode 100644 index 00000000..10e32208 --- /dev/null +++ b/go/web/BUILD.bazel @@ -0,0 +1,32 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +load("@rules_webtesting//web:web.bzl", "web_test_config") + +package( + default_testonly = True, + default_visibility = ["//go:__subpackages__"], +) + +bzl_library( + name = "go", + srcs = ["go.bzl"], + deps = [ + "@rules_webtesting//web/internal:wrap_web_test_suite", + # should depend on @io_bazel_rules_go//go:def.bzl + ], +) diff --git a/web/go.bzl b/go/web/go.bzl similarity index 87% rename from web/go.bzl rename to go/web/go.bzl index 1168176e..183226b8 100644 --- a/web/go.bzl +++ b/go/web/go.bzl @@ -13,9 +13,9 @@ # limitations under the License. """Web Test rules for Go.""" -load("//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS") -load("//web/internal:wrap_web_test_suite.bzl", "wrap_web_test_suite") load("@io_bazel_rules_go//go:def.bzl", "go_test") +load("@rules_webtesting//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS") +load("@rules_webtesting//web/internal:wrap_web_test_suite.bzl", "wrap_web_test_suite") def go_web_test_suite(name, go_test_tags = DEFAULT_WRAPPED_TEST_TAGS, **kwargs): """Defines a test_suite of web_test targets that wrap a go_test target. diff --git a/go/webdriver/BUILD.bazel b/go/webdriver/BUILD.bazel index 14c71c9e..ce446db1 100644 --- a/go/webdriver/BUILD.bazel +++ b/go/webdriver/BUILD.bazel @@ -14,7 +14,7 @@ # ################################################################################ # -load("//web:go.bzl", "go_web_test_suite") +load("//go/web:go.bzl", "go_web_test_suite") load("@io_bazel_rules_go//go:def.bzl", "go_library") licenses(["notice"]) # Apache 2.0 diff --git a/go/webtest/BUILD.bazel b/go/webtest/BUILD.bazel index 7a268cf7..b4b5d474 100644 --- a/go/webtest/BUILD.bazel +++ b/go/webtest/BUILD.bazel @@ -14,7 +14,7 @@ # ################################################################################ # -load("//web:go.bzl", "go_web_test_suite") +load("//go/web:go.bzl", "go_web_test_suite") load("@io_bazel_rules_go//go:def.bzl", "go_library") licenses(["notice"]) # Apache 2.0 diff --git a/go/wtl/proxy/BUILD.bazel b/go/wtl/proxy/BUILD.bazel index bdea0d24..d6d36f54 100644 --- a/go/wtl/proxy/BUILD.bazel +++ b/go/wtl/proxy/BUILD.bazel @@ -14,7 +14,7 @@ # ################################################################################ # -load("//web:go.bzl", "go_web_test_suite") +load("//go/web:go.bzl", "go_web_test_suite") load("@io_bazel_rules_go//go:def.bzl", "go_library") licenses(["notice"]) # Apache 2.0 diff --git a/go/wtl/proxy/driverhub/quithandler/BUILD.bazel b/go/wtl/proxy/driverhub/quithandler/BUILD.bazel index 66ca5f26..e1e1b0a9 100644 --- a/go/wtl/proxy/driverhub/quithandler/BUILD.bazel +++ b/go/wtl/proxy/driverhub/quithandler/BUILD.bazel @@ -14,7 +14,7 @@ # ################################################################################ # -load("//web:go.bzl", "go_web_test_suite") +load("//go/web:go.bzl", "go_web_test_suite") load("@io_bazel_rules_go//go:def.bzl", "go_library") licenses(["notice"]) # Apache 2.0 diff --git a/go/wtl/proxy/driverhub/scripttimeout/BUILD.bazel b/go/wtl/proxy/driverhub/scripttimeout/BUILD.bazel index dfb2e78e..6908eebe 100644 --- a/go/wtl/proxy/driverhub/scripttimeout/BUILD.bazel +++ b/go/wtl/proxy/driverhub/scripttimeout/BUILD.bazel @@ -14,7 +14,7 @@ # ################################################################################ # -load("//web:go.bzl", "go_web_test_suite") +load("//go/web:go.bzl", "go_web_test_suite") load("@io_bazel_rules_go//go:def.bzl", "go_library") licenses(["notice"]) # Apache 2.0 diff --git a/testdata/BUILD.bazel b/testdata/BUILD.bazel index cdaac083..4b8a3994 100644 --- a/testdata/BUILD.bazel +++ b/testdata/BUILD.bazel @@ -23,7 +23,7 @@ licenses(["notice"]) # Apache 2.0 filegroup( name = "testdata", srcs = glob(["*"]), - visibility = ["//:__subpackages__"], + visibility = ["//visibility:public"], ) web_test_files( diff --git a/web/BUILD.bazel b/web/BUILD.bazel index 6b5e9ae1..3c2c08ec 100644 --- a/web/BUILD.bazel +++ b/web/BUILD.bazel @@ -29,45 +29,15 @@ web_test_config( visibility = ["//visibility:public"], ) -bzl_library( - name = "go", - srcs = ["go.bzl"], - deps = [ - "//web/internal:wrap_web_test_suite", - # should depend on @io_bazel_rules_go//go:def.bzl - ], -) - -bzl_library( - name = "java", - srcs = ["java.bzl"], - deps = ["//web/internal:wrap_web_test_suite"], -) - -bzl_library( - name = "py", - srcs = ["py.bzl"], - deps = ["//web/internal:wrap_web_test_suite"], -) - -bzl_library( - name = "scala", - srcs = ["scala.bzl"], - deps = [ - "//web/internal:wrap_web_test_suite", - # should depend on @io_bazel_rules_scala//scala:scala.bzl - ], -) - bzl_library( name = "web", srcs = ["web.bzl"], deps = [ "//web/internal:browser", "//web/internal:constants", - "//web/internal:platform_metadata", - "//web/internal:platform_archive", "//web/internal:custom_browser", + "//web/internal:platform_archive", + "//web/internal:platform_metadata", "//web/internal:web_test", "//web/internal:web_test_config", "//web/internal:web_test_files", diff --git a/web/internal/BUILD.bazel b/web/internal/BUILD.bazel index d92ea949..582fef40 100644 --- a/web/internal/BUILD.bazel +++ b/web/internal/BUILD.bazel @@ -18,7 +18,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") package( default_testonly = True, - default_visibility = ["//web:__subpackages__"], + default_visibility = ["//visibility:public"], ) licenses(["notice"]) # Apache 2.0 diff --git a/web_testing_go/BUILD.bazel b/web_testing_go/BUILD.bazel new file mode 100644 index 00000000..ab52bbb1 --- /dev/null +++ b/web_testing_go/BUILD.bazel @@ -0,0 +1,26 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# +load("@bazel_gazelle//:def.bzl", "gazelle") + +licenses(["notice"]) # Apache 2.0 + +exports_files(["LICENSE"]) + +gazelle( + name = "gazelle", + prefix = "github.com/bazelbuild/rules_webtesting", +) diff --git a/web_testing_go/MODULE.bazel b/web_testing_go/MODULE.bazel new file mode 100644 index 00000000..c50a63e8 --- /dev/null +++ b/web_testing_go/MODULE.bazel @@ -0,0 +1,33 @@ +module( + name = "rules_web_testing_go", + version = "0.4.0", +) + +bazel_dep( + name = "rules_webtesting", +) + +local_path_override( + module_name = "rules_webtesting", + path = "..", +) + +bazel_dep( + name = "bazel_skylib", + version = "1.7.1", +) + +bazel_dep( + name = "rules_go", + version = "0.51.0-rc1", + repo_name = "io_bazel_rules_go", +) + +bazel_dep(name = "gazelle", version = "0.40.0", repo_name = "bazel_gazelle") + +go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps") + +go_deps.from_file(go_mod = "@rules_webtesting//:go.mod") + +# All *direct* Go dependencies of the module have to be listed explicitly. +use_repo(go_deps, "com_github_gorilla_mux", "com_github_tebeka_selenium") \ No newline at end of file diff --git a/web_testing_go/testdata/BUILD b/web_testing_go/testdata/BUILD new file mode 100644 index 00000000..28431762 --- /dev/null +++ b/web_testing_go/testdata/BUILD @@ -0,0 +1,26 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# + +package(default_testonly = True) + +licenses(["notice"]) # Apache 2.0 + +filegroup( + name = "testdata", + srcs = glob(["*"]), + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/web_testing_go/testdata/all-fields.json b/web_testing_go/testdata/all-fields.json new file mode 120000 index 00000000..1dd3b8eb --- /dev/null +++ b/web_testing_go/testdata/all-fields.json @@ -0,0 +1 @@ +../../testdata/all-fields.json \ No newline at end of file diff --git a/web_testing_go/web/BUILD.bazel b/web_testing_go/web/BUILD.bazel new file mode 120000 index 00000000..f6298d4c --- /dev/null +++ b/web_testing_go/web/BUILD.bazel @@ -0,0 +1 @@ +../../go/web/BUILD.bazel \ No newline at end of file diff --git a/web_testing_go/web/go.bzl b/web_testing_go/web/go.bzl new file mode 120000 index 00000000..821f7f6d --- /dev/null +++ b/web_testing_go/web/go.bzl @@ -0,0 +1 @@ +../../go/web/go.bzl \ No newline at end of file diff --git a/web_testing_go/webtest/BUILD.bazel b/web_testing_go/webtest/BUILD.bazel new file mode 100644 index 00000000..ce882d9c --- /dev/null +++ b/web_testing_go/webtest/BUILD.bazel @@ -0,0 +1,49 @@ +# Copyright 2017 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# +load("//web:go.bzl", "go_web_test_suite") +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +licenses(["notice"]) # Apache 2.0 + +go_library( + name = "go_default_library", + srcs = ["webtest.go"], + importpath = "github.com/bazelbuild/rules_webtesting/web_testing_go/webtest", + visibility = ["//visibility:public"], + deps = [ + "@rules_webtesting//go/bazel:go_default_library", + "@rules_webtesting//go/metadata:go_default_library", + "@com_github_tebeka_selenium//:go_default_library", + ], +) + +go_web_test_suite( + name = "go_default_test", + srcs = [ + "browserinfo_test.go", + "webtest_test.go", + ], + browsers = [ + "@rules_webtesting//browsers:chromium-local", + "@rules_webtesting//browsers:firefox-local", + "@rules_webtesting//browsers/sauce:chrome-win10", + "@rules_webtesting//browsers/sauce:chrome-win10-connect", + ], + data = ["//testdata"], + embed = [":go_default_library"], + deps = ["@com_github_tebeka_selenium//:go_default_library"], +) diff --git a/web_testing_go/webtest/browserinfo_test.go b/web_testing_go/webtest/browserinfo_test.go new file mode 120000 index 00000000..22fad2ea --- /dev/null +++ b/web_testing_go/webtest/browserinfo_test.go @@ -0,0 +1 @@ +../../go/webtest/browserinfo_test.go \ No newline at end of file diff --git a/web_testing_go/webtest/webtest.go b/web_testing_go/webtest/webtest.go new file mode 120000 index 00000000..080357e1 --- /dev/null +++ b/web_testing_go/webtest/webtest.go @@ -0,0 +1 @@ +../../go/webtest/webtest.go \ No newline at end of file diff --git a/web_testing_go/webtest/webtest_test.go b/web_testing_go/webtest/webtest_test.go new file mode 120000 index 00000000..acabea0e --- /dev/null +++ b/web_testing_go/webtest/webtest_test.go @@ -0,0 +1 @@ +../../go/webtest/webtest_test.go \ No newline at end of file diff --git a/web_testing_java/BUILD.bazel b/web_testing_java/BUILD.bazel new file mode 100644 index 00000000..e69de29b diff --git a/web_testing_java/MODULE.bazel b/web_testing_java/MODULE.bazel new file mode 100644 index 00000000..8e7f6b39 --- /dev/null +++ b/web_testing_java/MODULE.bazel @@ -0,0 +1,36 @@ +module( + name = "rules_web_testing_java", + version = "0.4.0", +) + +bazel_dep( + name = "rules_webtesting", +) + +local_path_override( + module_name = "rules_webtesting", + path = "..", +) + +bazel_dep( + name = "bazel_skylib", + version = "1.7.1", +) + +bazel_dep( + name = "rules_jvm_external", + version = "6.6", +) + +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") + +maven.install( + artifacts = [ + "com.google.guava:guava:33.2.1-jre", + "org.seleniumhq.selenium:selenium-remote-driver:4.27.0", + "org.seleniumhq.selenium:selenium-api:4.27.0", + "junit:junit:4.13.2", + ], +) + +use_repo(maven, "maven") diff --git a/java/com/google/testing/bazel/BUILD.bazel b/web_testing_java/java/com/google/testing/bazel/BUILD.bazel similarity index 100% rename from java/com/google/testing/bazel/BUILD.bazel rename to web_testing_java/java/com/google/testing/bazel/BUILD.bazel diff --git a/java/com/google/testing/bazel/Bazel.java b/web_testing_java/java/com/google/testing/bazel/Bazel.java similarity index 100% rename from java/com/google/testing/bazel/Bazel.java rename to web_testing_java/java/com/google/testing/bazel/Bazel.java diff --git a/java/com/google/testing/web/BUILD.bazel b/web_testing_java/java/com/google/testing/web/BUILD.bazel similarity index 100% rename from java/com/google/testing/web/BUILD.bazel rename to web_testing_java/java/com/google/testing/web/BUILD.bazel diff --git a/java/com/google/testing/web/WebTest.java b/web_testing_java/java/com/google/testing/web/WebTest.java similarity index 100% rename from java/com/google/testing/web/WebTest.java rename to web_testing_java/java/com/google/testing/web/WebTest.java diff --git a/javatests/com/google/testing/web/BUILD.bazel b/web_testing_java/javatests/com/google/testing/web/BUILD.bazel similarity index 81% rename from javatests/com/google/testing/web/BUILD.bazel rename to web_testing_java/javatests/com/google/testing/web/BUILD.bazel index 7499d4c4..3cddeb79 100644 --- a/javatests/com/google/testing/web/BUILD.bazel +++ b/web_testing_java/javatests/com/google/testing/web/BUILD.bazel @@ -22,10 +22,10 @@ java_web_test_suite( name = "WebTestTest", srcs = ["WebTestTest.java"], browsers = [ - "//browsers:chromium-local", - "//browsers:firefox-local", - "//browsers/sauce:chrome-win10", - "//browsers/sauce:chrome-win10-connect", + "@rules_webtesting//browsers:chromium-local", + "@rules_webtesting//browsers:firefox-local", + "@rules_webtesting//browsers/sauce:chrome-win10", + "@rules_webtesting//browsers/sauce:chrome-win10-connect", ], deps = [ "//java/com/google/testing/web", diff --git a/javatests/com/google/testing/web/WebTestTest.java b/web_testing_java/javatests/com/google/testing/web/WebTestTest.java similarity index 100% rename from javatests/com/google/testing/web/WebTestTest.java rename to web_testing_java/javatests/com/google/testing/web/WebTestTest.java diff --git a/web_testing_java/web/BUILD.bazel b/web_testing_java/web/BUILD.bazel new file mode 100644 index 00000000..bee0207f --- /dev/null +++ b/web_testing_java/web/BUILD.bazel @@ -0,0 +1,29 @@ +# Copyright 2025 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +load("@rules_webtesting//web:web.bzl", "web_test_config") + +package( + default_testonly = True, + default_visibility = ["//visibility:public"], +) + +bzl_library( + name = "java", + srcs = ["java.bzl"], + deps = ["@rules_webtesting//web/internal:wrap_web_test_suite"], +) diff --git a/web/java.bzl b/web_testing_java/web/java.bzl similarity index 89% rename from web/java.bzl rename to web_testing_java/web/java.bzl index 359425ad..ecb84912 100644 --- a/web/java.bzl +++ b/web_testing_java/web/java.bzl @@ -13,8 +13,8 @@ # limitations under the License. """Web Test rules for Java.""" -load("//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS") -load("//web/internal:wrap_web_test_suite.bzl", "wrap_web_test_suite") +load("@rules_webtesting//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS") +load("@rules_webtesting//web/internal:wrap_web_test_suite.bzl", "wrap_web_test_suite") def java_web_test_suite(name, java_test_tags = DEFAULT_WRAPPED_TEST_TAGS, test_class = None, **kwargs): """Defines a test_suite of web_test targets that wrap a java_test target. diff --git a/web_testing_python/BUILD.bazel b/web_testing_python/BUILD.bazel new file mode 100644 index 00000000..b5ad4b8c --- /dev/null +++ b/web_testing_python/BUILD.bazel @@ -0,0 +1,28 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# +load("@python_versions//3.11:defs.bzl", "compile_pip_requirements") + +licenses(["notice"]) # Apache 2.0 + +exports_files(["LICENSE"]) + +compile_pip_requirements( + name = "requirements", + requirements_in = "requirements.in", + requirements_txt = "requirements_lock.txt", + requirements_windows = "requirements_lock_windows.txt", +) diff --git a/web_testing_python/MODULE.bazel b/web_testing_python/MODULE.bazel new file mode 100644 index 00000000..28f33dad --- /dev/null +++ b/web_testing_python/MODULE.bazel @@ -0,0 +1,43 @@ +module( + name = "rules_web_testing_python", + version = "0.4.0", +) + +bazel_dep( + name = "bazel_skylib", + version = "1.7.1", +) + +bazel_dep( + name = "rules_webtesting", +) + +local_path_override( + module_name = "rules_webtesting", + path = "..", +) + +bazel_dep( + name = "rules_python", + version = "1.0.0", +) + +python = use_extension("@rules_python//python/extensions:python.bzl", "python") + +python.toolchain( + is_default = True, + python_version = "3.11", +) + +use_repo(python, "python_3_11", "python_versions") + +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") + +pip.parse( + hub_name = "rules_webtesting_py_deps", + python_version = "3.11", + requirements_lock = "//:requirements_lock.txt", + requirements_windows = "requirements_lock_windows.txt", +) + +use_repo(pip, "rules_webtesting_py_deps") diff --git a/requirements.in b/web_testing_python/requirements.in similarity index 100% rename from requirements.in rename to web_testing_python/requirements.in diff --git a/requirements_lock.txt b/web_testing_python/requirements_lock.txt similarity index 100% rename from requirements_lock.txt rename to web_testing_python/requirements_lock.txt diff --git a/requirements_lock_windows.txt b/web_testing_python/requirements_lock_windows.txt similarity index 100% rename from requirements_lock_windows.txt rename to web_testing_python/requirements_lock_windows.txt diff --git a/testing/web/BUILD.bazel b/web_testing_python/testing/web/BUILD.bazel similarity index 84% rename from testing/web/BUILD.bazel rename to web_testing_python/testing/web/BUILD.bazel index 6c563197..d14447e8 100644 --- a/testing/web/BUILD.bazel +++ b/web_testing_python/testing/web/BUILD.bazel @@ -35,14 +35,16 @@ py_web_test_suite( name = "webtest_test", srcs = ["webtest_test.py"], browsers = [ - "//browsers:chromium-local", - "//browsers:firefox-local", - "//browsers/sauce:chrome-win10", - "//browsers/sauce:chrome-win10-connect", + "@rules_webtesting//browsers:chromium-local", + "@rules_webtesting//browsers:firefox-local", + "@rules_webtesting//browsers/sauce:chrome-win10", + "@rules_webtesting//browsers/sauce:chrome-win10-connect", ], tags = { "chromium-local": [ "native", + "sauce", + "notravis", ], "chrome-win10": [ "exclusive", diff --git a/testing/web/debugger/BUILD.bazel b/web_testing_python/testing/web/debugger/BUILD similarity index 100% rename from testing/web/debugger/BUILD.bazel rename to web_testing_python/testing/web/debugger/BUILD diff --git a/testing/web/debugger/debugger.py b/web_testing_python/testing/web/debugger/debugger.py similarity index 100% rename from testing/web/debugger/debugger.py rename to web_testing_python/testing/web/debugger/debugger.py diff --git a/testing/web/webtest.py b/web_testing_python/testing/web/webtest.py similarity index 100% rename from testing/web/webtest.py rename to web_testing_python/testing/web/webtest.py diff --git a/testing/web/webtest_test.py b/web_testing_python/testing/web/webtest_test.py similarity index 100% rename from testing/web/webtest_test.py rename to web_testing_python/testing/web/webtest_test.py diff --git a/web_testing_python/web/BUILD.bazel b/web_testing_python/web/BUILD.bazel new file mode 100644 index 00000000..f17000e8 --- /dev/null +++ b/web_testing_python/web/BUILD.bazel @@ -0,0 +1,29 @@ +# Copyright 2025 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +load("@rules_webtesting//web:web.bzl", "web_test_config") + +package( + default_testonly = True, + default_visibility = ["//visibility:public"], +) + +bzl_library( + name = "py", + srcs = ["py.bzl"], + deps = ["@rules_webtesting//web/internal:wrap_web_test_suite"], +) diff --git a/web/py.bzl b/web_testing_python/web/py.bzl similarity index 87% rename from web/py.bzl rename to web_testing_python/web/py.bzl index 104e7c41..3a641736 100644 --- a/web/py.bzl +++ b/web_testing_python/web/py.bzl @@ -13,8 +13,8 @@ # limitations under the License. """Web Test rules for Python.""" -load("//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS") -load("//web/internal:wrap_web_test_suite.bzl", "wrap_web_test_suite") +load("@rules_webtesting//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS") +load("@rules_webtesting//web/internal:wrap_web_test_suite.bzl", "wrap_web_test_suite") def py_web_test_suite(name, py_test_tags = DEFAULT_WRAPPED_TEST_TAGS, main = None, **kwargs): """Defines a test_suite of web_test targets that wrap a py_test target. diff --git a/web_testing_scala/MODULE.bazel b/web_testing_scala/MODULE.bazel new file mode 100644 index 00000000..e9f16d34 --- /dev/null +++ b/web_testing_scala/MODULE.bazel @@ -0,0 +1,74 @@ +module( + name = "rules_web_testing_scala", + version = "0.4.0", +) + +bazel_dep( + name = "rules_webtesting", +) + +local_path_override( + module_name = "rules_webtesting", + path = "..", +) + +bazel_dep( + name = "rules_web_testing_java", +) + + +local_path_override( + module_name = "rules_web_testing_java", + path = "../web_testing_java", +) + +bazel_dep( + name = "bazel_skylib", + version = "1.7.1", +) + +##### Scala dependencies ##### +bazel_dep( + name = "rules_scala", + repo_name = "io_bazel_rules_scala", +) + +# TODO: Switch to a release version once it's available in BCR. +# Otherwise, the root module has to declare the same override. +git_override( + module_name = "rules_scala", + commit = "219e63983e8e483e66ebf70372969ba227382001", + remote = "https://github.com/mbland/rules_scala", +) + +scala_deps = use_extension( + "@io_bazel_rules_scala//scala/extensions:deps.bzl", + "scala_deps", +) + +scala_deps.settings( + fetch_sources = True, +) + +scala_deps.toolchains( + scalatest = True, +) + +##### Java dependencies ##### +bazel_dep( + name = "rules_jvm_external", + version = "6.6", +) + +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") + +maven.install( + artifacts = [ + "com.google.guava:guava:33.2.1-jre", + "org.seleniumhq.selenium:selenium-remote-driver:4.27.0", + "org.seleniumhq.selenium:selenium-api:4.27.0", + "junit:junit:4.13.2", + ], +) + +use_repo(maven, "maven") diff --git a/scalatests/com/google/testing/web/BUILD.bazel b/web_testing_scala/scalatests/BUILD.bazel similarity index 76% rename from scalatests/com/google/testing/web/BUILD.bazel rename to web_testing_scala/scalatests/BUILD.bazel index a7b7c5c0..b4cee0d7 100644 --- a/scalatests/com/google/testing/web/BUILD.bazel +++ b/web_testing_scala/scalatests/BUILD.bazel @@ -22,14 +22,14 @@ scala_web_test_suite( name = "WebTestTest", srcs = ["WebTestTest.scala"], browsers = [ - "//browsers:chromium-local", - "//browsers:firefox-local", - "//browsers/sauce:chrome-win10", - "//browsers/sauce:chrome-win10-connect", + "@rules_webtesting//browsers:chromium-local", + "@rules_webtesting//browsers:firefox-local", + "@rules_webtesting//browsers/sauce:chrome-win10", + "@rules_webtesting//browsers/sauce:chrome-win10-connect", ], deps = [ - "//java/com/google/testing/web", "@maven//:junit_junit", "@maven//:org_seleniumhq_selenium_selenium_api", + "@rules_web_testing_java//java/com/google/testing/web", ], ) diff --git a/scalatests/com/google/testing/web/WebTestTest.scala b/web_testing_scala/scalatests/WebTestTest.scala similarity index 100% rename from scalatests/com/google/testing/web/WebTestTest.scala rename to web_testing_scala/scalatests/WebTestTest.scala diff --git a/web_testing_scala/web/BUILD.bazel b/web_testing_scala/web/BUILD.bazel new file mode 100644 index 00000000..ad48c48b --- /dev/null +++ b/web_testing_scala/web/BUILD.bazel @@ -0,0 +1,32 @@ +# Copyright 2025 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +load("@rules_webtesting//web:web.bzl", "web_test_config") + +package( + default_testonly = True, + default_visibility = ["//visibility:public"], +) + +bzl_library( + name = "scala", + srcs = ["scala.bzl"], + deps = [ + "@rules_webtesting//web/internal:wrap_web_test_suite", + # should depend on @io_bazel_rules_scala//scala:scala.bzl + ], +) diff --git a/web/scala.bzl b/web_testing_scala/web/scala.bzl similarity index 87% rename from web/scala.bzl rename to web_testing_scala/web/scala.bzl index 19e2ea27..b78ec7e7 100644 --- a/web/scala.bzl +++ b/web_testing_scala/web/scala.bzl @@ -13,9 +13,9 @@ # limitations under the License. """Web Test rules for Java.""" -load("//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS") -load("//web/internal:wrap_web_test_suite.bzl", "wrap_web_test_suite") load("@io_bazel_rules_scala//scala:scala.bzl", "scala_test") +load("@rules_webtesting//web/internal:constants.bzl", "DEFAULT_WRAPPED_TEST_TAGS") +load("@rules_webtesting//web/internal:wrap_web_test_suite.bzl", "wrap_web_test_suite") def scala_web_test_suite(name, scala_test_tags = DEFAULT_WRAPPED_TEST_TAGS, **kwargs): """Defines a test_suite of web_test targets that wrap a java_test target.