Fix prettier formatting issues
This commit is contained in:
@@ -60,7 +60,7 @@ test.describe("Accessibility Testing", () => {
|
||||
focusedElements.push(
|
||||
`${elementInfo.tagName}${
|
||||
elementInfo.role ? `[role="${elementInfo.role}"]` : ""
|
||||
}: ${elementInfo.accessibleName}`
|
||||
}: ${elementInfo.accessibleName}`,
|
||||
);
|
||||
|
||||
await page.keyboard.press("Tab");
|
||||
@@ -190,7 +190,7 @@ test.describe("Accessibility Testing", () => {
|
||||
test("focus indicators - visible focus", async ({ page }) => {
|
||||
// Test that focus indicators are visible
|
||||
const focusableElements = page.locator(
|
||||
"button, a, input, textarea, select, [tabindex]"
|
||||
"button, a, input, textarea, select, [tabindex]",
|
||||
);
|
||||
const elementCount = await focusableElements.count();
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ export async function runA11y(page, options = {}) {
|
||||
if (results.violations.length > 0) {
|
||||
console.log("Accessibility violations found:", results.violations);
|
||||
throw new Error(
|
||||
`Found ${results.violations.length} accessibility violations`
|
||||
`Found ${results.violations.length} accessibility violations`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
// Page should function normally
|
||||
await expect(page.locator("text=Collaborate")).toBeVisible();
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -44,7 +44,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
test("handles browser back/forward navigation", async ({ page }) => {
|
||||
// Navigate to a section
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -118,7 +118,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
test("handles page refresh during interactions", async ({ page }) => {
|
||||
// Start an interaction
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -151,7 +151,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
// Interact with each tab - find the first visible button
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -190,7 +190,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
// All tabs should work independently
|
||||
await expect(
|
||||
page.locator('h2:has-text("How CommunityRule works")')
|
||||
page.locator('h2:has-text("How CommunityRule works")'),
|
||||
).toBeVisible();
|
||||
await expect(page1.locator("text=Consensus clusters")).toBeVisible();
|
||||
await expect(page2.locator("text=Still have questions?")).toBeVisible();
|
||||
@@ -249,7 +249,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
// Page should continue to function
|
||||
await expect(page.locator("text=Collaborate")).toBeVisible();
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -264,7 +264,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
// Page should still function without images
|
||||
await expect(page.locator("text=Collaborate")).toBeVisible();
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -298,7 +298,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
// Page should still function without styles
|
||||
await expect(page.locator("text=Collaborate")).toBeVisible();
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -332,7 +332,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
// Page should still function with fallback fonts
|
||||
await expect(page.locator("text=Collaborate")).toBeVisible();
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -366,7 +366,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
// Clean up
|
||||
setTimeout(() => {
|
||||
const testElements = document.querySelectorAll(
|
||||
'div[textContent*="Test element"]'
|
||||
'div[textContent*="Test element"]',
|
||||
);
|
||||
testElements.forEach((el) => el.remove());
|
||||
}, 100);
|
||||
@@ -395,7 +395,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
// Page should remain functional
|
||||
await expect(page.locator("text=Collaborate")).toBeVisible();
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -410,7 +410,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
// Find visible button for right-click
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -578,7 +578,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
// Content should remain readable
|
||||
await expect(page.locator("text=Collaborate")).toBeVisible();
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -593,7 +593,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -610,14 +610,14 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
await page.evaluate(() => {
|
||||
document.documentElement.style.setProperty(
|
||||
"--prefers-reduced-motion",
|
||||
"reduce"
|
||||
"reduce",
|
||||
);
|
||||
});
|
||||
|
||||
// Page should respect reduced motion
|
||||
await expect(page.locator("text=Collaborate")).toBeVisible();
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -632,7 +632,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ for (const bp of breakpoints) {
|
||||
}) => {
|
||||
// All breakpoints should have navigation items
|
||||
await expect(
|
||||
page.getByRole("link", { name: /use cases/i })
|
||||
page.getByRole("link", { name: /use cases/i }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: /learn/i })).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: /about/i })).toBeVisible();
|
||||
@@ -42,20 +42,20 @@ for (const bp of breakpoints) {
|
||||
test(`footer legal links visibility at ${bp.name}`, async ({ page }) => {
|
||||
// All breakpoints should have legal links
|
||||
await expect(
|
||||
page.getByRole("link", { name: /privacy policy/i })
|
||||
page.getByRole("link", { name: /privacy policy/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole("link", { name: /terms of service/i })
|
||||
page.getByRole("link", { name: /terms of service/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test(`footer social links visibility at ${bp.name}`, async ({ page }) => {
|
||||
// All breakpoints should have social links
|
||||
await expect(
|
||||
page.getByRole("link", { name: /follow us on bluesky/i })
|
||||
page.getByRole("link", { name: /follow us on bluesky/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole("link", { name: /follow us on gitlab/i })
|
||||
page.getByRole("link", { name: /follow us on gitlab/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ test.describe("Footer visual regression", () => {
|
||||
|
||||
// Take a screenshot for visual regression testing
|
||||
await expect(page.locator("footer").first()).toHaveScreenshot(
|
||||
`footer-${bp.name}.png`
|
||||
`footer-${bp.name}.png`,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -136,7 +136,7 @@ test.describe("Footer visual regression", () => {
|
||||
await useCasesLink.hover();
|
||||
await page.waitForTimeout(200);
|
||||
await expect(page.locator("footer").first()).toHaveScreenshot(
|
||||
`footer-${bp.name}-hover-nav.png`
|
||||
`footer-${bp.name}-hover-nav.png`,
|
||||
);
|
||||
|
||||
// Test hover on social links
|
||||
@@ -146,7 +146,7 @@ test.describe("Footer visual regression", () => {
|
||||
await blueskyLink.hover();
|
||||
await page.waitForTimeout(200);
|
||||
await expect(page.locator("footer").first()).toHaveScreenshot(
|
||||
`footer-${bp.name}-hover-social.png`
|
||||
`footer-${bp.name}-hover-social.png`,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -172,7 +172,7 @@ test.describe("Footer visual regression", () => {
|
||||
await useCasesLink.focus();
|
||||
await page.waitForTimeout(200);
|
||||
await expect(page.locator("footer").first()).toHaveScreenshot(
|
||||
`footer-${bp.name}-focus-nav.png`
|
||||
`footer-${bp.name}-focus-nav.png`,
|
||||
);
|
||||
|
||||
// Test focus on social links
|
||||
@@ -182,7 +182,7 @@ test.describe("Footer visual regression", () => {
|
||||
await blueskyLink.focus();
|
||||
await page.waitForTimeout(200);
|
||||
await expect(page.locator("footer").first()).toHaveScreenshot(
|
||||
`footer-${bp.name}-focus-social.png`
|
||||
`footer-${bp.name}-focus-social.png`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ for (const bp of breakpoints) {
|
||||
test(`navigation items visibility at ${bp.name}`, async ({ page }) => {
|
||||
// All breakpoints should have navigation items
|
||||
await expect(
|
||||
page.getByRole("link", { name: /use cases/i })
|
||||
page.getByRole("link", { name: /use cases/i }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: /learn/i })).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: /about/i })).toBeVisible();
|
||||
@@ -44,14 +44,14 @@ for (const bp of breakpoints) {
|
||||
}) => {
|
||||
// All breakpoints should have login button
|
||||
await expect(
|
||||
page.getByRole("link", { name: /log in to your account/i })
|
||||
page.getByRole("link", { name: /log in to your account/i }),
|
||||
).toBeVisible();
|
||||
|
||||
// All breakpoints should have create rule button
|
||||
await expect(
|
||||
page.getByRole("button", {
|
||||
name: /create a new rule with avatar decoration/i,
|
||||
})
|
||||
}),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -149,7 +149,7 @@ test.describe("Header visual regression", () => {
|
||||
|
||||
// Take a screenshot for visual regression testing
|
||||
await expect(page.locator("header").first()).toHaveScreenshot(
|
||||
`header-${bp.name}.png`
|
||||
`header-${bp.name}.png`,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -171,7 +171,7 @@ test.describe("Header visual regression", () => {
|
||||
await useCasesLink.hover();
|
||||
await page.waitForTimeout(200);
|
||||
await expect(page.locator("header").first()).toHaveScreenshot(
|
||||
`header-${bp.name}-hover-nav.png`
|
||||
`header-${bp.name}-hover-nav.png`,
|
||||
);
|
||||
|
||||
// Test hover on create rule button
|
||||
@@ -181,7 +181,7 @@ test.describe("Header visual regression", () => {
|
||||
await createRuleButton.hover();
|
||||
await page.waitForTimeout(200);
|
||||
await expect(page.locator("header").first()).toHaveScreenshot(
|
||||
`header-${bp.name}-hover-button.png`
|
||||
`header-${bp.name}-hover-button.png`,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -203,7 +203,7 @@ test.describe("Header visual regression", () => {
|
||||
await useCasesLink.focus();
|
||||
await page.waitForTimeout(200);
|
||||
await expect(page.locator("header").first()).toHaveScreenshot(
|
||||
`header-${bp.name}-focus-nav.png`
|
||||
`header-${bp.name}-focus-nav.png`,
|
||||
);
|
||||
|
||||
// Test focus on create rule button
|
||||
@@ -213,7 +213,7 @@ test.describe("Header visual regression", () => {
|
||||
await createRuleButton.focus();
|
||||
await page.waitForTimeout(200);
|
||||
await expect(page.locator("header").first()).toHaveScreenshot(
|
||||
`header-${bp.name}-focus-button.png`
|
||||
`header-${bp.name}-focus-button.png`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Locator, Page } from "@playwright/test";
|
||||
|
||||
export async function findVisibleButton(
|
||||
page: Page,
|
||||
text: string
|
||||
text: string,
|
||||
): Promise<Locator> {
|
||||
const buttons = page.locator(`button:has-text("${text}")`);
|
||||
const buttonCount = await buttons.count();
|
||||
@@ -19,7 +19,7 @@ export async function findVisibleButton(
|
||||
|
||||
export async function findVisibleElement(
|
||||
page: Page,
|
||||
selector: string
|
||||
selector: string,
|
||||
): Promise<Locator> {
|
||||
const elements = page.locator(selector);
|
||||
const elementCount = await elements.count();
|
||||
|
||||
+37
-37
@@ -12,19 +12,19 @@ test.describe("Homepage", () => {
|
||||
|
||||
// Check main sections are present
|
||||
await expect(
|
||||
page.locator("h1, h2").filter({ hasText: "Collaborate" })
|
||||
page.locator("h1, h2").filter({ hasText: "Collaborate" }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator("h2").filter({ hasText: "How CommunityRule works" })
|
||||
page.locator("h2").filter({ hasText: "How CommunityRule works" }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator("h1").filter({ hasText: "We've got your back" })
|
||||
page.locator("h1").filter({ hasText: "We've got your back" }),
|
||||
).toBeVisible();
|
||||
|
||||
// Check key components are rendered
|
||||
await expect(page.locator('img[alt="Hero illustration"]')).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=Trusted by leading cooperators")
|
||||
page.locator("text=Trusted by leading cooperators"),
|
||||
).toBeVisible();
|
||||
await expect(page.locator("text=Jo Freeman")).toBeVisible();
|
||||
});
|
||||
@@ -34,12 +34,12 @@ test.describe("Homepage", () => {
|
||||
await expect(page.locator("text=Collaborate")).toBeVisible();
|
||||
await expect(page.locator("text=with clarity")).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=Help your community make important decisions")
|
||||
page.locator("text=Help your community make important decisions"),
|
||||
).toBeVisible();
|
||||
|
||||
// Check CTA button
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -54,7 +54,7 @@ test.describe("Homepage", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ test.describe("Homepage", () => {
|
||||
await visibleButton.click();
|
||||
// Should scroll to the numbered cards section
|
||||
await expect(
|
||||
page.locator('h2:has-text("How CommunityRule works")')
|
||||
page.locator('h2:has-text("How CommunityRule works")'),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("logo wall section displays correctly", async ({ page }) => {
|
||||
// Check section label
|
||||
await expect(
|
||||
page.locator("text=Trusted by leading cooperators")
|
||||
page.locator("text=Trusted by leading cooperators"),
|
||||
).toBeVisible();
|
||||
|
||||
// Check logos are present
|
||||
@@ -95,23 +95,23 @@ test.describe("Homepage", () => {
|
||||
test("numbered cards section functionality", async ({ page }) => {
|
||||
// Check section header
|
||||
await expect(
|
||||
page.locator('h2:has-text("How CommunityRule works")')
|
||||
page.locator('h2:has-text("How CommunityRule works")'),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=Here's a quick overview of the process")
|
||||
page.locator("text=Here's a quick overview of the process"),
|
||||
).toBeVisible();
|
||||
|
||||
// Check all three cards are present
|
||||
await expect(
|
||||
page.locator("text=Document how your community makes decisions")
|
||||
page.locator("text=Document how your community makes decisions"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=Build an operating manual for a successful community")
|
||||
page.locator("text=Build an operating manual for a successful community"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator(
|
||||
"text=Get a link to your manual for your group to review and evolve"
|
||||
)
|
||||
"text=Get a link to your manual for your group to review and evolve",
|
||||
),
|
||||
).toBeVisible();
|
||||
|
||||
// Check numbered indicators
|
||||
@@ -121,7 +121,7 @@ test.describe("Homepage", () => {
|
||||
|
||||
// Check CTA buttons
|
||||
const createButtons = page.locator(
|
||||
'button:has-text("Create CommunityRule")'
|
||||
'button:has-text("Create CommunityRule")',
|
||||
);
|
||||
const createButtonCount = await createButtons.count();
|
||||
let visibleCreateButton = null;
|
||||
@@ -139,7 +139,7 @@ test.describe("Homepage", () => {
|
||||
}
|
||||
|
||||
await expect(
|
||||
page.locator('button:has-text("See how it works")')
|
||||
page.locator('button:has-text("See how it works")'),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -152,16 +152,16 @@ test.describe("Homepage", () => {
|
||||
|
||||
// Check rule descriptions
|
||||
await expect(
|
||||
page.locator("text=Units called Circles have the ability to decide")
|
||||
page.locator("text=Units called Circles have the ability to decide"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=Decisions that affect the group collectively")
|
||||
page.locator("text=Decisions that affect the group collectively"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=An elected board determines policies")
|
||||
page.locator("text=An elected board determines policies"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=All participants can propose and vote")
|
||||
page.locator("text=All participants can propose and vote"),
|
||||
).toBeVisible();
|
||||
|
||||
// Test card interactions
|
||||
@@ -171,19 +171,19 @@ test.describe("Homepage", () => {
|
||||
|
||||
// Check "See all templates" button
|
||||
await expect(
|
||||
page.locator('button:has-text("See all templates")')
|
||||
page.locator('button:has-text("See all templates")'),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("feature grid section functionality", async ({ page }) => {
|
||||
// Check section header
|
||||
await expect(
|
||||
page.locator('h1:has-text("We\'ve got your back")')
|
||||
page.locator('h1:has-text("We\'ve got your back")'),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator(
|
||||
"text=Use our toolkit to improve, document, and evolve your organization"
|
||||
)
|
||||
"text=Use our toolkit to improve, document, and evolve your organization",
|
||||
),
|
||||
).toBeVisible();
|
||||
|
||||
// Check all four feature cards - use more specific selectors to avoid conflicts
|
||||
@@ -205,23 +205,23 @@ test.describe("Homepage", () => {
|
||||
test("quote block section displays correctly", async ({ page }) => {
|
||||
// Check quote content
|
||||
await expect(
|
||||
page.locator("text=The rules of decision-making must be open")
|
||||
page.locator("text=The rules of decision-making must be open"),
|
||||
).toBeVisible();
|
||||
|
||||
// Check author and source
|
||||
await expect(page.locator("text=Jo Freeman")).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=The Tyranny of Structurelessness")
|
||||
page.locator("text=The Tyranny of Structurelessness"),
|
||||
).toBeVisible();
|
||||
|
||||
// Check avatar
|
||||
await expect(
|
||||
page.locator('img[alt="Portrait of Jo Freeman"]')
|
||||
page.locator('img[alt="Portrait of Jo Freeman"]'),
|
||||
).toBeVisible();
|
||||
|
||||
// Check decorative elements
|
||||
await expect(
|
||||
page.locator('[class*="pointer-events-none absolute z-0"]').first()
|
||||
page.locator('[class*="pointer-events-none absolute z-0"]').first(),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -229,7 +229,7 @@ test.describe("Homepage", () => {
|
||||
// Check section content
|
||||
await expect(page.locator("text=Still have questions?")).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=Get answers from an experienced organizer")
|
||||
page.locator("text=Get answers from an experienced organizer"),
|
||||
).toBeVisible();
|
||||
|
||||
// Check CTA button (it's actually a link)
|
||||
@@ -286,19 +286,19 @@ test.describe("Homepage", () => {
|
||||
// Test mobile viewport
|
||||
await page.setViewportSize({ width: 375, height: 667 });
|
||||
await expect(
|
||||
page.locator("h1, h2").filter({ hasText: "Collaborate" })
|
||||
page.locator("h1, h2").filter({ hasText: "Collaborate" }),
|
||||
).toBeVisible();
|
||||
|
||||
// Test tablet viewport
|
||||
await page.setViewportSize({ width: 768, height: 1024 });
|
||||
await expect(
|
||||
page.locator("h1, h2").filter({ hasText: "Collaborate" })
|
||||
page.locator("h1, h2").filter({ hasText: "Collaborate" }),
|
||||
).toBeVisible();
|
||||
|
||||
// Test desktop viewport
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
await expect(
|
||||
page.locator("h1, h2").filter({ hasText: "Collaborate" })
|
||||
page.locator("h1, h2").filter({ hasText: "Collaborate" }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -362,7 +362,7 @@ test.describe("Homepage", () => {
|
||||
test("scroll behavior and smooth scrolling", async ({ page }) => {
|
||||
// Test smooth scrolling to sections
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -377,7 +377,7 @@ test.describe("Homepage", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ test.describe("Homepage", () => {
|
||||
|
||||
// Check we're at the numbered cards section
|
||||
await expect(
|
||||
page.locator('h2:has-text("How CommunityRule works")')
|
||||
page.locator('h2:has-text("How CommunityRule works")'),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -405,7 +405,7 @@ test.describe("Homepage", () => {
|
||||
const brokenImages = await page.evaluate(() => {
|
||||
const imgs = document.querySelectorAll("img");
|
||||
return Array.from(imgs).filter(
|
||||
(img) => !img.complete || img.naturalWidth === 0
|
||||
(img) => !img.complete || img.naturalWidth === 0,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ test.describe("Performance Monitoring", () => {
|
||||
// Assert individual metrics
|
||||
expect(result.metrics.ttfb).toBeLessThan(PERFORMANCE_BUDGETS.ttfb);
|
||||
expect(result.metrics.domContentLoaded).toBeLessThan(
|
||||
PERFORMANCE_BUDGETS.dom_content_loaded
|
||||
PERFORMANCE_BUDGETS.dom_content_loaded,
|
||||
);
|
||||
expect(result.metrics.load).toBeLessThan(PERFORMANCE_BUDGETS.full_load);
|
||||
|
||||
@@ -121,10 +121,10 @@ test.describe("Performance Monitoring", () => {
|
||||
|
||||
// Assert Core Web Vitals are within acceptable ranges
|
||||
expect(coreWebVitals.lcp).toBeLessThan(
|
||||
PERFORMANCE_BUDGETS.largest_contentful_paint
|
||||
PERFORMANCE_BUDGETS.largest_contentful_paint,
|
||||
);
|
||||
expect(coreWebVitals.fid).toBeLessThan(
|
||||
PERFORMANCE_BUDGETS.first_input_delay
|
||||
PERFORMANCE_BUDGETS.first_input_delay,
|
||||
);
|
||||
expect(coreWebVitals.cls).toBeLessThan(0.1); // CLS should be less than 0.1
|
||||
});
|
||||
@@ -133,27 +133,24 @@ test.describe("Performance Monitoring", () => {
|
||||
await page.goto("/");
|
||||
|
||||
// Measure header render time
|
||||
const headerRenderTime = await performanceMonitor.measureComponentRender(
|
||||
"header"
|
||||
);
|
||||
const headerRenderTime =
|
||||
await performanceMonitor.measureComponentRender("header");
|
||||
expect(headerRenderTime).toBeLessThan(
|
||||
PERFORMANCE_BUDGETS.component_render_time
|
||||
PERFORMANCE_BUDGETS.component_render_time,
|
||||
);
|
||||
|
||||
// Measure footer render time
|
||||
const footerRenderTime = await performanceMonitor.measureComponentRender(
|
||||
"footer"
|
||||
);
|
||||
const footerRenderTime =
|
||||
await performanceMonitor.measureComponentRender("footer");
|
||||
expect(footerRenderTime).toBeLessThan(
|
||||
PERFORMANCE_BUDGETS.component_render_time
|
||||
PERFORMANCE_BUDGETS.component_render_time,
|
||||
);
|
||||
|
||||
// Measure main content render time
|
||||
const mainRenderTime = await performanceMonitor.measureComponentRender(
|
||||
"main"
|
||||
);
|
||||
const mainRenderTime =
|
||||
await performanceMonitor.measureComponentRender("main");
|
||||
expect(mainRenderTime).toBeLessThan(
|
||||
PERFORMANCE_BUDGETS.component_render_time
|
||||
PERFORMANCE_BUDGETS.component_render_time,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -168,7 +165,7 @@ test.describe("Performance Monitoring", () => {
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
async () => {
|
||||
const learnButtons = page.locator(
|
||||
'button:has-text("Learn how CommunityRule works")'
|
||||
'button:has-text("Learn how CommunityRule works")',
|
||||
);
|
||||
const buttonCount = await learnButtons.count();
|
||||
let visibleButton = null;
|
||||
@@ -183,12 +180,12 @@ test.describe("Performance Monitoring", () => {
|
||||
|
||||
if (!visibleButton) {
|
||||
throw new Error(
|
||||
'No visible "Learn how CommunityRule works" button found'
|
||||
'No visible "Learn how CommunityRule works" button found',
|
||||
);
|
||||
}
|
||||
|
||||
await visibleButton.click();
|
||||
}
|
||||
},
|
||||
);
|
||||
expect(buttonClickTime).toBeLessThan(PERFORMANCE_BUDGETS.interaction_time);
|
||||
|
||||
@@ -213,7 +210,7 @@ test.describe("Performance Monitoring", () => {
|
||||
}
|
||||
|
||||
await visibleLink.click();
|
||||
}
|
||||
},
|
||||
);
|
||||
expect(linkClickTime).toBeLessThan(PERFORMANCE_BUDGETS.interaction_time);
|
||||
});
|
||||
@@ -250,7 +247,7 @@ test.describe("Performance Monitoring", () => {
|
||||
const summary = performanceMonitor.getSummary();
|
||||
if (summary.network_request_duration) {
|
||||
expect(summary.network_request_duration.average).toBeLessThan(
|
||||
PERFORMANCE_BUDGETS.network_request_duration
|
||||
PERFORMANCE_BUDGETS.network_request_duration,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -293,7 +290,7 @@ test.describe("Performance Monitoring", () => {
|
||||
|
||||
// Even under load, page should load within reasonable time
|
||||
expect(result.loadTime).toBeLessThan(
|
||||
PERFORMANCE_BUDGETS.page_load_time * 1.5
|
||||
PERFORMANCE_BUDGETS.page_load_time * 1.5,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -343,7 +340,7 @@ test.describe("Performance Monitoring", () => {
|
||||
|
||||
console.log(
|
||||
"Exported Performance Data:",
|
||||
JSON.stringify(exportedData, null, 2)
|
||||
JSON.stringify(exportedData, null, 2),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -402,7 +399,7 @@ test.describe("Performance Regression Testing", () => {
|
||||
const variance =
|
||||
results.reduce(
|
||||
(acc, val) => acc + Math.pow(val - averageLoadTime, 2),
|
||||
0
|
||||
0,
|
||||
) / results.length;
|
||||
|
||||
// Performance should be consistent (low variance)
|
||||
|
||||
@@ -11,7 +11,7 @@ test.describe("User Journeys", () => {
|
||||
|
||||
// 2. User reads hero section
|
||||
await expect(
|
||||
page.locator("text=Help your community make important decisions")
|
||||
page.locator("text=Help your community make important decisions"),
|
||||
).toBeVisible();
|
||||
|
||||
// 3. User clicks CTA to learn more
|
||||
@@ -24,20 +24,20 @@ test.describe("User Journeys", () => {
|
||||
|
||||
// 4. User scrolls to numbered cards section
|
||||
await expect(
|
||||
page.locator('h2:has-text("How CommunityRule works")')
|
||||
page.locator('h2:has-text("How CommunityRule works")'),
|
||||
).toBeVisible();
|
||||
|
||||
// 5. User reads the process steps
|
||||
await expect(
|
||||
page.locator("text=Document how your community makes decisions")
|
||||
page.locator("text=Document how your community makes decisions"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator("text=Build an operating manual for a successful community")
|
||||
page.locator("text=Build an operating manual for a successful community"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator(
|
||||
"text=Get a link to your manual for your group to review and evolve"
|
||||
)
|
||||
"text=Get a link to your manual for your group to review and evolve",
|
||||
),
|
||||
).toBeVisible();
|
||||
|
||||
// 6. User explores rule templates
|
||||
@@ -78,7 +78,7 @@ test.describe("User Journeys", () => {
|
||||
|
||||
// 10. User creates CommunityRule
|
||||
const createButton = page.locator(
|
||||
'button:has-text("Create CommunityRule")'
|
||||
'button:has-text("Create CommunityRule")',
|
||||
);
|
||||
if (
|
||||
(await createButton.count()) > 0 &&
|
||||
@@ -139,7 +139,7 @@ test.describe("User Journeys", () => {
|
||||
|
||||
// Read the section
|
||||
await expect(
|
||||
page.locator("text=Get answers from an experienced organizer")
|
||||
page.locator("text=Get answers from an experienced organizer"),
|
||||
).toBeVisible();
|
||||
|
||||
// Click contact button - check if it exists and is visible first
|
||||
@@ -158,7 +158,7 @@ test.describe("User Journeys", () => {
|
||||
test("user journey: create CommunityRule", async ({ page }) => {
|
||||
// Simplified approach - just check if the button exists and is visible
|
||||
const createButton = page.locator(
|
||||
'button:has-text("Create CommunityRule")'
|
||||
'button:has-text("Create CommunityRule")',
|
||||
);
|
||||
|
||||
if (
|
||||
|
||||
@@ -349,7 +349,7 @@ test.describe("Visual Regression Tests", () => {
|
||||
await page.evaluate(() => {
|
||||
document.documentElement.style.setProperty(
|
||||
"--prefers-reduced-motion",
|
||||
"reduce"
|
||||
"reduce",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user