Skip to content

Commit

Permalink
[js] Improve atoms loading under Bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Apr 19, 2024
1 parent 9e7adc7 commit c2dda23
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
9 changes: 9 additions & 0 deletions javascript/node/selenium-webdriver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ mocha_test(
size = "small",
chdir = package_name(),
data = [
":node_modules/@bazel/runfiles",
":node_modules/jszip",
":node_modules/mocha",
":node_modules/mocha-junit-reporter",
Expand All @@ -109,6 +110,10 @@ mocha_test(
"//:node_modules/selenium-webdriver",
"//common/extensions:js-lib",
"//common/src/web:js-lib",
"//javascript/node/selenium-webdriver/lib/atoms:find-elements",
"//javascript/node/selenium-webdriver/lib/atoms:get_attribute",
"//javascript/node/selenium-webdriver/lib/atoms:is_displayed",
"//javascript/node/selenium-webdriver/lib/atoms:mutation-listener",
] + SMALL_TESTS + TEST_DATA,
tags = [
"skip-remote",
Expand All @@ -133,6 +138,10 @@ mocha_test(
"//:node_modules/selenium-webdriver",
"//common/extensions:js-lib",
"//common/src/web:js-lib",
"//javascript/node/selenium-webdriver/lib/atoms:find-elements",
"//javascript/node/selenium-webdriver/lib/atoms:get_attribute",
"//javascript/node/selenium-webdriver/lib/atoms:is_displayed",
"//javascript/node/selenium-webdriver/lib/atoms:mutation-listener",
],
env = {
"SELENIUM_BROWSER": browser,
Expand Down
21 changes: 15 additions & 6 deletions javascript/node/selenium-webdriver/lib/atoms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,35 @@ js_binary(
js_run_binary(
name = "is_displayed",
srcs = ["//javascript/atoms/fragments:is-displayed.js"],
args = ["javascript/atoms/fragments/is-displayed.js"],
stdout = "is-displayed.js",
outs = ["is-displayed.js"],
args = [
"$(rootpath //javascript/atoms/fragments:is-displayed.js)",
"$(rootpath :is-displayed.js)",
],
tool = ":make_atoms_module",
visibility = ["//javascript/node/selenium-webdriver:__pkg__"],
)

js_run_binary(
name = "get_attribute",
srcs = ["//javascript/webdriver/atoms:get-attribute.js"],
args = ["javascript/webdriver/atoms/get-attribute.js"],
stdout = "get-attribute.js",
outs = ["get-attribute.js"],
args = [
"$(rootpath //javascript/webdriver/atoms:get-attribute.js)",
"$(rootpath :get-attribute.js)",
],
tool = ":make_atoms_module",
visibility = ["//javascript/node/selenium-webdriver:__pkg__"],
)

js_run_binary(
name = "find-elements",
srcs = ["//javascript/atoms/fragments:find-elements.js"],
args = ["javascript/atoms/fragments/find-elements.js"],
stdout = "find-elements.js",
outs = ["find-elements.js"],
args = [
"$(rootpath //javascript/atoms/fragments:find-elements.js)",
"$(rootpath :find-elements.js)",
],
tool = ":make_atoms_module",
visibility = ["//javascript/node/selenium-webdriver:__pkg__"],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (process.argv.length < 3) {

const buffer = fs.readFileSync(process.argv[2])

process.stdout.write(
fs.writeFileSync(process.argv[3],
`// GENERATED CODE - DO NOT EDIT
module.exports = ${buffer.toString('utf8').trim()};
`,
Expand Down

0 comments on commit c2dda23

Please sign in to comment.