Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions e2e/buttons-links.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ test.describe("Button and Link Interactions", () => {

test.describe("Link Interactions", () => {
test("should open external links in new tab", async ({ page }) => {
// Wait for page to be fully loaded
await page.waitForLoadState("domcontentloaded");

// Scroll to footer where external links are
await homePage.footer.scrollIntoViewIfNeeded();
await expect(homePage.footer).toBeVisible();

// Find external links
const externalLinks = page.locator('a[target="_blank"]');
// Find external links in the footer
const externalLinks = homePage.footer.locator('a[target="_blank"]');
const count = await externalLinks.count();

if (count > 0) {
Expand Down
114 changes: 10 additions & 104 deletions e2e/click-interactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,111 +37,14 @@ test.describe("Click Interactions", () => {
});
});

test.describe("Resource Cards", () => {
test.describe("About Section", () => {
test.beforeEach(async ({ page }) => {
await page
.getByRole("menuitem", { name: "Resources", exact: true })
.click();
await expect(homePage.resourcesSection).toBeInViewport({ timeout: 1000 });
});

test("should display resource cards with buttons", async () => {
const resourceCards = homePage.resourcesSection.locator(
"[class*='card'], article",
);
const cardCount = await resourceCards.count();

expect(cardCount).toBeGreaterThan(0);

for (let i = 0; i < Math.min(cardCount, 3); i++) {
const card = resourceCards.nth(i);
const button = card.locator("button");
if ((await button.count()) > 0) {
await expect(button.first()).toBeVisible();
}
}
});

test("should handle resource card button clicks", async () => {
const resourceButtons = homePage.resourcesSection.locator("button");
const buttonCount = await resourceButtons.count();

if (buttonCount > 0) {
const firstButton = resourceButtons.first();
await expect(firstButton).toBeVisible();
await expect(firstButton).toBeEnabled();

// Check if clicking opens a modal or navigates
const buttonText = await firstButton.textContent();
expect(buttonText).toBeTruthy();
}
});

test("should open modal when clicking View Details button", async ({
page,
}) => {
const viewDetailsButtons = homePage.resourcesSection.getByRole("button", {
name: /view details/i,
});

if ((await viewDetailsButtons.count()) > 0) {
await viewDetailsButtons.first().click();

// Wait for modal to appear
const modal = page.locator('[role="dialog"]');
await expect(modal).toBeVisible({ timeout: 2000 });

// Close modal
const closeButton = modal.getByRole("button", { name: /close/i });
if ((await closeButton.count()) > 0) {
await closeButton.click();
await expect(modal).not.toBeVisible({ timeout: 1000 });
}
}
});
});

test.describe("Chain Specs Download Buttons", () => {
test.beforeEach(async ({ page }) => {
await page
.getByRole("menuitem", { name: "Chain Specs", exact: true })
.click();
await expect(homePage.chainSpecsSection).toBeInViewport({
timeout: 1000,
});
await page.getByRole("menuitem", { name: "About", exact: true }).click();
await expect(homePage.aboutSection).toBeInViewport({ timeout: 2000 });
});

test("should display download buttons for chain specs", async () => {
const downloadButtons = homePage.chainSpecsSection.locator(
"button:has-text('Download')",
);
const buttonCount = await downloadButtons.count();

expect(buttonCount).toBeGreaterThan(0);

for (let i = 0; i < buttonCount; i++) {
const button = downloadButtons.nth(i);
await expect(button).toBeVisible();
await expect(button).toBeEnabled();
}
});

test("should open chain spec file when clicking download", async ({
page,
}) => {
const downloadButtons = homePage.chainSpecsSection.locator(
"button:has-text('Download')",
);

if ((await downloadButtons.count()) > 0) {
const [newPage] = await Promise.all([
page.context().waitForEvent("page"),
downloadButtons.first().click(),
]);

// Should open a new page with the spec file
expect(newPage.url()).toBeTruthy();
}
test("should display about section content", async () => {
await expect(homePage.aboutSection).toBeVisible();
});
});

Expand Down Expand Up @@ -169,13 +72,16 @@ test.describe("Click Interactions", () => {
});
await aboutMenuItem.click();

await expect(homePage.aboutSection).toBeInViewport({ timeout: 1000 });
await expect(homePage.aboutSection).toBeInViewport({ timeout: 2000 });
});
});

test.describe("Footer Link Clicks", () => {
test.beforeEach(async () => {
test.beforeEach(async ({ page }) => {
// First wait for the page to be loaded then scroll to footer
await page.waitForLoadState("domcontentloaded");
await homePage.footer.scrollIntoViewIfNeeded();
await expect(homePage.footer).toBeVisible();
});

test("should have clickable footer links", async () => {
Expand Down
22 changes: 1 addition & 21 deletions e2e/fixtures/HomePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ export class HomePage extends BasePage {
// Sections
readonly heroSection: Locator;
readonly aboutSection: Locator;
readonly resourcesSection: Locator;
readonly logoSection: Locator;
readonly featuresSection: Locator;
readonly comparisonSection: Locator;
readonly chainSpecsSection: Locator;
readonly faqSection: Locator;
readonly footer: Locator;

Expand All @@ -37,13 +32,6 @@ export class HomePage extends BasePage {
// Sections
this.heroSection = page.locator("#hero");
this.aboutSection = page.locator("#about");
this.resourcesSection = page.locator("#resources");
this.logoSection = page.locator("section").filter({
has: page.locator("h2:has-text('Trusted by teams')"),
});
this.featuresSection = page.locator("#features");
this.comparisonSection = page.locator("#comparison");
this.chainSpecsSection = page.locator("#chain-specs");
this.faqSection = page.locator("#faq");
this.footer = page.locator("footer");
}
Expand Down Expand Up @@ -95,15 +83,7 @@ export class HomePage extends BasePage {
* Get all section IDs in order
*/
getSectionIds(): string[] {
return [
"hero",
"about",
"resources",
"features",
"comparison",
"chain-specs",
"faq",
];
return ["hero", "about", "faq"];
}

/**
Expand Down
72 changes: 0 additions & 72 deletions e2e/hover-focus-states.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,78 +65,6 @@ test.describe("Hover and Focus States", () => {
// Button should respond to hover (styles may or may not change based on CSS)
await expect(learnMoreButton).toBeVisible();
});

test("should show hover effect on resource card buttons", async ({
page,
}) => {
await page
.getByRole("menuitem", { name: "Resources", exact: true })
.click();
await expect(homePage.resourcesSection).toBeInViewport({ timeout: 1000 });

const resourceButtons = homePage.resourcesSection.locator("button");
if ((await resourceButtons.count()) > 0) {
const button = resourceButtons.first();
await button.scrollIntoViewIfNeeded();

// Hover
await button.hover();
await page.waitForTimeout(100);

// Should be hoverable
const isHovered = await button.evaluate((el) => el.matches(":hover"));
expect(isHovered).toBe(true);
}
});
});

test.describe("Card Hover States", () => {
test("should show hover effect on feature cards", async ({ page }) => {
await page
.getByRole("menuitem", { name: "Features", exact: true })
.first()
.click();
await expect(homePage.featuresSection).toBeInViewport({ timeout: 1000 });

const cards = homePage.featuresSection.locator(
"article, div[class*='card']",
);
if ((await cards.count()) > 0) {
const card = cards.first();
await card.scrollIntoViewIfNeeded();

// Hover
await card.hover();
await page.waitForTimeout(200);

// Card should respond to hover
await expect(card).toBeVisible();
}
});

test("should show hover effect on chain specs cards", async ({ page }) => {
await page
.getByRole("menuitem", { name: "Chain Specs", exact: true })
.click();
await expect(homePage.chainSpecsSection).toBeInViewport({
timeout: 1000,
});

const specCards = homePage.chainSpecsSection.locator(
"[class*='rounded-2xl']",
);
if ((await specCards.count()) > 0) {
const card = specCards.first();
await card.scrollIntoViewIfNeeded();

// Hover
await card.hover();
await page.waitForTimeout(300);

// Card should be hoverable
await expect(card).toBeVisible();
}
});
});

test.describe("Focus States (Keyboard Navigation)", () => {
Expand Down
Loading
Loading