Viktar Donich | dbe8aa8 | 2017-06-23 16:04:04 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | t=$(mktemp -d || mktemp -d -t wct-XXXXXXXXXX) |
| 6 | components=$TEST_SRCDIR/gerrit/polygerrit-ui/app/test_components.zip |
Ben Rohlfs | d2fce8a | 2019-05-23 14:13:56 +0200 | [diff] [blame] | 7 | code=$TEST_SRCDIR/gerrit/polygerrit-ui/app/pg_code.zip |
Viktar Donich | dbe8aa8 | 2017-06-23 16:04:04 -0700 | [diff] [blame] | 8 | |
Ben Rohlfs | d2fce8a | 2019-05-23 14:13:56 +0200 | [diff] [blame] | 9 | echo $t |
Viktar Donich | dbe8aa8 | 2017-06-23 16:04:04 -0700 | [diff] [blame] | 10 | unzip -qd $t $components |
| 11 | unzip -qd $t $code |
Ben Rohlfs | d2fce8a | 2019-05-23 14:13:56 +0200 | [diff] [blame] | 12 | # Purge test/ directory contents coming from pg_code.zip. |
| 13 | rm -rf $t/test |
Viktar Donich | dbe8aa8 | 2017-06-23 16:04:04 -0700 | [diff] [blame] | 14 | mkdir -p $t/test |
Ben Rohlfs | d2fce8a | 2019-05-23 14:13:56 +0200 | [diff] [blame] | 15 | cp $TEST_SRCDIR/gerrit/polygerrit-ui/app/embed/test.html $t/test/ |
Viktar Donich | dbe8aa8 | 2017-06-23 16:04:04 -0700 | [diff] [blame] | 16 | |
Paladox none | f633e0d | 2018-01-17 19:23:26 +0000 | [diff] [blame] | 17 | if [ "${WCT_HEADLESS_MODE:-0}" != "0" ]; then |
| 18 | CHROME_OPTIONS=[\'start-maximized\',\'headless\',\'disable-gpu\',\'no-sandbox\'] |
Paladox none | 703a7e6 | 2018-11-17 15:29:45 +0000 | [diff] [blame] | 19 | FIREFOX_OPTIONS=[\'-headless\'] |
Paladox none | f633e0d | 2018-01-17 19:23:26 +0000 | [diff] [blame] | 20 | else |
| 21 | CHROME_OPTIONS=[\'start-maximized\'] |
| 22 | FIREFOX_OPTIONS=[\'\'] |
| 23 | fi |
| 24 | |
Viktar Donich | dbe8aa8 | 2017-06-23 16:04:04 -0700 | [diff] [blame] | 25 | # 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 | |
| 34 | cat <<EOF > $t/wct.conf.js |
| 35 | module.exports = { |
| 36 | 'suites': ['test'], |
| 37 | 'webserver': { |
| 38 | 'pathMappings': [ |
| 39 | {'/components/bower_components': 'bower_components'} |
| 40 | ] |
| 41 | }, |
| 42 | 'plugins': { |
| 43 | 'local': { |
Paladox none | f633e0d | 2018-01-17 19:23:26 +0000 | [diff] [blame] | 44 | 'skipSeleniumInstall': true, |
| 45 | 'browserOptions': { |
| 46 | 'chrome': ${CHROME_OPTIONS}, |
| 47 | 'firefox': ${FIREFOX_OPTIONS} |
| 48 | } |
Viktar Donich | dbe8aa8 | 2017-06-23 16:04:04 -0700 | [diff] [blame] | 49 | }, |
| 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 | }; |
| 62 | EOF |
| 63 | |
Ben Rohlfs | d2fce8a | 2019-05-23 14:13:56 +0200 | [diff] [blame] | 64 | export PATH="$(dirname $NPM):$PATH" |
Viktar Donich | dbe8aa8 | 2017-06-23 16:04:04 -0700 | [diff] [blame] | 65 | |
| 66 | cd $t |
| 67 | test -n "${WCT}" |
| 68 | |
Ben Rohlfs | d2fce8a | 2019-05-23 14:13:56 +0200 | [diff] [blame] | 69 | ${WCT} ${WCT_ARGS} |