Merge changes Ie3bd69af,Ia74b3013
* changes:
PolyGerrit: explain how to run a single test file.
Add support for running (single) tests with 'run-server.sh'
diff --git a/lib/js/BUCK b/lib/js/BUCK
index 282e51e..86d69e6 100644
--- a/lib/js/BUCK
+++ b/lib/js/BUCK
@@ -76,6 +76,30 @@
# version number of the existing bower_component rather than adding a new rule.
bower_component(
+ name = 'accessibility-developer-tools',
+ package = 'accessibility-developer-tools',
+ version = '2.10.0',
+ license = 'DO_NOT_DISTRIBUTE',
+ sha1 = 'bc1a5e56ff1bed7a7a6ef22a4b4e8300e4822aa5',
+)
+
+bower_component(
+ name = 'async',
+ package = 'async',
+ version = '1.5.2',
+ license = 'DO_NOT_DISTRIBUTE',
+ sha1 = '1ec975d3b3834646a7e3d4b7e68118b90ed72508',
+)
+
+bower_component(
+ name = 'chai',
+ package = 'chai',
+ version = '3.5.0',
+ license = 'DO_NOT_DISTRIBUTE',
+ sha1 = '849ad3ee7c77506548b7b5db603a4e150b9431aa',
+)
+
+bower_component(
name = 'fetch',
package = 'fetch',
version = '0.11.0',
@@ -267,6 +291,22 @@
)
bower_component(
+ name = 'lodash',
+ package = 'lodash',
+ version = '3.10.1',
+ license = 'DO_NOT_DISTRIBUTE',
+ sha1 = '2f207a8293c4c554bf6cf071241f7a00dc513d3a',
+)
+
+bower_component(
+ name = 'mocha',
+ package = 'mocha',
+ version = '2.4.5',
+ license = 'DO_NOT_DISTRIBUTE',
+ sha1 = 'efbb1675710c0ba94a44eb7a4d27040229283197',
+)
+
+bower_component(
name = 'moment',
package = 'moment/moment',
version = '2.12.0',
@@ -329,6 +369,30 @@
)
bower_component(
+ name = 'sinon-chai',
+ package = 'sinon-chai',
+ version = '2.8.0',
+ license = 'DO_NOT_DISTRIBUTE',
+ sha1 = '0464b5d944fdf8116bb23e0b02ecfbac945b3517',
+)
+
+bower_component(
+ name = 'sinonjs',
+ package = 'sinonjs',
+ version = '1.17.1',
+ license = 'DO_NOT_DISTRIBUTE',
+ sha1 = 'a26a6aab7358807de52ba738770f6ac709afd240',
+)
+
+bower_component(
+ name = 'stacky',
+ package = 'stacky',
+ version = '1.3.2',
+ license = 'DO_NOT_DISTRIBUTE',
+ sha1 = 'd6c07a0112ab2e9677fe085933744466a89232fb',
+)
+
+bower_component(
name = 'test-fixture',
package = 'polymerelements/test-fixture',
version = '1.1.0',
@@ -345,6 +409,25 @@
)
bower_component(
+ name = 'web-component-tester',
+ package = 'web-component-tester',
+ version = '4.2.2',
+ deps = [
+ ':accessibility-developer-tools',
+ ':async',
+ ':chai',
+ ':lodash',
+ ':mocha',
+ ':sinon-chai',
+ ':sinonjs',
+ ':stacky',
+ ':test-fixture',
+ ],
+ license = 'DO_NOT_DISTRIBUTE',
+ sha1 = '54556000c33d9ed7949aa546c1b4a1531491a5f0',
+)
+
+bower_component(
name = 'webcomponentsjs',
package = 'webcomponentsjs',
version = '0.7.21',
diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md
index bef92b6..4ec5411 100644
--- a/polygerrit-ui/README.md
+++ b/polygerrit-ui/README.md
@@ -13,7 +13,7 @@
All other platforms: [download from
nodejs.org](https://nodejs.org/en/download/).
-## Optional: installing [go] (https://golang.org/)
+## Optional: installing [go](https://golang.org/)
This is only required for running the ```run-server.sh``` script for testing. See below.
@@ -25,7 +25,7 @@
brew install go
```
-All other platforms: [download from golang.org] (https//golang.org/)
+All other platforms: [download from golang.org](https//golang.org/)
# Add [go] to your path
@@ -38,7 +38,7 @@
To test the local UI against gerrit-review.googlesource.com:
```sh
-./run-server.sh
+./polygerrit-ui/run-server.sh
```
Then visit http://localhost:8081
@@ -89,6 +89,14 @@
WCT_ARGS='-p --some-flag="foo bar"' buck test --no-results-cache --include web
```
+For interactively working on a single test file, do the following:
+
+```sh
+./polygerrit-ui/run-server.sh
+```
+
+Then visit http://localhost:8081/elements/foo/bar_test.html
+
## Style guide
We follow the [Google JavaScript Style Guide](https://google.github.io/styleguide/javascriptguide.xml)
diff --git a/polygerrit-ui/app/BUCK b/polygerrit-ui/app/BUCK
index dbc3fee..c4901db 100644
--- a/polygerrit-ui/app/BUCK
+++ b/polygerrit-ui/app/BUCK
@@ -56,6 +56,7 @@
'//polygerrit-ui:polygerrit_components',
'//lib/js:iron-test-helpers',
'//lib/js:test-fixture',
+ '//lib/js:web-component-tester',
],
)
diff --git a/polygerrit-ui/run-server.sh b/polygerrit-ui/run-server.sh
index 70ee3cb..d76f3ba 100755
--- a/polygerrit-ui/run-server.sh
+++ b/polygerrit-ui/run-server.sh
@@ -23,8 +23,9 @@
exit 1
fi
-cd polygerrit-ui
+buck build //polygerrit-ui/app:polygerrit_tests
+cd polygerrit-ui/app
rm -rf bower_components
-buck build //polygerrit-ui:polygerrit_components
-unzip -q ../buck-out/gen/polygerrit-ui/polygerrit_components/polygerrit_components.bower_components.zip
-exec go run server.go
+unzip -q ../../buck-out/gen/polygerrit-ui/app/test_components/test_components.bower_components.zip
+cd ..
+exec go run server.go "$@"
diff --git a/polygerrit-ui/server.go b/polygerrit-ui/server.go
index 59a09b0..66f9e55 100644
--- a/polygerrit-ui/server.go
+++ b/polygerrit-ui/server.go
@@ -42,8 +42,6 @@
if *prod {
http.Handle("/", http.FileServer(http.Dir("dist")))
} else {
- http.Handle("/bower_components/",
- http.StripPrefix("/bower_components/", http.FileServer(http.Dir("bower_components"))))
http.Handle("/", http.FileServer(http.Dir("app")))
}