Fix failing performance and unit tests
CI Pipeline / test (18) (pull_request) Failing after 3m29s
CI Pipeline / test (20) (pull_request) Failing after 4m23s
CI Pipeline / e2e (chromium) (pull_request) Successful in 3m0s
CI Pipeline / e2e (firefox) (pull_request) Successful in 5m45s
CI Pipeline / e2e (webkit) (pull_request) Successful in 4m22s
CI Pipeline / performance (pull_request) Successful in 4m0s
CI Pipeline / storybook (pull_request) Successful in 1m20s
CI Pipeline / visual-regression (pull_request) Successful in 6m7s
CI Pipeline / build (pull_request) Successful in 1m33s

This commit is contained in:
adilallo
2026-01-26 14:07:08 -07:00
parent bef13261b3
commit 1bb4627ab2
5 changed files with 84 additions and 15 deletions
+14 -11
View File
@@ -77,10 +77,11 @@ test.describe("Performance Monitoring", () => {
});
test("core web vitals", async ({ page }) => {
await page.goto("/");
await page.goto("/", { waitUntil: "load", timeout: 60000 });
// Wait for page to fully load
await page.waitForLoadState("networkidle");
// Use "load" state instead of "networkidle" to handle dynamically imported components
await page.waitForLoadState("load");
// Get Core Web Vitals with timeout
const coreWebVitals = (await page.evaluate(() => {
@@ -146,7 +147,7 @@ test.describe("Performance Monitoring", () => {
});
test("component render performance", async ({ page }) => {
await page.goto("/");
await page.goto("/", { waitUntil: "load", timeout: 60000 });
// Measure header render time
const headerRenderTime =
@@ -171,7 +172,7 @@ test.describe("Performance Monitoring", () => {
});
test("interaction performance", async ({ page }) => {
await page.goto("/");
await page.goto("/", { waitUntil: "load", timeout: 60000 });
// Wait for page to be ready
await page.waitForLoadState("domcontentloaded");
@@ -243,7 +244,7 @@ test.describe("Performance Monitoring", () => {
});
test("scroll performance", async ({ page }) => {
await page.goto("/");
await page.goto("/", { waitUntil: "load", timeout: 60000 });
// Measure scroll performance
const scrollTime = await performanceMonitor.measureScrollPerformance();
@@ -251,7 +252,7 @@ test.describe("Performance Monitoring", () => {
});
test("memory usage", async ({ page }) => {
await page.goto("/");
await page.goto("/", { waitUntil: "load", timeout: 60000 });
// Get memory usage
const memoryUsage = await performanceMonitor.getMemoryUsage();
@@ -267,8 +268,9 @@ test.describe("Performance Monitoring", () => {
test("network request performance", async ({ page }) => {
await performanceMonitor.monitorNetworkRequests();
await page.goto("/");
await page.waitForLoadState("networkidle");
await page.goto("/", { waitUntil: "load", timeout: 60000 });
// Wait for load state instead of networkidle to handle dynamic imports
await page.waitForLoadState("load");
// Check that all requests completed within budget
const summary = performanceMonitor.getSummary();
@@ -322,7 +324,7 @@ test.describe("Performance Monitoring", () => {
});
test("performance regression detection", async ({ page }) => {
await page.goto("/");
await page.goto("/", { waitUntil: "load", timeout: 60000 });
// Simulate a performance regression by adding a heavy operation
await page.addInitScript(() => {
@@ -349,7 +351,7 @@ test.describe("Performance Monitoring", () => {
});
test("performance metrics export", async ({ page }) => {
await page.goto("/");
await page.goto("/", { waitUntil: "load", timeout: 60000 });
// Perform various operations to collect metrics
await performanceMonitor.measureComponentRender("header");
@@ -372,7 +374,7 @@ test.describe("Performance Monitoring", () => {
});
test("performance budget compliance", async ({ page }) => {
await page.goto("/");
await page.goto("/", { waitUntil: "load", timeout: 60000 });
// Collect comprehensive metrics
await performanceMonitor.measurePageLoad("/");
@@ -414,6 +416,7 @@ test.describe("Performance Regression Testing", () => {
const results = [];
for (let i = 0; i < iterations; i++) {
// measurePageLoad already handles timeouts and wait conditions
const result = await performanceMonitor.measurePageLoad("/");
results.push(result.loadTime);