Andrew Bonventre | ba69835 | 2015-11-04 11:14:54 -0500 | [diff] [blame] | 1 | # PolyGerrit |
| 2 | |
Dave Borowitz | c89f64c | 2015-11-23 14:59:24 -0500 | [diff] [blame] | 3 | ## Installing [Node.js](https://nodejs.org/en/download/) |
| 4 | |
| 5 | ```sh |
| 6 | # Debian/Ubuntu |
| 7 | sudo apt-get install nodejs-legacy |
| 8 | |
| 9 | # OS X with Homebrew |
| 10 | brew install node |
| 11 | ``` |
| 12 | |
| 13 | All other platforms: [download from |
| 14 | nodejs.org](https://nodejs.org/en/download/). |
| 15 | |
Han-Wen Nienhuys | ceb5db0 | 2016-03-29 18:56:38 +0200 | [diff] [blame] | 16 | ## Optional: installing [go](https://golang.org/) |
Eryk Szymanski | d08bb71 | 2016-03-17 15:13:32 +0100 | [diff] [blame] | 17 | |
| 18 | This is only required for running the ```run-server.sh``` script for testing. See below. |
| 19 | |
| 20 | ```sh |
| 21 | # Debian/Ubuntu |
| 22 | sudo apt-get install golang |
| 23 | |
| 24 | # OS X with Homebrew |
| 25 | brew install go |
| 26 | ``` |
| 27 | |
Han-Wen Nienhuys | ceb5db0 | 2016-03-29 18:56:38 +0200 | [diff] [blame] | 28 | All other platforms: [download from golang.org](https//golang.org/) |
Eryk Szymanski | d08bb71 | 2016-03-17 15:13:32 +0100 | [diff] [blame] | 29 | |
| 30 | # Add [go] to your path |
| 31 | |
| 32 | ``` |
| 33 | PATH=$PATH:/usr/local/go/bin |
| 34 | ``` |
| 35 | |
Dave Borowitz | 3232f85 | 2015-11-18 08:21:49 -0500 | [diff] [blame] | 36 | ## Local UI, Production Data |
| 37 | |
| 38 | To test the local UI against gerrit-review.googlesource.com: |
Andrew Bonventre | ba69835 | 2015-11-04 11:14:54 -0500 | [diff] [blame] | 39 | |
| 40 | ```sh |
Han-Wen Nienhuys | ceb5db0 | 2016-03-29 18:56:38 +0200 | [diff] [blame] | 41 | ./polygerrit-ui/run-server.sh |
Andrew Bonventre | ba69835 | 2015-11-04 11:14:54 -0500 | [diff] [blame] | 42 | ``` |
| 43 | |
| 44 | Then visit http://localhost:8081 |
Dave Borowitz | 3232f85 | 2015-11-18 08:21:49 -0500 | [diff] [blame] | 45 | |
| 46 | ## Local UI, Test Data |
| 47 | |
| 48 | One-time setup: |
| 49 | |
| 50 | 1. [Install Buck](https://gerrit-review.googlesource.com/Documentation/dev-buck.html#_installation) |
| 51 | for building Gerrit. |
| 52 | 2. [Build Gerrit](https://gerrit-review.googlesource.com/Documentation/dev-buck.html#_gerrit_development_war_file) |
| 53 | and set up a [local test site](https://gerrit-review.googlesource.com/Documentation/dev-readme.html#init). |
| 54 | |
| 55 | Run a test server: |
| 56 | |
| 57 | ```sh |
| 58 | buck build polygerrit && \ |
Dave Borowitz | 4127275 | 2015-11-23 13:04:43 -0500 | [diff] [blame] | 59 | java -jar buck-out/gen/polygerrit/polygerrit.war daemon --polygerrit-dev -d ../gerrit_testsite --console-log --show-stack-trace |
Dave Borowitz | 3232f85 | 2015-11-18 08:21:49 -0500 | [diff] [blame] | 60 | ``` |
| 61 | |
| 62 | ## Running Tests |
| 63 | |
Dave Borowitz | c89f64c | 2015-11-23 14:59:24 -0500 | [diff] [blame] | 64 | One-time setup: |
| 65 | |
Dave Borowitz | 3232f85 | 2015-11-18 08:21:49 -0500 | [diff] [blame] | 66 | ```sh |
Dave Borowitz | c89f64c | 2015-11-23 14:59:24 -0500 | [diff] [blame] | 67 | # Debian/Ubuntu |
| 68 | sudo apt-get install npm |
| 69 | |
| 70 | # OS X with Homebrew |
| 71 | brew install npm |
| 72 | |
| 73 | # All platforms (including those above) |
| 74 | sudo npm install -g web-component-tester |
| 75 | ``` |
| 76 | |
| 77 | Run all web tests: |
| 78 | |
| 79 | ```sh |
Han-Wen Nienhuys | b8fa071 | 2016-03-15 19:08:14 +0100 | [diff] [blame] | 80 | buck test --no-results-cache --include web |
Dave Borowitz | c89f64c | 2015-11-23 14:59:24 -0500 | [diff] [blame] | 81 | ``` |
| 82 | |
Han-Wen Nienhuys | b8fa071 | 2016-03-15 19:08:14 +0100 | [diff] [blame] | 83 | The `--no-results-cache` flag prevents flaky test failures from being |
| 84 | cached. |
| 85 | |
Dave Borowitz | c89f64c | 2015-11-23 14:59:24 -0500 | [diff] [blame] | 86 | If you need to pass additional arguments to `wct`: |
| 87 | |
| 88 | ```sh |
| 89 | WCT_ARGS='-p --some-flag="foo bar"' buck test --no-results-cache --include web |
Dave Borowitz | 3232f85 | 2015-11-18 08:21:49 -0500 | [diff] [blame] | 90 | ``` |
David Ostrovsky | 9ac674d | 2016-02-12 21:54:38 +0100 | [diff] [blame] | 91 | |
Han-Wen Nienhuys | ceb5db0 | 2016-03-29 18:56:38 +0200 | [diff] [blame] | 92 | For interactively working on a single test file, do the following: |
| 93 | |
| 94 | ```sh |
| 95 | ./polygerrit-ui/run-server.sh |
| 96 | ``` |
| 97 | |
| 98 | Then visit http://localhost:8081/elements/foo/bar_test.html |
| 99 | |
David Ostrovsky | 9ac674d | 2016-02-12 21:54:38 +0100 | [diff] [blame] | 100 | ## Style guide |
| 101 | |
| 102 | We follow the [Google JavaScript Style Guide](https://google.github.io/styleguide/javascriptguide.xml) |
| 103 | with a few exceptions. When in doubt, remain consistent with the code around you. |