Install npm-packages before running polygerrit tests

The PolyGerrit tests during the Gerrit-verifier-bazel job failed,
because some npm-packages were not found. Since recently these packages
were meant to be installed to the local workspace during the job run,
but this was so far only done for Gerrit-codestyle builds.

Since these tests are also run in the Gerrit-bazel-{branch}-jobs,
the build step installing the packages is now also performed in these
jobs.

Change-Id: I25053488740131450e0f5ee36149aafe1a6f2d3a
diff --git a/jenkins/gerrit-bazel-test.sh b/jenkins/gerrit-bazel-test.sh
index a7d5563..9b11f38 100755
--- a/jenkins/gerrit-bazel-test.sh
+++ b/jenkins/gerrit-bazel-test.sh
@@ -3,6 +3,9 @@
 cd gerrit
 . set-java.sh 8
 
+echo 'Installing required npm packages...'
+yarn install --offline || yarn install
+
 export BAZEL_OPTS="$BAZEL_OPTS --spawn_strategy=standalone --genrule_strategy=standalone \
                    --test_output errors \
                    --test_summary detailed --flaky_test_attempts 3 \
diff --git a/jenkins/gerrit-bazel-verifier-test.sh b/jenkins/gerrit-bazel-verifier-test.sh
index d74bf34..2bea6fb 100755
--- a/jenkins/gerrit-bazel-verifier-test.sh
+++ b/jenkins/gerrit-bazel-verifier-test.sh
@@ -32,6 +32,9 @@
 
 if [[ "$MODE" == *"polygerrit"* ]]
 then
+  echo 'Installing required npm packages...'
+  yarn install --offline || yarn install
+
   if [ -z "$DISPLAY" ]
   then
     echo 'Not running local tests because env var "DISPLAY" is not set.'