From f3081b875a456ec2ecd7fa770bb67776ff3271d0 Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Wed, 12 Nov 2025 20:08:40 +0300 Subject: [PATCH 01/10] add electron launch args --- smoke-test/tests/cypress/integration_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smoke-test/tests/cypress/integration_test.py b/smoke-test/tests/cypress/integration_test.py index b1cfd147fff66..fec057c6d52a3 100644 --- a/smoke-test/tests/cypress/integration_test.py +++ b/smoke-test/tests/cypress/integration_test.py @@ -263,7 +263,8 @@ def test_run_cypress(auth_session): print("Running Cypress tests with command") node_options = "--max-old-space-size=6000" - command = f'NO_COLOR=1 NODE_OPTIONS="{node_options}" npx cypress run {record_arg} {test_spec_arg} {tag_arg} --config numTestsKeptInMemory=2' + electron_args = "ELECTRON_EXTRA_LAUNCH_ARGS=\"--js-flags='--max-old-space-size=4096' --disable-dev-shm-usage --disable-gpu\"" + command = f'{electron_args} NO_COLOR=1 NODE_OPTIONS="{node_options}" npx cypress run {record_arg} {test_spec_arg} {tag_arg} --config numTestsKeptInMemory=2' print(command) # Add --headed --spec '**/mutations/mutations.js' (change spec name) # in case you want to see the browser for debugging From 71c7df666240c2a05c84ac89434d226b4232e253 Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Wed, 12 Nov 2025 20:09:04 +0300 Subject: [PATCH 02/10] add temporary memory logging --- smoke-test/tests/cypress/cypress.config.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/smoke-test/tests/cypress/cypress.config.js b/smoke-test/tests/cypress/cypress.config.js index 1d4d4a5602ad6..ab8b939ef3046 100644 --- a/smoke-test/tests/cypress/cypress.config.js +++ b/smoke-test/tests/cypress/cypress.config.js @@ -16,6 +16,12 @@ module.exports = defineConfig({ // We've imported your old cypress plugins here. // You may want to clean this up later by importing these. setupNodeEvents(on, config) { + // eslint-disable-next-line no-unused-vars + on("after:spec", (spec, results) => { + console.log(`Completed spec: ${spec.relative}`); + console.log(`Memory usage: ${JSON.stringify(process.memoryUsage())}`); + }); + // eslint-disable-next-line global-require return require("./cypress/plugins/index")(on, config); }, From 015e04117d6a553f6a752a5472e9f877157070ab Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Wed, 12 Nov 2025 20:43:47 +0300 Subject: [PATCH 03/10] add additional temporary memory logging --- smoke-test/tests/cypress/cypress/support/e2e.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/smoke-test/tests/cypress/cypress/support/e2e.js b/smoke-test/tests/cypress/cypress/support/e2e.js index 8974faf007429..81d396ac1685b 100644 --- a/smoke-test/tests/cypress/cypress/support/e2e.js +++ b/smoke-test/tests/cypress/cypress/support/e2e.js @@ -39,3 +39,20 @@ beforeEach(function () { } } }); + +afterEach(() => { + cy.window().then((win) => { + if (win.performance && win.performance.memory) { + const mem = win.performance.memory; + const formatBytes = (bytes) => + (bytes / 1024 / 1024 / 1024).toFixed(3) + " GB"; + + cy.log("=== Browser Tab Memory ==="); + cy.log(`Used: ${formatBytes(mem.usedJSHeapSize)}`); + cy.log(`Total: ${formatBytes(mem.totalJSHeapSize)}`); + cy.log(`Limit: ${formatBytes(mem.jsHeapSizeLimit)}`); + } else { + cy.log("Browser memory API not available"); + } + }); +}); From 14cd3673a3fb9d4a09958e4e35528f5b119be13c Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Wed, 12 Nov 2025 21:02:11 +0300 Subject: [PATCH 04/10] adjust config and add logs --- smoke-test/tests/cypress/cypress/support/e2e.js | 6 ++++++ smoke-test/tests/cypress/integration_test.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/smoke-test/tests/cypress/cypress/support/e2e.js b/smoke-test/tests/cypress/cypress/support/e2e.js index 81d396ac1685b..77d8ae02a785e 100644 --- a/smoke-test/tests/cypress/cypress/support/e2e.js +++ b/smoke-test/tests/cypress/cypress/support/e2e.js @@ -51,8 +51,14 @@ afterEach(() => { cy.log(`Used: ${formatBytes(mem.usedJSHeapSize)}`); cy.log(`Total: ${formatBytes(mem.totalJSHeapSize)}`); cy.log(`Limit: ${formatBytes(mem.jsHeapSizeLimit)}`); + + console.log("=== Browser Tab Memory ==="); + console.log(`Used: ${formatBytes(mem.usedJSHeapSize)}`); + console.log(`Total: ${formatBytes(mem.totalJSHeapSize)}`); + console.log(`Limit: ${formatBytes(mem.jsHeapSizeLimit)}`); } else { cy.log("Browser memory API not available"); + console.log("Browser memory API not available"); } }); }); diff --git a/smoke-test/tests/cypress/integration_test.py b/smoke-test/tests/cypress/integration_test.py index fec057c6d52a3..1e5a3f2d89d68 100644 --- a/smoke-test/tests/cypress/integration_test.py +++ b/smoke-test/tests/cypress/integration_test.py @@ -262,8 +262,8 @@ def test_run_cypress(auth_session): test_spec_arg = f" --spec '{specs_str}' " print("Running Cypress tests with command") - node_options = "--max-old-space-size=6000" - electron_args = "ELECTRON_EXTRA_LAUNCH_ARGS=\"--js-flags='--max-old-space-size=4096' --disable-dev-shm-usage --disable-gpu\"" + node_options = "--max-old-space-size=500" + electron_args = "ELECTRON_EXTRA_LAUNCH_ARGS=\"--js-flags='--max-old-space-size=9596' --disable-dev-shm-usage --disable-gpu\"" command = f'{electron_args} NO_COLOR=1 NODE_OPTIONS="{node_options}" npx cypress run {record_arg} {test_spec_arg} {tag_arg} --config numTestsKeptInMemory=2' print(command) # Add --headed --spec '**/mutations/mutations.js' (change spec name) From 094eebae710cadcf9c32edb83cb196f115ad2b0d Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Thu, 13 Nov 2025 12:19:28 +0300 Subject: [PATCH 05/10] adjust logging --- smoke-test/tests/cypress/cypress.config.js | 6 --- .../tests/cypress/cypress/plugins/index.js | 3 ++ .../cypress/cypress/plugins/memoryUsage.js | 53 +++++++++++++++++++ .../tests/cypress/cypress/support/e2e.js | 23 +++----- 4 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 smoke-test/tests/cypress/cypress/plugins/memoryUsage.js diff --git a/smoke-test/tests/cypress/cypress.config.js b/smoke-test/tests/cypress/cypress.config.js index ab8b939ef3046..1d4d4a5602ad6 100644 --- a/smoke-test/tests/cypress/cypress.config.js +++ b/smoke-test/tests/cypress/cypress.config.js @@ -16,12 +16,6 @@ module.exports = defineConfig({ // We've imported your old cypress plugins here. // You may want to clean this up later by importing these. setupNodeEvents(on, config) { - // eslint-disable-next-line no-unused-vars - on("after:spec", (spec, results) => { - console.log(`Completed spec: ${spec.relative}`); - console.log(`Memory usage: ${JSON.stringify(process.memoryUsage())}`); - }); - // eslint-disable-next-line global-require return require("./cypress/plugins/index")(on, config); }, diff --git a/smoke-test/tests/cypress/cypress/plugins/index.js b/smoke-test/tests/cypress/cypress/plugins/index.js index 161e6895aa260..c0caf54278914 100644 --- a/smoke-test/tests/cypress/cypress/plugins/index.js +++ b/smoke-test/tests/cypress/cypress/plugins/index.js @@ -20,6 +20,9 @@ module.exports = (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config + // eslint-disable-next-line global-require + require("./memoryUsage")(on); + // eslint-disable-next-line global-require require("cypress-timestamps/plugin")(on); }; diff --git a/smoke-test/tests/cypress/cypress/plugins/memoryUsage.js b/smoke-test/tests/cypress/cypress/plugins/memoryUsage.js new file mode 100644 index 0000000000000..58a5db628876f --- /dev/null +++ b/smoke-test/tests/cypress/cypress/plugins/memoryUsage.js @@ -0,0 +1,53 @@ +/// +// *********************************************************** +// This example plugins/index.js can be used to load plugins +// +// You can change the location of this file or turn off loading +// the plugins file with the 'pluginsFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/plugins-guide +// *********************************************************** + +// This function is called when a project is opened or re-opened (e.g. due to +// the project's config changing) + +/** + * @type {Cypress.PluginConfig} + */ +// eslint-disable-next-line no-unused-vars +module.exports = (on, config) => { + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config + + // Add a task to log to the terminal + on("task", { + logMemoryUsage(browserMemoryUsage) { + const formatBytes = (bytes) => + (bytes / 1024 / 1024 / 1024).toFixed(3) + " GB"; + + if (browserMemoryUsage) { + console.log("=== Browser Tab Memory Usage ==="); + console.log(`Used: ${formatBytes(browserMemoryUsage.usedJSHeapSize)}`); + console.log( + `Total: ${formatBytes(browserMemoryUsage.totalJSHeapSize)}`, + ); + console.log( + `Limit: ${formatBytes(browserMemoryUsage.jsHeapSizeLimit)}`, + ); + } + + const cypressMemoryUsage = process.memoryUsage(); + console.log("=== Cypress Memory Usage ==="); + console.log(`rss: ${formatBytes(cypressMemoryUsage.rss)}`); + console.log(`heapTotal: ${formatBytes(cypressMemoryUsage.heapTotal)}`); + console.log(`heapUsed: ${formatBytes(cypressMemoryUsage.heapUsed)}`); + console.log(`external: ${formatBytes(cypressMemoryUsage.external)}`); + console.log( + `arrayBuffers: ${formatBytes(cypressMemoryUsage.arrayBuffers)}`, + ); + + return null; + }, + }); +}; diff --git a/smoke-test/tests/cypress/cypress/support/e2e.js b/smoke-test/tests/cypress/cypress/support/e2e.js index 77d8ae02a785e..899b402560085 100644 --- a/smoke-test/tests/cypress/cypress/support/e2e.js +++ b/smoke-test/tests/cypress/cypress/support/e2e.js @@ -42,23 +42,12 @@ beforeEach(function () { afterEach(() => { cy.window().then((win) => { - if (win.performance && win.performance.memory) { - const mem = win.performance.memory; - const formatBytes = (bytes) => - (bytes / 1024 / 1024 / 1024).toFixed(3) + " GB"; + const browserMemoryUsage = { + usedJSHeapSize: win.performance?.memory?.usedJSHeapSize, + totalJSHeapSize: win.performance?.memory?.totalJSHeapSize, + jsHeapSizeLimit: win.performance?.memory?.jsHeapSizeLimit, + }; - cy.log("=== Browser Tab Memory ==="); - cy.log(`Used: ${formatBytes(mem.usedJSHeapSize)}`); - cy.log(`Total: ${formatBytes(mem.totalJSHeapSize)}`); - cy.log(`Limit: ${formatBytes(mem.jsHeapSizeLimit)}`); - - console.log("=== Browser Tab Memory ==="); - console.log(`Used: ${formatBytes(mem.usedJSHeapSize)}`); - console.log(`Total: ${formatBytes(mem.totalJSHeapSize)}`); - console.log(`Limit: ${formatBytes(mem.jsHeapSizeLimit)}`); - } else { - cy.log("Browser memory API not available"); - console.log("Browser memory API not available"); - } + cy.task("logMemoryUsage", browserMemoryUsage); }); }); From 6ab5f3a284c1e1a81e33a6238d6a145dff669c6e Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Thu, 13 Nov 2025 13:02:23 +0300 Subject: [PATCH 06/10] experimenting --- smoke-test/tests/cypress/integration_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/smoke-test/tests/cypress/integration_test.py b/smoke-test/tests/cypress/integration_test.py index 1e5a3f2d89d68..5285dbdbe37fb 100644 --- a/smoke-test/tests/cypress/integration_test.py +++ b/smoke-test/tests/cypress/integration_test.py @@ -263,7 +263,9 @@ def test_run_cypress(auth_session): print("Running Cypress tests with command") node_options = "--max-old-space-size=500" - electron_args = "ELECTRON_EXTRA_LAUNCH_ARGS=\"--js-flags='--max-old-space-size=9596' --disable-dev-shm-usage --disable-gpu\"" + electron_args = ( + "ELECTRON_EXTRA_LAUNCH_ARGS=\"--js-flags='--max-old-space-size=4096'\"" + ) command = f'{electron_args} NO_COLOR=1 NODE_OPTIONS="{node_options}" npx cypress run {record_arg} {test_spec_arg} {tag_arg} --config numTestsKeptInMemory=2' print(command) # Add --headed --spec '**/mutations/mutations.js' (change spec name) From 22630fef8b45f8fc6fd1d4ca8d6aef323f9159c4 Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Thu, 13 Nov 2025 13:30:32 +0300 Subject: [PATCH 07/10] experiment 2 --- smoke-test/tests/cypress/integration_test.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/smoke-test/tests/cypress/integration_test.py b/smoke-test/tests/cypress/integration_test.py index 5285dbdbe37fb..2010e0c360f41 100644 --- a/smoke-test/tests/cypress/integration_test.py +++ b/smoke-test/tests/cypress/integration_test.py @@ -263,9 +263,7 @@ def test_run_cypress(auth_session): print("Running Cypress tests with command") node_options = "--max-old-space-size=500" - electron_args = ( - "ELECTRON_EXTRA_LAUNCH_ARGS=\"--js-flags='--max-old-space-size=4096'\"" - ) + electron_args = "ELECTRON_EXTRA_LAUNCH_ARGS=\"--js-flags='--max-old-space-size=4096' --disable-dev-shm-usage\"" command = f'{electron_args} NO_COLOR=1 NODE_OPTIONS="{node_options}" npx cypress run {record_arg} {test_spec_arg} {tag_arg} --config numTestsKeptInMemory=2' print(command) # Add --headed --spec '**/mutations/mutations.js' (change spec name) From 13f88171d0168a8f557b350f11ad86ab1727eaef Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Thu, 13 Nov 2025 13:58:23 +0300 Subject: [PATCH 08/10] experiment 3 --- smoke-test/tests/cypress/integration_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoke-test/tests/cypress/integration_test.py b/smoke-test/tests/cypress/integration_test.py index 2010e0c360f41..efe9ba2629379 100644 --- a/smoke-test/tests/cypress/integration_test.py +++ b/smoke-test/tests/cypress/integration_test.py @@ -263,7 +263,7 @@ def test_run_cypress(auth_session): print("Running Cypress tests with command") node_options = "--max-old-space-size=500" - electron_args = "ELECTRON_EXTRA_LAUNCH_ARGS=\"--js-flags='--max-old-space-size=4096' --disable-dev-shm-usage\"" + electron_args = 'ELECTRON_EXTRA_LAUNCH_ARGS="--js-flags=\'--max-old-space-size=4096 --disable-dev-shm-usage --disable-gpu --no-sandbox"' command = f'{electron_args} NO_COLOR=1 NODE_OPTIONS="{node_options}" npx cypress run {record_arg} {test_spec_arg} {tag_arg} --config numTestsKeptInMemory=2' print(command) # Add --headed --spec '**/mutations/mutations.js' (change spec name) From dad4e512565d9ae393cf683771ab94931b0e1842 Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Thu, 13 Nov 2025 14:09:20 +0300 Subject: [PATCH 09/10] remove copypasted comments ; --- .../cypress/cypress/plugins/memoryUsage.js | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/smoke-test/tests/cypress/cypress/plugins/memoryUsage.js b/smoke-test/tests/cypress/cypress/plugins/memoryUsage.js index 58a5db628876f..d3344b9de8952 100644 --- a/smoke-test/tests/cypress/cypress/plugins/memoryUsage.js +++ b/smoke-test/tests/cypress/cypress/plugins/memoryUsage.js @@ -1,26 +1,9 @@ -/// -// *********************************************************** -// This example plugins/index.js can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - /** * @type {Cypress.PluginConfig} */ // eslint-disable-next-line no-unused-vars module.exports = (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - - // Add a task to log to the terminal + // Add a task to log memory usage to the terminal on("task", { logMemoryUsage(browserMemoryUsage) { const formatBytes = (bytes) => From 67db5bfae4f82daa41e0964f7c2af1db1fa31dbb Mon Sep 17 00:00:00 2001 From: Victor Tarasevich Date: Thu, 13 Nov 2025 16:41:03 +0300 Subject: [PATCH 10/10] rename plugin --- smoke-test/tests/cypress/cypress/plugins/index.js | 2 +- .../cypress/plugins/{memoryUsage.js => memoryUsageLogger.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename smoke-test/tests/cypress/cypress/plugins/{memoryUsage.js => memoryUsageLogger.js} (100%) diff --git a/smoke-test/tests/cypress/cypress/plugins/index.js b/smoke-test/tests/cypress/cypress/plugins/index.js index c0caf54278914..5e3003aa72cd0 100644 --- a/smoke-test/tests/cypress/cypress/plugins/index.js +++ b/smoke-test/tests/cypress/cypress/plugins/index.js @@ -21,7 +21,7 @@ module.exports = (on, config) => { // `config` is the resolved Cypress config // eslint-disable-next-line global-require - require("./memoryUsage")(on); + require("./memoryUsageLogger")(on); // eslint-disable-next-line global-require require("cypress-timestamps/plugin")(on); diff --git a/smoke-test/tests/cypress/cypress/plugins/memoryUsage.js b/smoke-test/tests/cypress/cypress/plugins/memoryUsageLogger.js similarity index 100% rename from smoke-test/tests/cypress/cypress/plugins/memoryUsage.js rename to smoke-test/tests/cypress/cypress/plugins/memoryUsageLogger.js