From 247a95ffdeee77a7d09b42460a9a7635c206a2f3 Mon Sep 17 00:00:00 2001 From: Nicolas Peltier Date: Fri, 13 Dec 2024 18:00:56 +0100 Subject: [PATCH] bring adjusted limit to nala too --- libs/features/mas/docs/benchmarks.html | 2 ++ nala/features/mas/benchmark/benchmark.test.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/features/mas/docs/benchmarks.html b/libs/features/mas/docs/benchmarks.html index 6ebbaf9668..6d52f5b127 100644 --- a/libs/features/mas/docs/benchmarks.html +++ b/libs/features/mas/docs/benchmarks.html @@ -61,6 +61,8 @@ const previousLimit = limit; if (referentInitialTime < window.initTime) { limit = limit * window.initTime / referentInitialTime; + container.setAttribute('data-benchmark-limit', limit); + container.setAttribute('data-benchmark-previous-limit', previousLimit); console.log(`Adjusted limit ${previousLimit} to ${limit}`); } else { console.log('No need to adjust limit'); diff --git a/nala/features/mas/benchmark/benchmark.test.js b/nala/features/mas/benchmark/benchmark.test.js index a6244c73bb..0f10ae9ae5 100644 --- a/nala/features/mas/benchmark/benchmark.test.js +++ b/nala/features/mas/benchmark/benchmark.test.js @@ -30,6 +30,8 @@ test.describe('Benchmark feature test suite', () => { const benchmark = await benchmarkPage.getBenchmark(selector); await expect(benchmark).toBeVisible(); const limit = await benchmark.getAttribute('data-benchmark-limit'); + const previousLimit = await benchmark.getAttribute('data-benchmark-previous-limit'); + const limitMessage = previousLimit ? `${limit}ms (adjusted from ${previousLimit}ms)` : `${limit}ms`; const masks = await benchmarkPage.getMasks(selector); await expect(await masks.first()).toBeVisible(); const times = await masks.evaluateAll((nodes) => nodes.map((node) => { @@ -41,7 +43,7 @@ test.describe('Benchmark feature test suite', () => { console.log(times); expect(times.length).toBeGreaterThan(0); times.forEach((time) => { - expect(parseFloat(time) < parseFloat(limit), `${time}ms should be less than limit ${limit}ms`).toBeTruthy(); + expect(parseFloat(time) < parseFloat(limit), `${time}ms should be less than limit ${limitMessage}`).toBeTruthy(); }); }); });