diff --git a/.bazelrc b/.bazelrc index 734cd7a528512..3c554d1ba5c24 100644 --- a/.bazelrc +++ b/.bazelrc @@ -94,7 +94,7 @@ build:remote --remote_cache=grpcs://gypsum.cluster.engflow.com build:remote -j 50 # Build Without The Bytes -build:remote --remote_download_outputs=minimal +build:remote --remote_download_minimal build:remote --define=EXECUTOR=remote build:remote --experimental_inmemory_dotd_files diff --git a/.skipped-tests b/.skipped-tests index 48a77298dbe7d..08c8ed4577a94 100644 --- a/.skipped-tests +++ b/.skipped-tests @@ -31,3 +31,6 @@ -//py:test-chrome-test/selenium/webdriver/chrome/chrome_service_tests.py -//py:test-chrome-test/selenium/webdriver/chrome/proxy_tests.py -//py:unit-test/unit/selenium/webdriver/common/cdp_module_fallback_tests.py +-//rb/spec/integration/selenium/webdriver/chrome:service +-//rb/spec/integration/selenium/webdriver/edge:service +-//rb/spec/integration/selenium/webdriver/firefox:service diff --git a/WORKSPACE b/WORKSPACE index da43e0fba4498..5ef8936a11d0c 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -344,9 +344,9 @@ pin_browsers() http_archive( name = "rules_ruby", - sha256 = "9bfab76e1272dae72355c65cc858ede68b659716381485baa4c8e7a70ddc38a6", - strip_prefix = "rules_ruby-0.5.0", - url = "https://github.com/bazel-contrib/rules_ruby/releases/download/v0.5.0/rules_ruby-v0.5.0.tar.gz", + sha256 = "9ff781fd8180c2be8b3ab0f16d1d88d618c3b1bc4d502dcb914591886da40014", + strip_prefix = "rules_ruby-0.8.1", + url = "https://github.com/bazel-contrib/rules_ruby/releases/download/v0.8.1/rules_ruby-v0.8.1.tar.gz", ) load( @@ -367,6 +367,83 @@ rb_bundle_fetch( "//:rb/selenium-devtools.gemspec", "//:rb/selenium-webdriver.gemspec", ], + gem_checksums = { + "abbrev-0.1.2": "ad1b4eaaaed4cb722d5684d63949e4bde1d34f2a95e20db93aecfe7cbac74242", + "activesupport-7.1.3": "fbfc137f1ab0e3909bd3de3e2a965245abf0381a2a7e283fa766cee6f5e0f927", + "addressable-2.8.6": "798f6af3556641a7619bad1dce04cdb6eb44b0216a991b0396ea7339276f2b47", + "ast-2.4.2": "1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12", + "base64-0.2.0": "0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507", + "bigdecimal-3.1.6": "bcbc27d449cf8ed1b1814d21308f49c9d22ce73e33fff0d228e38799c02eab01", + "bigdecimal-3.1.6-java": "2ef0e13a578e2411123254273f8b34c47ff9d45de91a6f64465fb217de8d5d04", + "concurrent-ruby-1.2.3": "82fdd3f8a0816e28d513e637bb2b90a45d7b982bdf4f3a0511722d2e495801e2", + "connection_pool-2.4.1": "0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4", + "crack-1.0.0": "c83aefdb428cdc7b66c7f287e488c796f055c0839e6e545fec2c7047743c4a49", + "csv-3.2.8": "2f5e11e8897040b97baf2abfe8fa265b314efeb8a9b7f756db9ebcf79e7db9fe", + "debug-1.9.1": "86f1a6d4a299184f1a1f7ae4c2fe80f178beed55cdf608f83b49d7bdefa3ffda", + "diff-lcs-1.5.1": "273223dfb40685548436d32b4733aa67351769c7dea621da7d9dd4813e63ddfe", + "drb-2.2.0": "e9e4af1cded3306cfe37e064a0086e302d5f40df9cb4d161d059a6bb3a75d40f", + "ffi-1.16.3": "6d3242ff10c87271b0675c58d68d3f10148fabc2ad6da52a18123f06078871fb", + "ffi-1.16.3-x64-mingw32": "6ec709011e3955e97033fa77907a8ab89a9150137d4c45c82c77399b909c9259", + "fileutils-1.7.2": "36a0fb324218263e52b486ad7408e9a295378fe8edc9fd343709e523c0980631", + "git-1.19.1": "b0a422d9f6517353c48a330d6114de4db9e0c82dbe7202964a1d9f1fbc827d70", + "hashdiff-1.1.0": "b5465f0e7375f1ee883f53a766ece4dbc764b7674a7c5ffd76e79b2f5f6fc9c9", + "i18n-1.14.1": "9d03698903547c060928e70a9bc8b6b87fda674453cda918fc7ab80235ae4a61", + "io-console-0.7.2": "f0dccff252f877a4f60d04a4dc6b442b185ebffb4b320ab69212a92b48a7a221", + "io-console-0.7.2-java": "73aa382f8832b116613ceaf57b8ff5bf73dfedcaf39f0aa5420e10f63a4543ed", + "irb-1.11.2": "a05f07e81d32dc79d78b0019283b9877463da0d40253774d1fe89f9586ae1cb9", + "jar-dependencies-0.4.1": "b2df2f1ecbff15334ce20ea7fdd5b8d8161faab67761ff72c7647d728e40d387", + "json-2.7.1": "187ea312fb58420ff0c40f40af1862651d4295c8675267c6a1c353f1a0ac3265", + "json-2.7.1-java": "bfd628c0f8357058c2cf848febfa6f140f70f94ec492693a31a0a1933038a61b", + "language_server-protocol-3.17.0.3": "3d5c58c02f44a20d972957a9febe386d7e7468ab3900ce6bd2b563dd910c6b3f", + "listen-3.8.0": "9679040ac6e7845ad9f19cf59ecde60861c78e2fae57a5c20fe35e94959b2f8f", + "logger-1.6.0": "0ab7c120262dd8de2a18cb8d377f1f318cbe98535160a508af9e7710ff43ef3e", + "minitest-5.22.2": "c5a5003fc2114a3fde506e87f377f32a0882b41d944d7b90cf4cd1f781dbc718", + "mutex_m-0.2.0": "b6ef0c6c842ede846f2ec0ade9e266b1a9dac0bc151682b04835e8ebd54840d5", + "parallel-1.24.0": "5bf38efb9b37865f8e93d7a762727f8c5fc5deb19949f4040c76481d5eee9397", + "parser-3.3.0.5": "7748313e505ca87045dc0465c776c802043f777581796eb79b1654c5d19d2687", + "psych-5.1.2": "337322f58fc2bf24827d2b9bd5ab595f6a72971867d151bb39980060ea40a368", + "psych-5.1.2-java": "1dd68dc609eddbc884e6892e11da942e16f7256bd30ebde9d35449d43043a6fe", + "public_suffix-5.0.4": "35cd648e0d21d06b8dce9331d19619538d1d898ba6d56a6f2258409d2526d1ae", + "racc-1.7.3": "b785ab8a30ec43bce073c51dbbe791fd27000f68d1c996c95da98bf685316905", + "racc-1.7.3-java": "b2ad737e788cfa083263ce7c9290644bb0f2c691908249eb4f6eb48ed2815dbf", + "rack-2.2.8": "7b83a1f1304a8f5554c67bc83632d29ecd2ed1daeb88d276b7898533fde22d97", + "rainbow-3.1.1": "039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a", + "rake-13.1.0": "be6a3e1aa7f66e6c65fa57555234eb75ce4cf4ada077658449207205474199c6", + "rb-fsevent-0.11.2": "43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe", + "rb-inotify-0.10.1": "050062d4f31d307cca52c3f6a7f4b946df8de25fc4bd373e1a5142e41034a7ca", + "rbs-3.4.4": "1376d2604a00832641bb47521595e63a1c0d1cc241ded383ba48ddb4396de5a8", + "rchardet-1.8.0": "693acd5253d5ade81a51940697955f6dd4bb2f0d245bda76a8e23deec70a52c7", + "rdoc-6.6.2": "f763dbec81079236bcccded19d69680471bd55da8f731ea6f583d019dacd9693", + "regexp_parser-2.9.0": "81a00ba141cec0d4b4bf58cb80cd9193e5180836d3fa6ef623f7886d3ba8bdd9", + "reline-0.4.2": "14042962b71d4cf52cc7d348f411886e2df54fc9d434d69b0b0bff84786d1c3a", + "rexml-3.2.6": "e0669a2d4e9f109951cb1fde723d8acd285425d81594a2ea929304af50282816", + "rspec-3.13.0": "d490914ac1d5a5a64a0e1400c1d54ddd2a501324d703b8cfe83f458337bab993", + "rspec-core-3.13.0": "557792b4e88da883d580342b263d9652b6a10a12d5bda9ef967b01a48f15454c", + "rspec-expectations-3.13.0": "621d48c62262f955421eaa418130744760802cad47e781df70dba4d9f897102e", + "rspec-mocks-3.13.0": "735a891215758d77cdb5f4721fffc21078793959d1f0ee4a961874311d9b7f66", + "rspec-support-3.13.0": "0e725f53b8c20ce75913a5da7bf06bf90698266951f3b1e3ae7bcd9612775257", + "rubocop-1.60.2": "000da0bffba2da48efdab233b13085afc3fabad2aa17ef0470cbaa0fd7cbc76c", + "rubocop-ast-1.30.0": "faad6452b1018fee0dd9e21a44445908e94ee2a4435932a9dae0e0740b6349b3", + "rubocop-capybara-2.20.0": "2a6844b942921f230ee3ab8c94fe77f41a9406096a140245270c0e11624bb938", + "rubocop-factory_bot-2.25.1": "62751bde7af789878b8a31cbd2a82e69515ce7b23a2ad1820cb0fcc3e0150134", + "rubocop-performance-1.20.2": "1bb1fa8c427fac7ba3c8dd2decb9860f23cb2d6c40350bedc88538de8875c731", + "rubocop-rspec-2.26.1": "da00a2794c35c6df9d013621fe9d8340ef9717dba746eb4aa69f414d86e74458", + "ruby-progressbar-1.13.0": "80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33", + "ruby2_keywords-0.0.5": "ffd13740c573b7301cf7a2e61fc857b2a8e3d3aff32545d6f8300d8bae10e3ef", + "rubyzip-2.3.2": "3f57e3935dc2255c414484fbf8d673b4909d8a6a57007ed754dde39342d2373f", + "securerandom-0.3.1": "98f0450c0ea46d2f9a4b6db4f391dbd83dc08049592eada155739f40e0341bde", + "steep-1.5.3": "7c6302a4d5932d0a46176ebc79766e52b853c223a85525aa2f8911e345123b85", + "stringio-3.1.0": "c1f6263ae03a15025e51194ab19b06b15e06adcaaedb7f5f6c06ab60f5d67718", + "strscan-3.1.0": "01b8a81d214fbf7b5308c6fb51b5972bbfc4a6aa1f166fd3618ba97e0fcd5555", + "strscan-3.1.0-java": "8645aa76e017e21764c6df572d2d79fcc1672284014f5bdbd806278cdbcd11b0", + "terminal-table-3.0.2": "f951b6af5f3e00203fb290a669e0a85c5dd5b051b3b023392ccfd67ba5abae91", + "tzinfo-2.0.6": "8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b", + "unicode-display_width-2.5.0": "7e7681dcade1add70cb9fda20dd77f300b8587c81ebbd165d14fd93144ff0ab4", + "webmock-3.21.0": "6609ab365daa85d203fcc297d1fffdbc8fc4216308b7c77d620af7d1261e2fd2", + "webrick-1.8.1": "19411ec6912911fd3df13559110127ea2badd0c035f7762873f58afc803e158f", + "websocket-1.2.10": "2cc1a4a79b6e63637b326b4273e46adcddf7871caa5dc5711f2ca4061a629fa8", + "yard-0.9.36": "5505736c1b00c926f71053a606ab75f02070c5960d0778b901fe9d8b0a470be4", + }, gemfile = "//:rb/Gemfile", gemfile_lock = "//:rb/Gemfile.lock", ) diff --git a/common/src/web/BUILD.bazel b/common/src/web/BUILD.bazel index 800bfd57f6f17..b1292861f150a 100644 --- a/common/src/web/BUILD.bazel +++ b/common/src/web/BUILD.bazel @@ -9,5 +9,6 @@ filegroup( "//java/test/org/openqa/selenium/environment:__pkg__", "//javascript/node/selenium-webdriver:__pkg__", "//py:__pkg__", + "//rb/spec:__subpackages__", ], ) diff --git a/rb/spec/integration/configuration.bzl b/rb/spec/integration/configuration.bzl deleted file mode 100644 index 3a592100c0ec4..0000000000000 --- a/rb/spec/integration/configuration.bzl +++ /dev/null @@ -1,42 +0,0 @@ -ENV = select({ - "//rb/spec/integration:chrome": { - "WD_REMOTE_BROWSER": "chrome", - "WD_SPEC_DRIVER": "chrome", - }, - "//rb/spec/integration:edge": { - "WD_REMOTE_BROWSER": "edge", - "WD_SPEC_DRIVER": "edge", - }, - "//rb/spec/integration:firefox": { - "WD_REMOTE_BROWSER": "firefox", - "WD_SPEC_DRIVER": "firefox", - }, - "//rb/spec/integration:ie": { - "WD_REMOTE_BROWSER": "ie", - "WD_SPEC_DRIVER": "ie", - }, - "//rb/spec/integration:safari": { - "WD_REMOTE_BROWSER": "safari", - "WD_SPEC_DRIVER": "safari", - }, - "//rb/spec/integration:safari-preview": { - "WD_REMOTE_BROWSER": "safari-preview", - "WD_SPEC_DRIVER": "safari-preview", - }, - "//conditions:default": {}, -}) | select({ - "//rb/spec/integration:remote": { - "WD_SPEC_DRIVER": "remote", - }, - "//conditions:default": {}, -}) | select({ - "//rb/spec/integration:headless": { - "HEADLESS": "true", - }, - "//conditions:default": {}, -}) - -# We have to use no-sandbox at the moment because Firefox crashes -# when run under sandbox: https://bugzilla.mozilla.org/show_bug.cgi?id=1382498. -# For Chromium-based browser, we can just pass `--no-sandbox` flag. -TAGS = ["no-sandbox"] diff --git a/rb/spec/integration/selenium/webdriver/BUILD.bazel b/rb/spec/integration/selenium/webdriver/BUILD.bazel index 4a92fea641dcb..38788477eb259 100644 --- a/rb/spec/integration/selenium/webdriver/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/BUILD.bazel @@ -1,7 +1,5 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_library", "rb_test") -load("//rb/spec/integration:configuration.bzl", "ENV", "TAGS") - -package(default_visibility = ["//rb:__subpackages__"]) +load("@rules_ruby//ruby:defs.bzl", "rb_library") +load("//rb/spec:tests.bzl", "rb_integration_test") rb_library( name = "spec_helper", @@ -18,6 +16,7 @@ rb_library( "//rb/spec/integration:remote": ["//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar"], "//conditions:default": [], }), + visibility = ["//rb/spec:__subpackages__"], deps = [ "//rb/lib:selenium-webdriver", "//rb/lib/selenium:devtools", @@ -39,16 +38,10 @@ rb_library( ) [ - rb_test( + rb_integration_test( name = file[:-8], - size = "large", srcs = [file], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS, deps = [ - ":spec_helper", "//rb/lib/selenium/webdriver:common", ], ) @@ -63,46 +56,30 @@ rb_library( ) ] -rb_test( +rb_integration_test( name = "bidi", - size = "large", srcs = ["bidi_spec.rb"], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS + ["exclusive-if-local"], + tags = ["exclusive-if-local"], deps = [ - ":spec_helper", "//rb/lib/selenium/devtools", "//rb/lib/selenium/webdriver:bidi", ], ) -rb_test( +rb_integration_test( name = "devtools", - size = "large", srcs = ["devtools_spec.rb"], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS + ["exclusive-if-local"], + tags = ["exclusive-if-local"], deps = [ - ":spec_helper", "//rb/lib/selenium/devtools", "//rb/lib/selenium/webdriver:bidi", ], ) -rb_test( +rb_integration_test( name = "driver", - size = "large", srcs = ["driver_spec.rb"], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS, deps = [ - ":spec_helper", "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:edge", "//rb/lib/selenium/webdriver:firefox", @@ -112,16 +89,10 @@ rb_test( ], ) -rb_test( +rb_integration_test( name = "element", - size = "large", srcs = ["element_spec.rb"], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS, deps = [ - ":spec_helper", "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:edge", "//rb/lib/selenium/webdriver:firefox", diff --git a/rb/spec/integration/selenium/webdriver/bidi/BUILD.bazel b/rb/spec/integration/selenium/webdriver/bidi/BUILD.bazel index c443bc7d6936e..4b317a1a7929a 100644 --- a/rb/spec/integration/selenium/webdriver/bidi/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/bidi/BUILD.bazel @@ -1,21 +1,13 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") -load("//rb/spec/integration:configuration.bzl", "ENV", "TAGS") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_integration_test") [ - rb_test( + rb_integration_test( name = file[:-8], - size = "large", srcs = [file], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS + ["exclusive-if-local"], + tags = ["exclusive-if-local"], deps = [ "//rb/lib/selenium/devtools", "//rb/lib/selenium/webdriver:bidi", - "//rb/spec/integration/selenium/webdriver:spec_helper", ], ) for file in glob(["*_spec.rb"]) diff --git a/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel b/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel index c71573164d1f4..d9139a02b74ef 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel @@ -1,21 +1,10 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") -load("//rb/spec/integration:configuration.bzl", "ENV", "TAGS") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_integration_test") [ - rb_test( + rb_integration_test( name = file[:-8], - size = "large", srcs = [file], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS, - deps = [ - "//rb/lib/selenium/webdriver:chrome", - "//rb/spec/integration/selenium/webdriver:spec_helper", - ], + deps = ["//rb/lib/selenium/webdriver:chrome"], ) for file in glob(["*_spec.rb"]) ] diff --git a/rb/spec/integration/selenium/webdriver/edge/BUILD.bazel b/rb/spec/integration/selenium/webdriver/edge/BUILD.bazel index 19d6dbb8530e9..0253733e06441 100644 --- a/rb/spec/integration/selenium/webdriver/edge/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/edge/BUILD.bazel @@ -1,21 +1,10 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") -load("//rb/spec/integration:configuration.bzl", "ENV", "TAGS") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_integration_test") [ - rb_test( + rb_integration_test( name = file[:-8], - size = "large", srcs = [file], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS, - deps = [ - "//rb/lib/selenium/webdriver:edge", - "//rb/spec/integration/selenium/webdriver:spec_helper", - ], + deps = ["//rb/lib/selenium/webdriver:edge"], ) for file in glob(["*_spec.rb"]) ] diff --git a/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel b/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel index 0b756dccf693a..14c80d599aa5b 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel @@ -1,21 +1,10 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") -load("//rb/spec/integration:configuration.bzl", "ENV", "TAGS") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_integration_test") [ - rb_test( + rb_integration_test( name = file[:-8], - size = "large", srcs = [file], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS, - deps = [ - "//rb/lib/selenium/webdriver:firefox", - "//rb/spec/integration/selenium/webdriver:spec_helper", - ], + deps = ["//rb/lib/selenium/webdriver:firefox"], ) for file in glob(["*_spec.rb"]) ] diff --git a/rb/spec/integration/selenium/webdriver/remote/BUILD.bazel b/rb/spec/integration/selenium/webdriver/remote/BUILD.bazel index 1512b64c3c041..7e0376bae6b7f 100644 --- a/rb/spec/integration/selenium/webdriver/remote/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/remote/BUILD.bazel @@ -1,21 +1,10 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") -load("//rb/spec/integration:configuration.bzl", "ENV", "TAGS") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_integration_test") [ - rb_test( + rb_integration_test( name = file[:-8], - size = "large", srcs = [file], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS, - deps = [ - "//rb/lib/selenium/webdriver:remote", - "//rb/spec/integration/selenium/webdriver:spec_helper", - ], + deps = ["//rb/lib/selenium/webdriver:remote"], ) for file in glob(["*_spec.rb"]) ] diff --git a/rb/spec/integration/selenium/webdriver/safari/BUILD.bazel b/rb/spec/integration/selenium/webdriver/safari/BUILD.bazel index 7e1cc0eee67bd..19ca366e44a94 100644 --- a/rb/spec/integration/selenium/webdriver/safari/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/safari/BUILD.bazel @@ -1,21 +1,10 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") -load("//rb/spec/integration:configuration.bzl", "ENV", "TAGS") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_integration_test") [ - rb_test( + rb_integration_test( name = file[:-8], - size = "large", srcs = [file], - args = ["rb/spec/"], - env = ENV, - main = "@bundle//bin:rspec", - tags = TAGS, - deps = [ - "//rb/lib/selenium/webdriver:safari", - "//rb/spec/integration/selenium/webdriver:spec_helper", - ], + deps = ["//rb/lib/selenium/webdriver:safari"], ) for file in glob(["*_spec.rb"]) ] diff --git a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb index e317a6d9e801c..cadaf85d56b89 100644 --- a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb +++ b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb @@ -209,6 +209,7 @@ def chrome_driver(service: nil, **opts) service ||= WebDriver::Service.chrome service.args << '--disable-build-check' if ENV['DISABLE_BUILD_CHECK'] service.args << '--verbose' if WebDriver.logger.debug? + service.executable_path = ENV['CHROMEDRIVER_BINARY'] if ENV.key?('CHROMEDRIVER_BINARY') WebDriver::Driver.for(:chrome, service: service, **opts) end @@ -240,6 +241,8 @@ def safari_preview_driver(**opts) def chrome_options(args: [], **opts) opts[:binary] ||= ENV['CHROME_BINARY'] if ENV.key?('CHROME_BINARY') args << '--headless=chrome' if ENV['HEADLESS'] + args << '--no-sandbox' + args << '--disable-gpu' WebDriver::Options.chrome(browser_version: 'stable', args: args, **opts) end diff --git a/rb/spec/tests.bzl b/rb/spec/tests.bzl new file mode 100644 index 0000000000000..a4a706a5b8633 --- /dev/null +++ b/rb/spec/tests.bzl @@ -0,0 +1,85 @@ +load("@rules_ruby//ruby:defs.bzl", "rb_test") +load("//common:browsers.bzl", "chrome_data") + +ENV = select({ + "//rb/spec/integration:chrome": { + "WD_REMOTE_BROWSER": "chrome", + "WD_SPEC_DRIVER": "chrome", + }, + "//rb/spec/integration:edge": { + "WD_REMOTE_BROWSER": "edge", + "WD_SPEC_DRIVER": "edge", + }, + "//rb/spec/integration:firefox": { + "WD_REMOTE_BROWSER": "firefox", + "WD_SPEC_DRIVER": "firefox", + }, + "//rb/spec/integration:ie": { + "WD_REMOTE_BROWSER": "ie", + "WD_SPEC_DRIVER": "ie", + }, + "//rb/spec/integration:safari": { + "WD_REMOTE_BROWSER": "safari", + "WD_SPEC_DRIVER": "safari", + }, + "//rb/spec/integration:safari-preview": { + "WD_REMOTE_BROWSER": "safari-preview", + "WD_SPEC_DRIVER": "safari-preview", + }, + "//conditions:default": {}, +}) | select({ + "//rb/spec/integration:remote": { + "WD_SPEC_DRIVER": "remote", + }, + "//conditions:default": {}, +}) | select({ + "//rb/spec/integration:headless": { + "HEADLESS": "true", + }, + "//conditions:default": {}, +}) | select({ + "@selenium//common:use_pinned_linux_chrome": { + "CHROME_BINARY": "$(location @linux_chrome//:chrome-linux64/chrome)", + "CHROMEDRIVER_BINARY": "$(location @linux_chromedriver//:chromedriver)", + }, + "@selenium//common:use_pinned_macos_chrome": { + "CHROME_BINARY": "$(location @mac_chrome//:Chrome.app)/Contents/MacOS/Chrome", + "CHROMEDRIVER_BINARY": "$(location @mac_chromedriver//:chromedriver)", + }, + "//conditions:default": {}, +}) + +# We have to use no-sandbox at the moment because Firefox crashes +# when run under sandbox: https://bugzilla.mozilla.org/show_bug.cgi?id=1382498. +# For Chromium-based browser, we can just pass `--no-sandbox` flag. +TAGS = ["no-sandbox"] + +def rb_integration_test(name, srcs, deps, tags = []): + rb_test( + name = name, + size = "large", + srcs = srcs, + args = ["rb/spec/"], + data = chrome_data + ["//common/src/web"], + env = ENV, + main = "@bundle//bin:rspec", + tags = TAGS + tags, + deps = deps + ["//rb/spec/integration/selenium/webdriver:spec_helper"], + visibility = ["//rb:__subpackages__"], + ) + +def rb_unit_test(name, srcs, deps, data = []): + rb_test( + name = name, + size = "small", + srcs = srcs, + args = ["rb/spec/"], + main = "@bundle//bin:rspec", + data = data, + tags = TAGS, + deps = deps + [ + "//rb/spec/unit/selenium/webdriver:spec_helper", + "@bundle", + ], + visibility = ["//rb:__subpackages__"], + ) diff --git a/rb/spec/unit/selenium/BUILD.bazel b/rb/spec/unit/selenium/BUILD.bazel index 470530d1b82f5..c19bda620f7ef 100644 --- a/rb/spec/unit/selenium/BUILD.bazel +++ b/rb/spec/unit/selenium/BUILD.bazel @@ -1,32 +1,20 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") +load("//rb/spec:tests.bzl", "rb_unit_test") -package(default_visibility = ["//rb:__subpackages__"]) - -rb_test( +rb_unit_test( name = "devtools", - size = "small", srcs = ["devtools_spec.rb"], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib:selenium-webdriver", "//rb/lib/selenium:devtools", "//rb/lib/selenium:webdriver", "//rb/lib/selenium/webdriver:atoms", "//rb/lib/selenium/webdriver:common", - "//rb/spec/unit/selenium/webdriver:spec_helper", - "@bundle", ], ) -rb_test( +rb_unit_test( name = "server", - size = "small", srcs = ["server_spec.rb"], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib:selenium-webdriver", "//rb/lib/selenium:devtools", @@ -34,7 +22,5 @@ rb_test( "//rb/lib/selenium:webdriver", "//rb/lib/selenium/webdriver:atoms", "//rb/lib/selenium/webdriver:common", - "//rb/spec/unit/selenium/webdriver:spec_helper", - "@bundle", ], ) diff --git a/rb/spec/unit/selenium/devtools/BUILD.bazel b/rb/spec/unit/selenium/devtools/BUILD.bazel index 9ad623ae8e8f0..8ef72c02667d5 100644 --- a/rb/spec/unit/selenium/devtools/BUILD.bazel +++ b/rb/spec/unit/selenium/devtools/BUILD.bazel @@ -1,21 +1,13 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") +load("//rb/spec:tests.bzl", "rb_unit_test") -package(default_visibility = ["//rb:__subpackages__"]) - -rb_test( +rb_unit_test( name = "cdp_client_generator", - size = "small", srcs = ["cdp_client_generator_spec.rb"], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib:selenium-webdriver", "//rb/lib/selenium:webdriver", "//rb/lib/selenium/devtools:cdp-generate", "//rb/lib/selenium/webdriver:atoms", "//rb/lib/selenium/webdriver:common", - "//rb/spec/unit/selenium/webdriver:spec_helper", - "@bundle", ], ) diff --git a/rb/spec/unit/selenium/webdriver/BUILD.bazel b/rb/spec/unit/selenium/webdriver/BUILD.bazel index 155d2fcc23fa2..2a76a3198091f 100644 --- a/rb/spec/unit/selenium/webdriver/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/BUILD.bazel @@ -1,11 +1,11 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_library", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("@rules_ruby//ruby:defs.bzl", "rb_library") +load("//rb/spec:tests.bzl", "rb_unit_test") rb_library( name = "spec_helper", testonly = True, srcs = ["spec_helper.rb"], + visibility = ["//rb/spec:__subpackages__"], deps = [ "//rb/lib:selenium-webdriver", "//rb/lib/selenium:webdriver", @@ -15,32 +15,20 @@ rb_library( ], ) -rb_test( +rb_unit_test( name = "search_context", - size = "small", srcs = ["search_context_spec.rb"], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ - ":spec_helper", "//rb/lib/selenium/webdriver:common", "//rb/lib/selenium/webdriver:remote", ], ) [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], - deps = [ - ":spec_helper", - "//rb/lib/selenium/webdriver:common", - ], + deps = ["//rb/lib/selenium/webdriver:common"], ) for file in glob( ["*_spec.rb"], diff --git a/rb/spec/unit/selenium/webdriver/chrome/BUILD.bazel b/rb/spec/unit/selenium/webdriver/chrome/BUILD.bazel index 7a9b8ade43d8a..65744c4c82d54 100644 --- a/rb/spec/unit/selenium/webdriver/chrome/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/chrome/BUILD.bazel @@ -1,20 +1,13 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:firefox", "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) for file in glob(["*_spec.rb"]) diff --git a/rb/spec/unit/selenium/webdriver/common/BUILD.bazel b/rb/spec/unit/selenium/webdriver/common/BUILD.bazel index a485063f8f03f..2a48b49fb8d55 100644 --- a/rb/spec/unit/selenium/webdriver/common/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/common/BUILD.bazel @@ -1,19 +1,12 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:common", "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) for file in glob( @@ -26,13 +19,9 @@ package(default_visibility = ["//rb:__subpackages__"]) ) ] -rb_test( +rb_unit_test( name = "driver_finder", - size = "small", srcs = ["driver_finder_spec.rb"], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:common", @@ -41,32 +30,22 @@ rb_test( "//rb/lib/selenium/webdriver:ie", "//rb/lib/selenium/webdriver:remote", "//rb/lib/selenium/webdriver:safari", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) -rb_test( +rb_unit_test( name = "selenium_manager", - size = "small", srcs = ["selenium_manager_spec.rb"], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:common", "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) -rb_test( +rb_unit_test( name = "service", - size = "small", srcs = ["service_spec.rb"], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:common", @@ -75,6 +54,5 @@ rb_test( "//rb/lib/selenium/webdriver:ie", "//rb/lib/selenium/webdriver:remote", "//rb/lib/selenium/webdriver:safari", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) diff --git a/rb/spec/unit/selenium/webdriver/common/interactions/BUILD.bazel b/rb/spec/unit/selenium/webdriver/common/interactions/BUILD.bazel index 7fac1393c877f..812e5236fa39d 100644 --- a/rb/spec/unit/selenium/webdriver/common/interactions/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/common/interactions/BUILD.bazel @@ -1,19 +1,12 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:common", "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) for file in glob(["*_spec.rb"]) diff --git a/rb/spec/unit/selenium/webdriver/devtools/BUILD.bazel b/rb/spec/unit/selenium/webdriver/devtools/BUILD.bazel index eee8ffb31be9e..7b01c0fc5d000 100644 --- a/rb/spec/unit/selenium/webdriver/devtools/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/devtools/BUILD.bazel @@ -1,19 +1,10 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], - deps = [ - "//rb/lib/selenium/webdriver:bidi", - "//rb/spec/unit/selenium/webdriver:spec_helper", - ], + deps = ["//rb/lib/selenium/webdriver:bidi"], ) for file in glob(["*_spec.rb"]) ] diff --git a/rb/spec/unit/selenium/webdriver/edge/BUILD.bazel b/rb/spec/unit/selenium/webdriver/edge/BUILD.bazel index 57615a1332d6e..0a0ecb3939591 100644 --- a/rb/spec/unit/selenium/webdriver/edge/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/edge/BUILD.bazel @@ -1,20 +1,13 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:edge", "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) for file in glob(["*_spec.rb"]) diff --git a/rb/spec/unit/selenium/webdriver/firefox/BUILD.bazel b/rb/spec/unit/selenium/webdriver/firefox/BUILD.bazel index 12996476d4e1b..bf11bf59032dc 100644 --- a/rb/spec/unit/selenium/webdriver/firefox/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/firefox/BUILD.bazel @@ -1,25 +1,18 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], data = [ "//third_party/firebug:favourite_colour-1.1-an+fx.xpi", "//third_party/firebug:firebug-1.5.0-fx.xpi", "//third_party/firebug:mooltipass-1.1.87.xpi", ], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:firefox", "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) for file in glob(["*_spec.rb"]) diff --git a/rb/spec/unit/selenium/webdriver/ie/BUILD.bazel b/rb/spec/unit/selenium/webdriver/ie/BUILD.bazel index 003a684fba0b0..5aa5e783acf53 100644 --- a/rb/spec/unit/selenium/webdriver/ie/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/ie/BUILD.bazel @@ -1,20 +1,13 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:ie", "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) for file in glob(["*_spec.rb"]) diff --git a/rb/spec/unit/selenium/webdriver/remote/BUILD.bazel b/rb/spec/unit/selenium/webdriver/remote/BUILD.bazel index 7a9b8ade43d8a..65744c4c82d54 100644 --- a/rb/spec/unit/selenium/webdriver/remote/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/remote/BUILD.bazel @@ -1,20 +1,13 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:firefox", "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) for file in glob(["*_spec.rb"]) diff --git a/rb/spec/unit/selenium/webdriver/remote/http/BUILD.bazel b/rb/spec/unit/selenium/webdriver/remote/http/BUILD.bazel index 3e9755d59a574..27a75218474a1 100644 --- a/rb/spec/unit/selenium/webdriver/remote/http/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/remote/http/BUILD.bazel @@ -1,19 +1,10 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], - deps = [ - "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", - ], + deps = ["//rb/lib/selenium/webdriver:remote"], ) for file in glob(["*_spec.rb"]) ] diff --git a/rb/spec/unit/selenium/webdriver/safari/BUILD.bazel b/rb/spec/unit/selenium/webdriver/safari/BUILD.bazel index ecc2a765a1982..d54404ec4b08c 100644 --- a/rb/spec/unit/selenium/webdriver/safari/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/safari/BUILD.bazel @@ -1,20 +1,13 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") - -package(default_visibility = ["//rb:__subpackages__"]) +load("//rb/spec:tests.bzl", "rb_unit_test") [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:chrome", "//rb/lib/selenium/webdriver:remote", "//rb/lib/selenium/webdriver:safari", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) for file in glob(["*_spec.rb"]) diff --git a/rb/spec/unit/selenium/webdriver/support/BUILD.bazel b/rb/spec/unit/selenium/webdriver/support/BUILD.bazel index 7fac1393c877f..e1d58c79a21cd 100644 --- a/rb/spec/unit/selenium/webdriver/support/BUILD.bazel +++ b/rb/spec/unit/selenium/webdriver/support/BUILD.bazel @@ -1,19 +1,14 @@ -load("@rules_ruby//ruby:defs.bzl", "rb_test") +load("//rb/spec:tests.bzl", "rb_unit_test") package(default_visibility = ["//rb:__subpackages__"]) [ - rb_test( + rb_unit_test( name = file[:-8], - size = "small", srcs = [file], - args = ["rb/spec/"], - main = "@bundle//bin:rspec", - tags = ["no-sandbox"], deps = [ "//rb/lib/selenium/webdriver:common", "//rb/lib/selenium/webdriver:remote", - "//rb/spec/unit/selenium/webdriver:spec_helper", ], ) for file in glob(["*_spec.rb"]) diff --git a/scripts/github-actions/ci-build.sh b/scripts/github-actions/ci-build.sh index a7782c06d6d9e..e461291b84b15 100755 --- a/scripts/github-actions/ci-build.sh +++ b/scripts/github-actions/ci-build.sh @@ -20,7 +20,12 @@ bazel test --config=remote-ci --build_tests_only \ //java/... \ //javascript/atoms/... //javascript/webdriver/... \ //py/... \ - //rb/spec/unit/... -- $(cat .skipped-tests | tr '\n' ' ') + //rb/spec/... -- $(cat .skipped-tests | tr '\n' ' ') # Build the packages we want to ship to users -bazel build --config=remote-ci //dotnet:all java/src/... //javascript/node/selenium-webdriver:selenium-webdriver //py:selenium-wheel +bazel build --config=remote-ci \ + //dotnet:all \ + //java/src/... \ + //javascript/node/selenium-webdriver:selenium-webdriver \ + //py:selenium-wheel \ + //rb:selenium-devtools //rb:selenium-webdriver