Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed memory leaks in Creator #6047

Merged
merged 24 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions functionalTests/designer/performance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { url, getPagesLength, getQuestionsLength, setJSON, getJSON, getQuestionNameByIndex, getItemValueByIndex, patchDragDropToDisableDrop, RatingToolboxItem, SingleInputToolboxItem, surveySettingsButtonSelector, changeToolboxScrolling, changeToolboxSearchEnabled } from "../helper";
import { Selector, ClientFunction } from "testcafe";
import { large_json } from "./performance_json";
const title = "Performance";

const explicitErrorHandler = () => {
window.addEventListener("error", e => {
if (e.message === "ResizeObserver loop completed with undelivered notifications." ||
e.message === "ResizeObserver loop limit exceeded") {
e.stopImmediatePropagation();
}
});
};

fixture`${title}`.page`${url}`.clientScripts({ content: `(${explicitErrorHandler.toString()})()` }).beforeEach(async (t) => {
await setJSON(large_json);
await t.maximizeWindow();
});

test("Memory leaks between designer/test tabs switch", async (t) => {
const changeTab = ClientFunction((tabName: string) => { window["creator"].activeTab = tabName; });
const getMemory = ClientFunction(() => { return (performance as any).memory.usedJSHeapSize; });

await changeTab("test");
const memory1 = await getMemory();
await changeTab("designer");
await changeTab("test");
const memory2 = await getMemory();

await t.expect((memory2 - memory1) / 1000).lt(1000);
});
Loading
Loading