From 71c47d34410120fd265387ed5ead8bc50733c7de Mon Sep 17 00:00:00 2001 From: Luis Date: Fri, 26 Dec 2025 18:03:54 +0100 Subject: [PATCH 1/2] fix(deploy): configure base path and assets for subdirectory deployment --- {public => src/assets}/banner.jpg | Bin {public => src/assets}/emptyCart.jpg | Bin {public => src/assets}/hero.png | Bin src/components/Banner.tsx | 4 +++- src/components/BannerPopup.tsx | 8 ++++---- src/components/Cart.tsx | 3 ++- src/components/HeroSection.tsx | 3 ++- src/main.tsx | 2 +- src/pages/Wishlist.tsx | 3 ++- vite.config.ts | 1 + 10 files changed, 15 insertions(+), 9 deletions(-) rename {public => src/assets}/banner.jpg (100%) rename {public => src/assets}/emptyCart.jpg (100%) rename {public => src/assets}/hero.png (100%) diff --git a/public/banner.jpg b/src/assets/banner.jpg similarity index 100% rename from public/banner.jpg rename to src/assets/banner.jpg diff --git a/public/emptyCart.jpg b/src/assets/emptyCart.jpg similarity index 100% rename from public/emptyCart.jpg rename to src/assets/emptyCart.jpg diff --git a/public/hero.png b/src/assets/hero.png similarity index 100% rename from public/hero.png rename to src/assets/hero.png diff --git a/src/components/Banner.tsx b/src/components/Banner.tsx index 5c6c58a..e6f6d86 100644 --- a/src/components/Banner.tsx +++ b/src/components/Banner.tsx @@ -1,9 +1,11 @@ import { FC } from "react"; import { Link } from "react-router-dom"; +import banner from "../assets/banner.jpg"; + const Banner: FC = () => (
- banner + banner

Don't miss the offer

Grab it now

diff --git a/src/components/BannerPopup.tsx b/src/components/BannerPopup.tsx index 349193f..ab49ade 100644 --- a/src/components/BannerPopup.tsx +++ b/src/components/BannerPopup.tsx @@ -1,6 +1,7 @@ import { FC } from "react"; import { useAppDispatch, useAppSelector } from "../redux/hooks"; import { updateBanner } from "../redux/features/homeSlice"; +import banner from "../assets/banner.jpg"; const BannerPopup: FC = () => { const show = useAppSelector((state) => state.homeReducer.isBannerVisible); @@ -10,13 +11,12 @@ const BannerPopup: FC = () => { return (
banner diff --git a/src/components/Cart.tsx b/src/components/Cart.tsx index 2b22c7e..b112944 100644 --- a/src/components/Cart.tsx +++ b/src/components/Cart.tsx @@ -4,6 +4,7 @@ import { useAppDispatch, useAppSelector } from "../redux/hooks"; import { emptyCart, setCartState } from "../redux/features/cartSlice"; import CartRow from "./CartRow"; import toast from "react-hot-toast"; +import emptyCartImg from "../assets/emptyCart.jpg"; const Cart: FC = () => { const dispatch = useAppDispatch(); @@ -78,7 +79,7 @@ const Cart: FC = () => { items.map((item) => ) ) : (
- empty + empty

Your cart is empty

)} diff --git a/src/components/HeroSection.tsx b/src/components/HeroSection.tsx index 950518e..d2c389e 100644 --- a/src/components/HeroSection.tsx +++ b/src/components/HeroSection.tsx @@ -1,5 +1,6 @@ import { FC } from "react"; import { Link } from "react-router-dom"; +import hero from "../assets/hero.png"; const HeroSection: FC = () => { return ( @@ -27,7 +28,7 @@ const HeroSection: FC = () => {
- hero + hero
diff --git a/src/main.tsx b/src/main.tsx index 3b384e9..39379ca 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -6,7 +6,7 @@ import { BrowserRouter } from "react-router-dom"; ReactDOM.createRoot(document.getElementById("root")!).render( - + diff --git a/src/pages/Wishlist.tsx b/src/pages/Wishlist.tsx index 29b16ad..1b65275 100644 --- a/src/pages/Wishlist.tsx +++ b/src/pages/Wishlist.tsx @@ -1,6 +1,7 @@ import { FC } from "react"; import { useAppSelector } from "../redux/hooks"; import ProductList from "../components/ProductList"; +import emptyCart from "../assets/emptyCart.jpg"; const Wishlist: FC = () => { const wishlist = useAppSelector((state) => state.productReducer.wishlist); @@ -10,7 +11,7 @@ const Wishlist: FC = () => { ) : (
- empty + empty

Your wishlist is empty

diff --git a/vite.config.ts b/vite.config.ts index 5a33944..9780006 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,4 +4,5 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + base: "/test-abb/", }) From 6c279d443c512011a138aa5642e61ecc1392382f Mon Sep 17 00:00:00 2001 From: Luis Date: Fri, 26 Dec 2025 18:11:50 +0100 Subject: [PATCH 2/2] fix(e2e): update baseUrl and assertions for subdirectory deployment --- cypress.config.ts | 2 +- cypress/e2e/navbar.cy.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cypress.config.ts b/cypress.config.ts index fa3a1a3..4501e59 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from "cypress"; export default defineConfig({ e2e: { - baseUrl: "http://localhost:5173", + baseUrl: "http://localhost:5173/test-abb", // SOLUCIÓN: Resolución Full HD para que el banner no tape nada viewportWidth: 1920, viewportHeight: 1080, diff --git a/cypress/e2e/navbar.cy.ts b/cypress/e2e/navbar.cy.ts index f7be7ee..5039209 100644 --- a/cypress/e2e/navbar.cy.ts +++ b/cypress/e2e/navbar.cy.ts @@ -5,17 +5,18 @@ describe("testing navbar functions", () => { it("clicking on products works properly", () => { cy.get('[data-test="main-products"]').click({ force: true }); - cy.location("pathname").should("equal", "/products"); + cy.location("pathname").should("contain", "/products"); }); it("clicking on products works properly", () => { cy.get('[data-test="main-logo"]').click({ force: true }); - cy.location("pathname").should("equal", "/"); + // Verify it goes back to root (which is /test-abb/) + cy.location("pathname").should("match", /\/test-abb\/?$/); }); it.skip("clicking on a product works properly", () => { cy.get('[data-test="product-card"]').first().click({ force: true }); - cy.location("pathname").should("equal", "/product/1"); + cy.location("pathname").should("contain", "/product/1"); }); it("login & logout works properly", () => {