blob: 0d8f58ff2826f6db1e4b0cebb15764a8b9797fac [file] [log] [blame]
Viktar Donichdbe8aa82017-06-23 16:04:04 -07001#!/bin/sh
2
3set -ex
4
5t=$(mktemp -d || mktemp -d -t wct-XXXXXXXXXX)
6components=$TEST_SRCDIR/gerrit/polygerrit-ui/app/test_components.zip
Ben Rohlfsd2fce8a2019-05-23 14:13:56 +02007code=$TEST_SRCDIR/gerrit/polygerrit-ui/app/pg_code.zip
Viktar Donichdbe8aa82017-06-23 16:04:04 -07008
Ben Rohlfsd2fce8a2019-05-23 14:13:56 +02009echo $t
Viktar Donichdbe8aa82017-06-23 16:04:04 -070010unzip -qd $t $components
11unzip -qd $t $code
Ben Rohlfsd2fce8a2019-05-23 14:13:56 +020012# Purge test/ directory contents coming from pg_code.zip.
13rm -rf $t/test
Viktar Donichdbe8aa82017-06-23 16:04:04 -070014mkdir -p $t/test
Ben Rohlfsd2fce8a2019-05-23 14:13:56 +020015cp $TEST_SRCDIR/gerrit/polygerrit-ui/app/embed/test.html $t/test/
Viktar Donichdbe8aa82017-06-23 16:04:04 -070016
Paladox nonef633e0d2018-01-17 19:23:26 +000017if [ "${WCT_HEADLESS_MODE:-0}" != "0" ]; then
18 CHROME_OPTIONS=[\'start-maximized\',\'headless\',\'disable-gpu\',\'no-sandbox\']
Paladox none703a7e62018-11-17 15:29:45 +000019 FIREFOX_OPTIONS=[\'-headless\']
Paladox nonef633e0d2018-01-17 19:23:26 +000020else
21 CHROME_OPTIONS=[\'start-maximized\']
22 FIREFOX_OPTIONS=[\'\']
23fi
24
Viktar Donichdbe8aa82017-06-23 16:04:04 -070025# For some reason wct tries to install selenium into its node_modules
26# directory on first run. If you've installed into /usr/local and
27# aren't running wct as root, you're screwed. Turning this option off
28# through skipSeleniumInstall seems to still work, so there's that.
29
30# Sauce tests are disabled by default in order to run local tests
31# only. Run it with (saucelabs.com account required; free for open
32# source): WCT_ARGS='--plugin sauce' ./polygerrit-ui/app/embed_test.sh
33
34cat <<EOF > $t/wct.conf.js
35module.exports = {
36 'suites': ['test'],
37 'webserver': {
38 'pathMappings': [
39 {'/components/bower_components': 'bower_components'}
40 ]
41 },
42 'plugins': {
43 'local': {
Paladox nonef633e0d2018-01-17 19:23:26 +000044 'skipSeleniumInstall': true,
45 'browserOptions': {
46 'chrome': ${CHROME_OPTIONS},
47 'firefox': ${FIREFOX_OPTIONS}
48 }
Viktar Donichdbe8aa82017-06-23 16:04:04 -070049 },
50 'sauce': {
51 'disabled': true,
52 'browsers': [
53 'OS X 10.12/chrome',
54 'Windows 10/chrome',
55 'Linux/firefox',
56 'OS X 10.12/safari',
57 'Windows 10/microsoftedge'
58 ]
59 }
60 }
61 };
62EOF
63
Ben Rohlfsd2fce8a2019-05-23 14:13:56 +020064export PATH="$(dirname $NPM):$PATH"
Viktar Donichdbe8aa82017-06-23 16:04:04 -070065
66cd $t
67test -n "${WCT}"
68
Ben Rohlfsd2fce8a2019-05-23 14:13:56 +020069${WCT} ${WCT_ARGS}