-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[js] //javascript/node/selenium-webdriver now builds + tests with bazel
- Loading branch information
Showing
33 changed files
with
3,728 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
buck-out | ||
java/client/build | ||
java/server/build | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
filegroup( | ||
name = "license", | ||
srcs = [ | ||
"LICENSE", | ||
"NOTICE", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "npm_package") | ||
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") | ||
|
||
SRC_FILES = [ | ||
"CHANGES.md", | ||
"README.md", | ||
"package.json", | ||
] + glob([ | ||
"*.js", | ||
"example/*.js", | ||
"http/*.js", | ||
"io/*.js", | ||
"lib/*.js", | ||
"net/*.js", | ||
"remote/*.js", | ||
"testing/*.js", | ||
]) | ||
|
||
npm_package( | ||
name = "selenium-webdriver", | ||
srcs = SRC_FILES, | ||
deps = [ | ||
":license", | ||
"//javascript/node/selenium-webdriver/lib/atoms:get_attribute", | ||
"//javascript/node/selenium-webdriver/lib/atoms:is_displayed", | ||
], | ||
) | ||
|
||
TEST_FILES = glob(["test/**/*_test.js"]) | ||
|
||
TEST_DATA = SRC_FILES + glob( | ||
[ | ||
"lib/test/**", | ||
"test/**", | ||
], | ||
exclude = TEST_FILES, | ||
) | ||
|
||
nodejs_binary( | ||
name = "fileserver", | ||
data = TEST_DATA + [ | ||
"//common/src/web", | ||
"@npm//express", | ||
"@npm//multer", | ||
"@npm//serve-index", | ||
"@npm//tmp", | ||
"@npm//jszip", | ||
"@npm//rimraf", | ||
"//javascript/node/selenium-webdriver/lib/atoms:get_attribute", | ||
"//javascript/node/selenium-webdriver/lib/atoms:is_displayed", | ||
], | ||
entry_point = "selenium/javascript/node/selenium-webdriver/lib/test/fileserver.js", | ||
) | ||
|
||
jasmine_node_test( | ||
name = "tests", | ||
local = True, | ||
srcs = TEST_FILES, | ||
bootstrap = ["selenium/javascript/node/selenium-webdriver/tools/init_jasmine.js"], | ||
data = TEST_DATA + [ | ||
"tools/init_jasmine.js", | ||
"//common/src/web", | ||
"@npm//express", | ||
"@npm//multer", | ||
"@npm//serve-index", | ||
"@npm//jszip", | ||
"@npm//rimraf", | ||
"@npm//tmp", | ||
"@npm//sinon", | ||
"@npm//xml2js", | ||
], | ||
deps = [ | ||
"//javascript/node/selenium-webdriver/lib/atoms:get_attribute", | ||
"//javascript/node/selenium-webdriver/lib/atoms:is_displayed", | ||
"@npm//jasmine", | ||
], | ||
) | ||
|
||
# npm_package does not pick up filegroup sources. | ||
genrule( | ||
name = "license", | ||
srcs = ["//:license"], | ||
outs = [ | ||
"LICENSE", | ||
"NOTICE", | ||
], | ||
cmd = "cp $(locations //:license) $(@D)", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary") | ||
|
||
nodejs_binary( | ||
name = "make_atoms_module", | ||
data = ["make-atoms-module.js"], | ||
entry_point = "selenium/javascript/node/selenium-webdriver/lib/atoms/make-atoms-module", | ||
) | ||
|
||
# genrules used to copy closure_js_binary outputs to locations | ||
# that will be picked up by the npm_package rule. | ||
|
||
genrule( | ||
name = "is_displayed", | ||
srcs = ["//javascript/atoms/fragments:is-displayed.js"], | ||
outs = ["is-displayed.js"], | ||
tools = [":make_atoms_module"], | ||
cmd = "$(location :make_atoms_module) $< $@", | ||
visibility = ["//javascript/node/selenium-webdriver:__pkg__"], | ||
) | ||
|
||
genrule( | ||
name = "get_attribute", | ||
srcs = ["//javascript/webdriver/atoms:get-attribute.js"], | ||
outs = ["get-attribute.js"], | ||
tools = [":make_atoms_module"], | ||
cmd = "$(location :make_atoms_module) $< $@", | ||
visibility = ["//javascript/node/selenium-webdriver:__pkg__"], | ||
) | ||
|
12 changes: 12 additions & 0 deletions
12
javascript/node/selenium-webdriver/lib/atoms/make-atoms-module.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
if (process.argv.length < 3) { | ||
process.stderr.write(`Usage: node ${path.basename(__filename)} <src file> <dst file>\n`); | ||
process.exit(-1); | ||
} | ||
|
||
const buffer = fs.readFileSync(process.argv[2]); | ||
fs.writeFileSync(process.argv[3], `// GENERATED CODE - DO NOT EDIT | ||
module.exports = ${buffer.toString('utf8').trim()}; | ||
`); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.