blob: 4ec5411405cf2823b1842ae6d3d291612b2cb4f9 [file] [log] [blame] [view]
Andrew Bonventreba698352015-11-04 11:14:54 -05001# PolyGerrit
2
Dave Borowitzc89f64c2015-11-23 14:59:24 -05003## Installing [Node.js](https://nodejs.org/en/download/)
4
5```sh
6# Debian/Ubuntu
7sudo apt-get install nodejs-legacy
8
9# OS X with Homebrew
10brew install node
11```
12
13All other platforms: [download from
14nodejs.org](https://nodejs.org/en/download/).
15
Han-Wen Nienhuysceb5db02016-03-29 18:56:38 +020016## Optional: installing [go](https://golang.org/)
Eryk Szymanskid08bb712016-03-17 15:13:32 +010017
18This is only required for running the ```run-server.sh``` script for testing. See below.
19
20```sh
21# Debian/Ubuntu
22sudo apt-get install golang
23
24# OS X with Homebrew
25brew install go
26```
27
Han-Wen Nienhuysceb5db02016-03-29 18:56:38 +020028All other platforms: [download from golang.org](https//golang.org/)
Eryk Szymanskid08bb712016-03-17 15:13:32 +010029
30# Add [go] to your path
31
32```
33PATH=$PATH:/usr/local/go/bin
34```
35
Dave Borowitz3232f852015-11-18 08:21:49 -050036## Local UI, Production Data
37
38To test the local UI against gerrit-review.googlesource.com:
Andrew Bonventreba698352015-11-04 11:14:54 -050039
40```sh
Han-Wen Nienhuysceb5db02016-03-29 18:56:38 +020041./polygerrit-ui/run-server.sh
Andrew Bonventreba698352015-11-04 11:14:54 -050042```
43
44Then visit http://localhost:8081
Dave Borowitz3232f852015-11-18 08:21:49 -050045
46## Local UI, Test Data
47
48One-time setup:
49
501. [Install Buck](https://gerrit-review.googlesource.com/Documentation/dev-buck.html#_installation)
51 for building Gerrit.
522. [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
55Run a test server:
56
57```sh
58buck build polygerrit && \
Dave Borowitz41272752015-11-23 13:04:43 -050059java -jar buck-out/gen/polygerrit/polygerrit.war daemon --polygerrit-dev -d ../gerrit_testsite --console-log --show-stack-trace
Dave Borowitz3232f852015-11-18 08:21:49 -050060```
61
62## Running Tests
63
Dave Borowitzc89f64c2015-11-23 14:59:24 -050064One-time setup:
65
Dave Borowitz3232f852015-11-18 08:21:49 -050066```sh
Dave Borowitzc89f64c2015-11-23 14:59:24 -050067# Debian/Ubuntu
68sudo apt-get install npm
69
70# OS X with Homebrew
71brew install npm
72
73# All platforms (including those above)
74sudo npm install -g web-component-tester
75```
76
77Run all web tests:
78
79```sh
Han-Wen Nienhuysb8fa0712016-03-15 19:08:14 +010080buck test --no-results-cache --include web
Dave Borowitzc89f64c2015-11-23 14:59:24 -050081```
82
Han-Wen Nienhuysb8fa0712016-03-15 19:08:14 +010083The `--no-results-cache` flag prevents flaky test failures from being
84cached.
85
Dave Borowitzc89f64c2015-11-23 14:59:24 -050086If you need to pass additional arguments to `wct`:
87
88```sh
89WCT_ARGS='-p --some-flag="foo bar"' buck test --no-results-cache --include web
Dave Borowitz3232f852015-11-18 08:21:49 -050090```
David Ostrovsky9ac674d2016-02-12 21:54:38 +010091
Han-Wen Nienhuysceb5db02016-03-29 18:56:38 +020092For interactively working on a single test file, do the following:
93
94```sh
95./polygerrit-ui/run-server.sh
96```
97
98Then visit http://localhost:8081/elements/foo/bar_test.html
99
David Ostrovsky9ac674d2016-02-12 21:54:38 +0100100## Style guide
101
102We follow the [Google JavaScript Style Guide](https://google.github.io/styleguide/javascriptguide.xml)
103with a few exceptions. When in doubt, remain consistent with the code around you.