Skip to content

Commit

Permalink
Implement and test Home Page component with dynamic news feed integra…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
Programmer-RD-AI committed Aug 8, 2024
1 parent 5036d29 commit 2e2a014
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cypress/e2e/user/homePage.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// cypress/integration/homePage.spec.js

describe("HomePage", () => {
beforeEach(() => {
cy.visit("/");
});

it("should render ArticleList", () => {
cy.get("[data-cy=article-list]").should("be.visible");
});

it("should render Footer", () => {
cy.get("footer").should("be.visible");
});

it("should display at least one article card in ArticleList", () => {
cy.get("[data-cy=article-list]")
.find("[data-cy=article-list-item]")
.should("have.length.greaterThan", 0);
});

it("should have a footer with a specific text", () => {
cy.get("footer").should("contain.text", "©"); // Assuming the footer contains a copyright symbol
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/pages/HomePage.cy.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import HomePage from './HomePage'

describe('<HomePage />', () => {
it('renders', () => {
// see: https://on.cypress.io/mounting-react
cy.mount(<HomePage />)
})
})
11 changes: 11 additions & 0 deletions src/pages/HomePage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import ArticleList from "../components/ArticleList";
import Navbar from "../components/Navbar";
import Footer from "../components/Footer";

const HomePage = () => (
<>
<ArticleList />
</>
);

export default HomePage;

0 comments on commit 2e2a014

Please sign in to comment.