From 68bba1c9052ffc59cdbf09ea4de7788cdbf614ef Mon Sep 17 00:00:00 2001 From: Ikechukwu-Patrick <151846949+Ikechukwu-Patrick@users.noreply.github.com> Date: Mon, 31 Aug 2026 12:57:09 +0100 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01dc33c..4920cde 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repository (`SwiftChain-Frontend`) contains the frontend application built ## 🚀 Project Overview ### Core Problem - +//Temproary fix for pr and commit Traditional logistics systems suffer from: - Lack of trust between senders and independent drivers. From f18f06c17bf075751a48340e1d12e1af9dc1c0ac Mon Sep 17 00:00:00 2001 From: Ikechukwu-Patrick Date: Tue, 1 Sep 2026 06:57:28 +0100 Subject: [PATCH 2/2] Test: Implement E2E: Toggle Dark/Light Mode on Dashboard Overview --- cypress/e2e/theme-toggle.cy.ts | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 cypress/e2e/theme-toggle.cy.ts diff --git a/cypress/e2e/theme-toggle.cy.ts b/cypress/e2e/theme-toggle.cy.ts new file mode 100644 index 0000000..f008904 --- /dev/null +++ b/cypress/e2e/theme-toggle.cy.ts @@ -0,0 +1,60 @@ +// cypress/e2e/theme-toggle.cy.ts + +describe('E2E: Toggle Dark/Light Mode on Dashboard Overview', () => { + beforeEach(() => { + // Mock authentication to safely access the dashboard + cy.intercept('POST', '**/api/auth/login', { + statusCode: 200, + body: { success: true, token: 'mock-token' } + }).as('login'); + + // Set token to bypass login screen if your app uses localStorage + cy.window().then((win) => { + win.localStorage.setItem('token', 'mock-token'); + }); + + cy.visit('/dashboard'); + }); + + it('toggles the dashboard between light and dark modes successfully', () => { + // 1. Initial State Check (Assuming light mode default) + cy.get('html').should('not.have.class', 'dark'); + + // 2. Toggle to Dark Mode + cy.get('button[aria-label="Toggle Dark Mode"], button[aria-label="Toggle Theme"]') + .first() + .click(); + + // Verify Tailwind's 'dark' class is applied to the root element + cy.get('html').should('have.class', 'dark'); + + // Verify a specific CSS variable or background color change + cy.get('body').should('have.css', 'background-color') + .and((color) => { + // Checking that the color transitioned away from pure white + expect(color).to.not.equal('rgb(255, 255, 255)'); + }); + + // 3. Toggle back to Light Mode + cy.get('button[aria-label="Toggle Dark Mode"], button[aria-label="Toggle Theme"]') + .first() + .click(); + + cy.get('html').should('not.have.class', 'dark'); + }); + + it('persists theme preference across page reloads', () => { + // Toggle to Dark Mode + cy.get('button[aria-label="Toggle Dark Mode"], button[aria-label="Toggle Theme"]') + .first() + .click(); + + cy.get('html').should('have.class', 'dark'); + + // Reload the page + cy.reload(); + + // The dark class should still be present if preference is cached + cy.get('html').should('have.class', 'dark'); + }); +}); \ No newline at end of file