Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Aug 30, 2024
1 parent 5a4d3cb commit 33ea907
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
10 changes: 8 additions & 2 deletions testrunner/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions testrunner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"bull": "4.15.1",
"nconf": "0.12.1",
"execa": "9.3.0",
"lodash.get": "4.4.2",
"intel": "1.2.0",
"joi" : "17.13.3",
"js-yaml": "4.1.0"
Expand Down
16 changes: 15 additions & 1 deletion testrunner/src/testrunners/testrunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import os from 'node:os';
import { execa } from 'execa';
import log from 'intel';
import nconf from 'nconf';
import get from 'lodash.get';

import { queueHandler } from '../queue/queuehandler.js';
import { getBaseFilePath } from '../util.js';
Expand Down Expand Up @@ -127,16 +128,29 @@ async function runTest(job, workingDirectory, configFileName, logger) {
);

let binary = nconf.get('executable');
let environment = {};
if (
(job.data.extras && job.data.extras.includes('--webpagereplay')) ||
job.data.config.webpagereplay
) {
binary = './wpr/replay.sh';
environment = {
env: {
ANDROID: true
}
};
const deviceId =
get(job.data.config, 'browsertime.firefox.android.deviceSerial') ||
get(job.data.config, 'browsertime.chrome.android.deviceSerial');

if (deviceId) {
environment.env.DEVICE_SERIAL = deviceId;
}
}

let exitCode = 0;
try {
const process = execa(binary, parameters, { env: { ANDROID: true } });
const process = execa(binary, parameters, environment);
process.stdout.on('data', chunk => {
logger.debug(chunk.toString());
job.log(chunk.toString());
Expand Down
8 changes: 5 additions & 3 deletions testrunner/wpr/replay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ then
# Reverse the traffic for the android device back to the computer
adb -s "$DEVICE_SERIAL" reverse tcp:"$WPR_HTTP_PORT" tcp:"$WPR_HTTP_PORT"
adb -s "$DEVICE_SERIAL" reverse tcp:"$WPR_HTTPS_PORT" tcp:"$WPR_HTTPS_PORT"

# Make sure to kill all subprocesses in exit
fi

# Parameters used to start WebPageReplay
Expand Down Expand Up @@ -74,12 +72,16 @@ then
if kill -0 $REPLAY_PID 2>/dev/null; then
kill -2 $REPLAY_PID
wait $REPLAY_PID
exit 0
fi
echo 'Stopped WebPageReplay replay'
else
echo "Replay server didn't start correctly, check the logs $WPR_REPLAY_LOG" >&2
fi
else
echo "Recording or accessing the URL failed, will not replay" >&2
fi

if [ "$RUN_ON_ANDROID" = true ]
then
adb -s "$DEVICE_SERIAL" reverse --remove-all
fi

0 comments on commit 33ea907

Please sign in to comment.