Skip to content

Commit

Permalink
Merge pull request #7 from penpot/performance-thumbnail-render
Browse files Browse the repository at this point in the history
add imposter performance measures
  • Loading branch information
KateMaruk authored Oct 17, 2023
2 parents 230188f + 626468f commit d38d6d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pages/login-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down
28 changes: 28 additions & 0 deletions tests/performance/thumbnail.spec.js
Original file line number Diff line number Diff line change
@@ -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);
})

0 comments on commit d38d6d7

Please sign in to comment.