web-component-tester: Support headless mode
This adds support for running chrome in headless mode. Support for running firefox in headless mode should work but currently doesn't. Moreover, i've added browser option handling to wct [1]. [1]b8388d1a8dBug: Issue 8023 Change-Id: I47cd9cd69fc78739219223c74d7b2edf2f97d6c7 (cherry picked from commitf633e0dcac)
This commit is contained in:
@@ -20,5 +20,6 @@ bazel test \
|
||||
--test_env="WCT_ARGS=${WCT_ARGS}" \
|
||||
--test_env="NPM=${npm_bin}" \
|
||||
--test_env="DISPLAY=${DISPLAY}" \
|
||||
--test_env="WCT_HEADLESS_MODE=${WCT_HEADLESS_MODE}" \
|
||||
"$@" \
|
||||
//polygerrit-ui/app:wct_test
|
||||
|
||||
@@ -12,6 +12,15 @@ unzip -qd $t $code
|
||||
mkdir -p $t/test
|
||||
cp $TEST_SRCDIR/gerrit/polygerrit-ui/app/test/index.html $t/test/
|
||||
|
||||
if [ "${WCT_HEADLESS_MODE:-0}" != "0" ]; then
|
||||
CHROME_OPTIONS=[\'start-maximized\',\'headless\',\'disable-gpu\',\'no-sandbox\']
|
||||
# TODO(paladox): Fix Firefox support for headless mode
|
||||
FIREFOX_OPTIONS=[\'\']
|
||||
else
|
||||
CHROME_OPTIONS=[\'start-maximized\']
|
||||
FIREFOX_OPTIONS=[\'\']
|
||||
fi
|
||||
|
||||
# For some reason wct tries to install selenium into its node_modules
|
||||
# directory on first run. If you've installed into /usr/local and
|
||||
# aren't running wct as root, you're screwed. Turning this option off
|
||||
@@ -31,7 +40,11 @@ module.exports = {
|
||||
},
|
||||
'plugins': {
|
||||
'local': {
|
||||
'skipSeleniumInstall': true
|
||||
'skipSeleniumInstall': true,
|
||||
'browserOptions': {
|
||||
'chrome': ${CHROME_OPTIONS},
|
||||
'firefox': ${FIREFOX_OPTIONS}
|
||||
}
|
||||
},
|
||||
'sauce': {
|
||||
'disabled': true,
|
||||
|
||||
Reference in New Issue
Block a user