Fix tcs type errors
CI Pipeline / test (20) (pull_request) Successful in 3m13s
CI Pipeline / test (18) (pull_request) Successful in 3m57s
CI Pipeline / e2e (firefox) (pull_request) Successful in 5m6s
CI Pipeline / e2e (webkit) (pull_request) Successful in 5m16s
CI Pipeline / e2e (chromium) (pull_request) Successful in 14m47s
CI Pipeline / performance (pull_request) Successful in 4m32s
CI Pipeline / storybook (pull_request) Successful in 1m35s
CI Pipeline / visual-regression (pull_request) Failing after 9m55s
CI Pipeline / lint (pull_request) Failing after 49s
CI Pipeline / build (pull_request) Successful in 1m48s
CI Pipeline / test (20) (pull_request) Successful in 3m13s
CI Pipeline / test (18) (pull_request) Successful in 3m57s
CI Pipeline / e2e (firefox) (pull_request) Successful in 5m6s
CI Pipeline / e2e (webkit) (pull_request) Successful in 5m16s
CI Pipeline / e2e (chromium) (pull_request) Successful in 14m47s
CI Pipeline / performance (pull_request) Successful in 4m32s
CI Pipeline / storybook (pull_request) Successful in 1m35s
CI Pipeline / visual-regression (pull_request) Failing after 9m55s
CI Pipeline / lint (pull_request) Failing after 49s
CI Pipeline / build (pull_request) Successful in 1m48s
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { AxeBuilder } from "@axe-core/playwright";
|
||||
|
||||
export async function runA11y(page, options = {}) {
|
||||
export async function runA11y(page, _options = {}) {
|
||||
const results = await new AxeBuilder({ page })
|
||||
.withTags(["wcag2a", "wcag2aa"])
|
||||
.analyze();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { runA11y } from "./axe";
|
||||
|
||||
test.describe("Homepage", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
|
||||
@@ -58,7 +58,7 @@ test.describe("Performance Monitoring", () => {
|
||||
performanceMonitor.setBaselines(BASELINE_METRICS);
|
||||
});
|
||||
|
||||
test("homepage load performance", async ({ page }) => {
|
||||
test("homepage load performance", async ({ page: _page }) => {
|
||||
const result = await performanceMonitor.measurePageLoad("/");
|
||||
|
||||
// Assert page load time is within budget
|
||||
@@ -83,43 +83,57 @@ test.describe("Performance Monitoring", () => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
// Get Core Web Vitals with timeout
|
||||
const coreWebVitals = await page.evaluate(() => {
|
||||
return new Promise((resolve) => {
|
||||
const timeout = setTimeout(() => {
|
||||
observer.disconnect();
|
||||
resolve({ lcp: 0, fid: 0, cls: 0 }); // Default values if timeout
|
||||
}, 10000); // 10 second timeout
|
||||
|
||||
const observer = new PerformanceObserver((list) => {
|
||||
const entries = list.getEntries();
|
||||
const metrics: any = {};
|
||||
|
||||
for (const entry of entries) {
|
||||
if (entry.name === "LCP") {
|
||||
metrics.lcp = entry.startTime;
|
||||
} else if (entry.name === "FID") {
|
||||
metrics.fid = entry.processingStart - entry.startTime;
|
||||
} else if (entry.name === "CLS") {
|
||||
metrics.cls = entry.value;
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(metrics).length === 3) {
|
||||
clearTimeout(timeout);
|
||||
const coreWebVitals = (await page.evaluate(() => {
|
||||
return new Promise<{ lcp: number; fid: number; cls: number }>(
|
||||
(resolve) => {
|
||||
const timeout = setTimeout(() => {
|
||||
observer.disconnect();
|
||||
resolve(metrics);
|
||||
}
|
||||
});
|
||||
resolve({ lcp: 0, fid: 0, cls: 0 }); // Default values if timeout
|
||||
}, 10000); // 10 second timeout
|
||||
|
||||
observer.observe({
|
||||
entryTypes: [
|
||||
"largest-contentful-paint",
|
||||
"first-input",
|
||||
"layout-shift",
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
const observer = new PerformanceObserver((list) => {
|
||||
const entries = list.getEntries();
|
||||
const metrics: { lcp?: number; fid?: number; cls?: number } = {};
|
||||
|
||||
for (const entry of entries) {
|
||||
const e = entry as any;
|
||||
if (
|
||||
e.name === "LCP" ||
|
||||
e.entryType === "largest-contentful-paint"
|
||||
) {
|
||||
metrics.lcp = e.startTime ?? 0;
|
||||
} else if (e.name === "FID" || e.entryType === "first-input") {
|
||||
metrics.fid = (e.processingStart ?? 0) - (e.startTime ?? 0);
|
||||
} else if (e.name === "CLS" || e.entryType === "layout-shift") {
|
||||
metrics.cls = e.value ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
metrics.lcp !== undefined &&
|
||||
metrics.fid !== undefined &&
|
||||
metrics.cls !== undefined
|
||||
) {
|
||||
clearTimeout(timeout);
|
||||
observer.disconnect();
|
||||
resolve({
|
||||
lcp: metrics.lcp,
|
||||
fid: metrics.fid,
|
||||
cls: metrics.cls,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe({
|
||||
entryTypes: [
|
||||
"largest-contentful-paint",
|
||||
"first-input",
|
||||
"layout-shift",
|
||||
],
|
||||
});
|
||||
},
|
||||
);
|
||||
})) as { lcp: number; fid: number; cls: number };
|
||||
|
||||
// Assert Core Web Vitals are within acceptable ranges
|
||||
expect(coreWebVitals.lcp).toBeLessThan(
|
||||
@@ -251,7 +265,7 @@ test.describe("Performance Monitoring", () => {
|
||||
});
|
||||
|
||||
test("network request performance", async ({ page }) => {
|
||||
const requests = await performanceMonitor.monitorNetworkRequests();
|
||||
await performanceMonitor.monitorNetworkRequests();
|
||||
|
||||
await page.goto("/");
|
||||
await page.waitForLoadState("networkidle");
|
||||
@@ -327,7 +341,7 @@ test.describe("Performance Monitoring", () => {
|
||||
});
|
||||
});
|
||||
|
||||
const result = await performanceMonitor.measurePageLoad("/");
|
||||
await performanceMonitor.measurePageLoad("/");
|
||||
|
||||
// This should trigger a performance regression warning
|
||||
const summary = performanceMonitor.getSummary();
|
||||
|
||||
Reference in New Issue
Block a user