add imposter performance measures

This commit is contained in:
AzazelN28 2023-09-12 13:46:41 +02:00
parent e6b0881154
commit 626468f83f
2 changed files with 29 additions and 1 deletions

View File

@ -9,7 +9,7 @@ exports.LoginPage = class LoginPage extends BasePage {
this.pageTitle = page.locator('h1[data-test="login-title"]');
this.emailInput = page.locator("#email");
this.pwdInput = page.locator("#password");
this.loginButton = page.locator('input[name="submit"]');
this.loginButton = page.locator('[data-test="login-submit"]');
this.emailInputError = page.locator(
'div[class=" invalid with-icon custom-input"] #email'
);

View File

@ -0,0 +1,28 @@
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);
})