Skip to content

Commit

Permalink
revert profile change
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Sep 19, 2024
1 parent bd13bc8 commit b10de2e
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions packages/rrweb/test/benchmark/dom-mutation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ describe('benchmark: mutation observer', () => {
return fs.readFileSync(filePath, 'utf8');
};

const addRecordingScript = async (page: Page) => {
// const scriptUrl = `${getServerURL(server)}/rrweb-1.1.3.js`;
const scriptUrl = `${getServerURL(server)}/rrweb.umd.cjs`;
await page.evaluate((url) => {
const scriptEl = document.createElement('script');
scriptEl.src = url;
document.head.append(scriptEl);
}, scriptUrl);
await page.waitForFunction('window.rrweb');
};

for (const suite of suites) {
it(suite.title, async () => {
page = await browser.newPage();
Expand All @@ -99,18 +110,12 @@ describe('benchmark: mutation observer', () => {
const loadPage = async () => {
if ('html' in suite) {
await page.goto('about:blank');
const code = fs
.readFileSync(path.resolve(__dirname, '../../dist/rrweb.umd.cjs'))
.toString();
await page.setContent(`<html>
<script>
${code.toString()}
</script>
</html>`);
await page.setContent(getHtml.call(this, suite.html));
} else {
await page.goto(suite.url);
}

await addRecordingScript(page);
};

const getDuration = async (): Promise<number> => {
Expand Down Expand Up @@ -146,9 +151,7 @@ describe('benchmark: mutation observer', () => {
};

// generate profile.json file
const profileFilename = `profile-${
suite.title
}-${new Date().toISOString()}.json`;
const profileFilename = `profile-${new Date().toISOString()}.json`;
const tempDirectory = path.resolve(path.join(__dirname, '../../temp'));
fs.mkdirSync(tempDirectory, { recursive: true });
const profilePath = path.resolve(tempDirectory, profileFilename);
Expand Down

0 comments on commit b10de2e

Please sign in to comment.