Merge changes Ie3bd69af,Ia74b3013

* changes:
  PolyGerrit: explain how to run a single test file.
  Add support for running (single) tests with 'run-server.sh'
This commit is contained in:
Andrew Bonventre
2016-04-01 15:39:08 +00:00
committed by Gerrit Code Review
5 changed files with 100 additions and 9 deletions

View File

@@ -75,6 +75,30 @@ npm_binary(
# Use the same procedure as for adding dependencies, except just change the
# 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',
@@ -266,6 +290,22 @@ bower_component(
sha1 = '5a68250d6d9abcd576f116dc4fc7312426323883',
)
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',
@@ -328,6 +368,30 @@ bower_component(
sha1 = 'a3b598c06cbd7f441402e666ff748326030905d6',
)
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',
@@ -344,6 +408,25 @@ bower_component(
sha1 = '92f06d8417a51f1f75c94b7a19616e19695cc6db',
)
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',

View File

@@ -13,7 +13,7 @@ brew install node
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 @@ sudo apt-get install golang
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 @@ PATH=$PATH:/usr/local/go/bin
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 @@ If you need to pass additional arguments to `wct`:
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)

View File

@@ -56,6 +56,7 @@ bower_components(
'//polygerrit-ui:polygerrit_components',
'//lib/js:iron-test-helpers',
'//lib/js:test-fixture',
'//lib/js:web-component-tester',
],
)

View File

@@ -23,8 +23,9 @@ if [[ ! -f .buckconfig ]]; then
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 "$@"

View File

@@ -42,8 +42,6 @@ func main() {
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")))
}