Skip to content

Instantly share code, notes, and snippets.

@bdekoz
Created February 22, 2019 22:15
Show Gist options
  • Save bdekoz/b5dffa7198d1d8d5e45e5d41c6fc4c47 to your computer and use it in GitHub Desktop.
Save bdekoz/b5dffa7198d1d8d5e45e5d41c6fc4c47 to your computer and use it in GitHub Desktop.
browsertime hacks issue #2
# Invoke like `env ANDROID_SERIAL=... bash one.sh -n 3 -vv https://google.com`.
: PACKAGE ${PACKAGE:=org.mozilla.tv.firefox.gecko.debug}
+ : PACKAGE org.mozilla.tv.firefox.gecko.debug
# : EXTERNAL ${EXTERNAL:=/mnt/sdcard}
: TMP ${TMP:=/tmp}
+ : TMP /tmp
: RESULT_TOP_DIR ${RESULT_TOP_DIR:=browsertime-results}
+ : RESULT_TOP_DIR browsertime-results
: ANDROID_SERIAL ${ANDROID_SERIAL:='172.31.200.28:5555'}
+ : ANDROID_SERIAL 172.31.200.28:5555
export ANDROID_SERIAL
+ export ANDROID_SERIAL
: TURBO ${TURBO:=true false}
+ : TURBO true false
: BROWSER ${BROWSER:=firefox chrome}
+ : BROWSER firefox chrome
URL=${@: -1}
+ URL=-vv
URL=${URL#"https://"}
+ URL=-vv
# N.B.: yargs doesn't parse `--firefox.android.intentArgument --ez`
# properly, so always use `=--ez`!
if [[ $BROWSER == *"firefox"* ]] ; then
for turbo in $TURBO ; do
env RUST_BACKTRACE=1 RUST_LOG=trace bin/browsertime.js \
--android \
--skipHar \
--firefox.geckodriverPath "/home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver" \
--firefox.android.deviceSerial="$ANDROID_SERIAL" \
--firefox.android.package "org.mozilla.tv.firefox.gecko.debug" \
--firefox.android.activity "org.mozilla.tv.firefox.MainActivity" \
--firefox.android.intentArgument=--ez \
--firefox.android.intentArgument=TURBO_MODE \
--firefox.android.intentArgument=$turbo \
--firefox.android.intentArgument=-a \
--firefox.android.intentArgument=android.intent.action.VIEW \
--firefox.android.intentArgument=-d \
--firefox.android.intentArgument="data:," \
--firefox.profileTemplate $TMP/gecko-profile-turbo-$turbo \
--browser firefox \
--resultDir "$RESULT_TOP_DIR/firefox.turbo-$turbo/$URL" \
"$@"
done
fi
+ [[ firefox chrome == *\f\i\r\e\f\o\x* ]]
+ for turbo in $TURBO
+ env RUST_BACKTRACE=1 RUST_LOG=trace bin/browsertime.js --android --skipHar --firefox.geckodriverPath /home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver --firefox.android.deviceSerial=172.31.200.28:5555 --firefox.android.package org.mozilla.tv.firefox.gecko.debug --firefox.android.activity org.mozilla.tv.firefox.MainActivity --firefox.android.intentArgument=--ez --firefox.android.intentArgument=TURBO_MODE --firefox.android.intentArgument=true --firefox.android.intentArgument=-a --firefox.android.intentArgument=android.intent.action.VIEW --firefox.android.intentArgument=-d --firefox.android.intentArgument=data:, --firefox.profileTemplate /tmp/gecko-profile-turbo-true --browser firefox --resultDir browsertime-results/firefox.turbo-true/-vv --preURL https://google.com --preURLDelay 5000 https://twitter.com -n 1 -vv
[2019-02-22 14:15:12] DEBUG: [browsertime] Running with options: {
"scripts": [],
"iterations": 1,
"delay": 0,
"videoParams": {
"addTimer": true,
"debug": false,
"keepOriginalVideo": false,
"filmstripFullSize": false,
"createFilmstrip": true,
"framerate": 30,
"crf": 23,
"filmstripQuality": 75,
"nice": 0
},
"_": [
"https://twitter.com"
],
"video-params": {
"add-timer": true,
"debug": false,
"keep-original-video": false,
"filmstrip-full-size": false,
"create-filmstrip": true,
"framerate": 30,
"crf": 23,
"filmstrip-quality": 75,
"nice": 0
},
"android": true,
"screenshot": false,
"pageCompleteCheckInactivity": false,
"page-complete-check-inactivity": false,
"prettyPrint": false,
"pretty-print": false,
"connectivity": {
"throttle": {
"localhost": false
},
"profile": "native",
"engine": "external"
},
"cacheClearRaw": false,
"cache-clear-raw": false,
"xvfb": false,
"headless": false,
"spa": false,
"skipHar": true,
"skip-har": true,
"firefox": {
"geckodriverPath": "/home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver",
"geckodriver-path": "/home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver",
"android": {
"deviceSerial": "172.31.200.28:5555",
"device-serial": "172.31.200.28:5555",
"package": "org.mozilla.tv.firefox.gecko.debug",
"activity": "org.mozilla.tv.firefox.MainActivity",
"intentArgument": [
"--ez",
"TURBO_MODE",
"true",
"-a",
"android.intent.action.VIEW",
"-d",
"data:,"
],
"intent-argument": [
"--ez",
"TURBO_MODE",
"true",
"-a",
"android.intent.action.VIEW",
"-d",
"data:,"
]
},
"profileTemplate": "/tmp/gecko-profile-turbo-true",
"profile-template": "/tmp/gecko-profile-turbo-true",
"includeResponseBodies": "none",
"include-response-bodies": "none"
},
"browser": "firefox",
"b": "firefox",
"resultDir": "browsertime-results/firefox.turbo-true/-vv",
"result-dir": "browsertime-results/firefox.turbo-true/-vv",
"preURL": "https://google.com",
"pre-url": "https://google.com",
"preURLDelay": 5000,
"pre-url-delay": 5000,
"n": 1,
"v": 2,
"verbose": 2,
"timeouts": {
"browserStart": 60000,
"browser-start": 60000,
"pageLoad": 300000,
"page-load": 300000,
"script": 80000,
"pageCompleteCheck": 300000,
"page-complete-check": 300000
},
"screenshotParams": {
"type": "jpg",
"png": {
"compressionLevel": 6
},
"jpg": {
"quality": 80
},
"maxSize": 2000
},
"screenshot-params": {
"type": "jpg",
"png": {
"compression-level": 6
},
"jpg": {
"quality": 80
},
"max-size": 2000
},
"pageCompleteWaitTime": 5000,
"page-complete-wait-time": 5000,
"c": "native",
"percentiles": [
0,
10,
90,
99,
100
],
"decimals": 0,
"xvfbParams": {
"display": 99
},
"xvfb-params": {
"display": 99
},
"silent": 0,
"q": 0,
"$0": "bin/browsertime.js"
}
[2019-02-22 14:15:12] INFO: [browsertime] Running tests using Firefox - 1 iteration(s)
[2019-02-22 14:15:12] INFO: [browsertime] Browser failed to start, trying one more time: The specified executable path does not exist: /home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver
[2019-02-22 14:15:12] INFO: [browsertime] Browser failed to start, trying one more time: The specified executable path does not exist: /home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver
[2019-02-22 14:15:12] INFO: [browsertime] Browser failed to start, trying one more time: The specified executable path does not exist: /home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver
[2019-02-22 14:15:12] ERROR: [browsertime] BrowserError: Could not start the browser with 3 tries
at SeleniumRunner.start (/home/bkoz/src/browsertime-ncalexan-branch.git/lib/core/seleniumRunner.js:82:13)
[2019-02-22 14:15:12] INFO: [browsertime] Wrote data to browsertime-results/firefox.turbo-true/-vv
[2019-02-22 14:15:12] DEBUG: [browsertime] Stopping Browsertime
[2019-02-22 14:15:12] DEBUG: [browsertime] Stopped Browsertime
+ for turbo in $TURBO
+ env RUST_BACKTRACE=1 RUST_LOG=trace bin/browsertime.js --android --skipHar --firefox.geckodriverPath /home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver --firefox.android.deviceSerial=172.31.200.28:5555 --firefox.android.package org.mozilla.tv.firefox.gecko.debug --firefox.android.activity org.mozilla.tv.firefox.MainActivity --firefox.android.intentArgument=--ez --firefox.android.intentArgument=TURBO_MODE --firefox.android.intentArgument=false --firefox.android.intentArgument=-a --firefox.android.intentArgument=android.intent.action.VIEW --firefox.android.intentArgument=-d --firefox.android.intentArgument=data:, --firefox.profileTemplate /tmp/gecko-profile-turbo-false --browser firefox --resultDir browsertime-results/firefox.turbo-false/-vv --preURL https://google.com --preURLDelay 5000 https://twitter.com -n 1 -vv
[2019-02-22 14:15:13] DEBUG: [browsertime] Running with options: {
"scripts": [],
"iterations": 1,
"delay": 0,
"videoParams": {
"addTimer": true,
"debug": false,
"keepOriginalVideo": false,
"filmstripFullSize": false,
"createFilmstrip": true,
"framerate": 30,
"crf": 23,
"filmstripQuality": 75,
"nice": 0
},
"_": [
"https://twitter.com"
],
"video-params": {
"add-timer": true,
"debug": false,
"keep-original-video": false,
"filmstrip-full-size": false,
"create-filmstrip": true,
"framerate": 30,
"crf": 23,
"filmstrip-quality": 75,
"nice": 0
},
"android": true,
"screenshot": false,
"pageCompleteCheckInactivity": false,
"page-complete-check-inactivity": false,
"prettyPrint": false,
"pretty-print": false,
"connectivity": {
"throttle": {
"localhost": false
},
"profile": "native",
"engine": "external"
},
"cacheClearRaw": false,
"cache-clear-raw": false,
"xvfb": false,
"headless": false,
"spa": false,
"skipHar": true,
"skip-har": true,
"firefox": {
"geckodriverPath": "/home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver",
"geckodriver-path": "/home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver",
"android": {
"deviceSerial": "172.31.200.28:5555",
"device-serial": "172.31.200.28:5555",
"package": "org.mozilla.tv.firefox.gecko.debug",
"activity": "org.mozilla.tv.firefox.MainActivity",
"intentArgument": [
"--ez",
"TURBO_MODE",
"false",
"-a",
"android.intent.action.VIEW",
"-d",
"data:,"
],
"intent-argument": [
"--ez",
"TURBO_MODE",
"false",
"-a",
"android.intent.action.VIEW",
"-d",
"data:,"
]
},
"profileTemplate": "/tmp/gecko-profile-turbo-false",
"profile-template": "/tmp/gecko-profile-turbo-false",
"includeResponseBodies": "none",
"include-response-bodies": "none"
},
"browser": "firefox",
"b": "firefox",
"resultDir": "browsertime-results/firefox.turbo-false/-vv",
"result-dir": "browsertime-results/firefox.turbo-false/-vv",
"preURL": "https://google.com",
"pre-url": "https://google.com",
"preURLDelay": 5000,
"pre-url-delay": 5000,
"n": 1,
"v": 2,
"verbose": 2,
"timeouts": {
"browserStart": 60000,
"browser-start": 60000,
"pageLoad": 300000,
"page-load": 300000,
"script": 80000,
"pageCompleteCheck": 300000,
"page-complete-check": 300000
},
"screenshotParams": {
"type": "jpg",
"png": {
"compressionLevel": 6
},
"jpg": {
"quality": 80
},
"maxSize": 2000
},
"screenshot-params": {
"type": "jpg",
"png": {
"compression-level": 6
},
"jpg": {
"quality": 80
},
"max-size": 2000
},
"pageCompleteWaitTime": 5000,
"page-complete-wait-time": 5000,
"c": "native",
"percentiles": [
0,
10,
90,
99,
100
],
"decimals": 0,
"xvfbParams": {
"display": 99
},
"xvfb-params": {
"display": 99
},
"silent": 0,
"q": 0,
"$0": "bin/browsertime.js"
}
[2019-02-22 14:15:13] INFO: [browsertime] Running tests using Firefox - 1 iteration(s)
[2019-02-22 14:15:13] INFO: [browsertime] Browser failed to start, trying one more time: The specified executable path does not exist: /home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver
[2019-02-22 14:15:13] INFO: [browsertime] Browser failed to start, trying one more time: The specified executable path does not exist: /home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver
[2019-02-22 14:15:13] INFO: [browsertime] Browser failed to start, trying one more time: The specified executable path does not exist: /home/bkoz/src/mozilla-gecko.target.git/gecko/target/debug/geckodriver
[2019-02-22 14:15:13] ERROR: [browsertime] BrowserError: Could not start the browser with 3 tries
at SeleniumRunner.start (/home/bkoz/src/browsertime-ncalexan-branch.git/lib/core/seleniumRunner.js:82:13)
[2019-02-22 14:15:13] INFO: [browsertime] Wrote data to browsertime-results/firefox.turbo-false/-vv
[2019-02-22 14:15:13] DEBUG: [browsertime] Stopping Browsertime
[2019-02-22 14:15:13] DEBUG: [browsertime] Stopped Browsertime
# N.B.: chromedriver doesn't have an official way to pass intent
# arguments, but it does have an unsanitized injection at
# https://github.com/bayandin/chromedriver/blob/5a2b8f793391c80c9d1a1b0004f28be0a2be9ab2/chrome/adb_impl.cc#L212.
if [[ $BROWSER == *"chrome"* ]] ; then
for turbo in $TURBO ; do
bin/browsertime.js \
--android \
--skipHar \
--chrome.chromedriverPath "/home/bkoz/src/chromedriver" \
--chrome.android.deviceSerial="$ANDROID_SERIAL" \
--chrome.android.package "org.mozilla.tv.firefox.debug" \
--chrome.android.activity="org.mozilla.tv.firefox.MainActivity --ez TURBO_MODE false -a android.intent.action.VIEW" \
--browser chrome \
--resultDir "$RESULT_TOP_DIR/chrome.turbo-$turbo/$URL" \
"$@"
done
fi
+ [[ firefox chrome == *\c\h\r\o\m\e* ]]
+ for turbo in $TURBO
+ bin/browsertime.js --android --skipHar --chrome.chromedriverPath /home/bkoz/src/chromedriver --chrome.android.deviceSerial=172.31.200.28:5555 --chrome.android.package org.mozilla.tv.firefox.debug '--chrome.android.activity=org.mozilla.tv.firefox.MainActivity --ez TURBO_MODE false -a android.intent.action.VIEW' --browser chrome --resultDir browsertime-results/chrome.turbo-true/-vv --preURL https://google.com --preURLDelay 5000 https://twitter.com -n 1 -vv
[2019-02-22 14:15:13] DEBUG: [browsertime] Running with options: {
"scripts": [],
"iterations": 1,
"delay": 0,
"videoParams": {
"addTimer": true,
"debug": false,
"keepOriginalVideo": false,
"filmstripFullSize": false,
"createFilmstrip": true,
"framerate": 30,
"crf": 23,
"filmstripQuality": 75,
"nice": 0
},
"_": [
"https://twitter.com"
],
"video-params": {
"add-timer": true,
"debug": false,
"keep-original-video": false,
"filmstrip-full-size": false,
"create-filmstrip": true,
"framerate": 30,
"crf": 23,
"filmstrip-quality": 75,
"nice": 0
},
"android": true,
"screenshot": false,
"pageCompleteCheckInactivity": false,
"page-complete-check-inactivity": false,
"prettyPrint": false,
"pretty-print": false,
"connectivity": {
"throttle": {
"localhost": false
},
"profile": "native",
"engine": "external"
},
"cacheClearRaw": false,
"cache-clear-raw": false,
"xvfb": false,
"headless": false,
"spa": false,
"skipHar": true,
"skip-har": true,
"chrome": {
"chromedriverPath": "/home/bkoz/src/chromedriver",
"chromedriver-path": "/home/bkoz/src/chromedriver",
"android": {
"deviceSerial": "172.31.200.28:5555",
"device-serial": "172.31.200.28:5555",
"package": "org.mozilla.tv.firefox.debug",
"activity": "org.mozilla.tv.firefox.MainActivity --ez TURBO_MODE false -a android.intent.action.VIEW"
}
},
"browser": "chrome",
"b": "chrome",
"resultDir": "browsertime-results/chrome.turbo-true/-vv",
"result-dir": "browsertime-results/chrome.turbo-true/-vv",
"preURL": "https://google.com",
"pre-url": "https://google.com",
"preURLDelay": 5000,
"pre-url-delay": 5000,
"n": 1,
"v": 2,
"verbose": 2,
"timeouts": {
"browserStart": 60000,
"browser-start": 60000,
"pageLoad": 300000,
"page-load": 300000,
"script": 80000,
"pageCompleteCheck": 300000,
"page-complete-check": 300000
},
"firefox": {
"includeResponseBodies": "none",
"include-response-bodies": "none"
},
"screenshotParams": {
"type": "jpg",
"png": {
"compressionLevel": 6
},
"jpg": {
"quality": 80
},
"maxSize": 2000
},
"screenshot-params": {
"type": "jpg",
"png": {
"compression-level": 6
},
"jpg": {
"quality": 80
},
"max-size": 2000
},
"pageCompleteWaitTime": 5000,
"page-complete-wait-time": 5000,
"c": "native",
"percentiles": [
0,
10,
90,
99,
100
],
"decimals": 0,
"xvfbParams": {
"display": 99
},
"xvfb-params": {
"display": 99
},
"silent": 0,
"q": 0,
"$0": "bin/browsertime.js"
}
[2019-02-22 14:15:13] INFO: [browsertime] Running tests using Chrome - 1 iteration(s)
events.js:167
throw er; // Unhandled 'error' event
^
Error: spawn /home/bkoz/src/chromedriver EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment