Skip to content

Commit

Permalink
bring adjusted limit to nala too
Browse files Browse the repository at this point in the history
  • Loading branch information
npeltier committed Dec 13, 2024
1 parent 92e4449 commit 247a95f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libs/features/mas/docs/benchmarks.html
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 3 additions & 1 deletion nala/features/mas/benchmark/benchmark.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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();
});
});
});
Expand Down

0 comments on commit 247a95f

Please sign in to comment.