From 2bba7b760ac5c4738c3e9969c4821fc0eadfdf5f Mon Sep 17 00:00:00 2001 From: Holger Drewes Date: Mon, 2 Mar 2026 10:39:01 +0100 Subject: [PATCH 01/29] Dynamic topics on home page + home page tests restructure --- cypress/e2e/sites/home.cy.ts | 59 +++++++++++++++++++++++++++++------- src/views/HomeView.vue | 19 +++++++++--- 2 files changed, 62 insertions(+), 16 deletions(-) diff --git a/cypress/e2e/sites/home.cy.ts b/cypress/e2e/sites/home.cy.ts index 8bcd0d1..11c35fe 100644 --- a/cypress/e2e/sites/home.cy.ts +++ b/cypress/e2e/sites/home.cy.ts @@ -3,20 +3,57 @@ describe('Home Page', () => { cy.visit('/') }) - it('renders intro and project overview', () => { - cy.contains('Interactive Ethereum Protocol Explorations') - cy.contains('About the Project') - cy.contains('Feel Your Protocol is a collaborative open-source project') + describe('Topics', () => { + it('renders at least one topic with title, image, and intro text', () => { + cy.contains('h2', 'Fusaka').should('be.visible') + cy.get('h2').contains('Fusaka').closest('a').find('img').should('exist') + cy.contains("Fusaka is Ethereum's next major network upgrade") + }) + + it('topic links to its dedicated page', () => { + cy.contains('h2', 'Fusaka').closest('a').click() + cy.url().should('include', '/fusaka') + }) }) - it('renders topic box with dancer', () => { - cy.contains('h2', 'Fusaka') - cy.get('img').should('exist') + describe('About section', () => { + it('renders project description', () => { + cy.contains('About the Project').should('be.visible') + cy.contains('Feel Your Protocol is a collaborative open-source project') + }) + + it('has link to contributor docs', () => { + cy.contains('a', 'Check the docs') + .should('have.attr', 'href', 'https://docs.feelyourprotocol.org') + .and('have.attr', 'target', '_blank') + }) + + it('has link to GitHub repo', () => { + cy.contains('a', 'code on GitHub') + .should('have.attr', 'href', 'https://github.com/feelyourprotocol/website') + .and('have.attr', 'target', '_blank') + }) }) - it('featured exploration boxes have entries and links work', () => { - cy.get('.exploration-c').should('have.length.gte', 1) - cy.get('.exploration-c').first().parents('a').click() - cy.url().should('include', '/eip-') + describe('Featured explorations', () => { + it('shows "Latest" label', () => { + cy.contains('Latest').should('be.visible') + }) + + it('renders three featured exploration cards', () => { + cy.get('.exploration-c').should('have.length', 3) + }) + + it('each card displays a title and intro text', () => { + cy.get('.exploration-c').each(($card) => { + cy.wrap($card).find('h3').should('not.be.empty') + cy.wrap($card).find('.font-mono').should('exist') + }) + }) + + it('clicking an exploration card navigates to its page', () => { + cy.get('.exploration-c').first().closest('a').click() + cy.url().should('match', /\/eip-\d+/) + }) }) }) diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 1eec8ff..320895f 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -5,18 +5,27 @@ import { EXPLORATIONS, getRandomTopicExplorationImage } from '@/explorations/REG import { TOPICS } from '@/explorations/TOPICS' const featured = ['eip-7883', 'eip-7594', 'eip-7951'] -const fusakaImage = getRandomTopicExplorationImage('fusaka') + +const topicImages: Record = {} +for (const topicId of Object.keys(TOPICS)) { + topicImages[topicId] = getRandomTopicExplorationImage(topicId) +}