Skip to content

Commit

Permalink
Support user journeys for WebPageReplay
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Nov 9, 2023
1 parent 3fc2536 commit 6bbf1cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ jobs:
run: docker run --rm -v "$(pwd)":/sitespeed.io --network=host sitespeedio/sitespeed.io http://127.0.0.1:3001 -n 1 -b edge
- name: Run test on slim container
run: docker run --rm -v "$(pwd)":/sitespeed.io --network=host sitespeedio/sitespeed.io:slim http://127.0.0.1:3001 -n 1 --browsertime.firefox.preference "devtools.netmonitor.persistlog:true"
- name: Test WebPageReplay with Chrome
- name: Test WebPageReplay with Chrome
run: docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/sitespeed.io -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io https://www.sitespeed.io -n 3 -b chrome
- name: Test WebPageReplay user journey with Chrome
run: docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/sitespeed.io -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io test/prepostscripts/multiWindows.cjs -n 1 -b chrome
- name: Test WebPageReplay with Firefox
run: docker run --cap-add=NET_ADMIN --rm -v "$(pwd)":/sitespeed.io --network=host -e REPLAY=true -e LATENCY=100 sitespeedio/sitespeed.io https://www.sitespeed.io -n 3 -b firefox --browsertime.firefox.acceptInsecureCerts true
- name: Run Chrome test with config
Expand Down
17 changes: 14 additions & 3 deletions bin/browsertimeWebPageReplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,18 @@ try {
throw e;
}

async function testURLs(engine, urls) {
async function testURLs(engine, urls, isMulti) {
try {
await engine.start();

if(isMulti) {
const result = await engine.runMultiple(urls);
for (let errors of result[0].errors) {
if (errors.length > 0) {
process.exitCode = 1;
}
}
} else {
for (let url of urls) {
const result = await engine.run(url);
for (let errors of result[0].errors) {
Expand All @@ -47,6 +56,7 @@ async function testURLs(engine, urls) {
}
}
}
}
} finally {
engine.stop();
}
Expand Down Expand Up @@ -203,11 +213,12 @@ async function runBrowsertime() {
);
}
}

const engine = new BrowsertimeEngine(btOptions);
const urls = getURLs(parsed.argv._);
const urls = parsed.argv.multi ? parsed.argv._ : getURLs(parsed.argv._);

try {
await testURLs(engine, urls);
await testURLs(engine, urls, parsed.argv.multi);
} catch (e) {
console.error('Could not run ' + e);
process.exit(1);
Expand Down

0 comments on commit 6bbf1cd

Please sign in to comment.