penpotqa/tests/performance/thumbnail.spec.js
stanislavchalapko d8228410c2 added light mode tests
test fixes
2024-01-09 21:50:16 +02:00

29 lines
1.0 KiB
JavaScript

import { expect } from '@playwright/test';
import { performanceTest } from '../../fixtures.js';
import { PerformancePage } from '../../pages/performance-page';
performanceTest('PERF Thumbnail renderer', async ({ page }) => {
const performancePage = new PerformancePage(page);
await performancePage.setup();
// TODO: Medir el tiempo que tarda en renderizar el thumbnail.
const content = page.locator('.frame-container > .frame-content');
await content.waitFor();
performance.mark('imposter:start');
const imposter = page.locator('.frame-container > .frame-imposter');
await imposter.waitFor();
performance.mark('imposter:end');
const measure = performance.measure('imposter', 'imposter:start', 'imposter:end');
console.log(measure.duration, measure.entryType, measure.name);
const [averageFrameRate, averageLongTaskDuration] =
await performancePage.measure();
expect(averageFrameRate).toBeGreaterThan(55);
expect(averageFrameRate).toBeLessThan(65);
expect(averageLongTaskDuration).toBeLessThan(0.5);
});