From 7609fe3971eb8a4e6d9afc07dbea090077f23d9f Mon Sep 17 00:00:00 2001 From: Andrew-Ochieng Date: Thu, 11 Jul 2024 15:35:41 +0300 Subject: [PATCH 01/22] restyle trends-in-sales section sales graph --- src/components/admin/AdminReportCard.jsx | 2 +- .../admin/shop/sales/SalesGraph.jsx | 12 ++- .../admin/shop/sales/SalesPreviewTable.jsx | 2 +- src/components/admin/shop/sales/data.js | 22 ++--- src/pages/admin/shop/sales/ShopSales.jsx | 18 ++-- src/pages/admin/shop/sales/data.js | 86 ++----------------- 6 files changed, 43 insertions(+), 99 deletions(-) diff --git a/src/components/admin/AdminReportCard.jsx b/src/components/admin/AdminReportCard.jsx index 682f543f..03581984 100644 --- a/src/components/admin/AdminReportCard.jsx +++ b/src/components/admin/AdminReportCard.jsx @@ -165,7 +165,7 @@ const ChartComponent = ({ title = "All Orders", number = 500, persontage = "10%" {persontage} - Vs last quater + vs last quater
diff --git a/src/components/admin/shop/sales/SalesGraph.jsx b/src/components/admin/shop/sales/SalesGraph.jsx index d7c5d84b..f2d7be5b 100644 --- a/src/components/admin/shop/sales/SalesGraph.jsx +++ b/src/components/admin/shop/sales/SalesGraph.jsx @@ -6,6 +6,7 @@ import data from './data'; export const SalesGraph = () => { return ( + {/* */} { - + - + ); diff --git a/src/components/admin/shop/sales/SalesPreviewTable.jsx b/src/components/admin/shop/sales/SalesPreviewTable.jsx index 1fdf7872..84c16575 100644 --- a/src/components/admin/shop/sales/SalesPreviewTable.jsx +++ b/src/components/admin/shop/sales/SalesPreviewTable.jsx @@ -22,7 +22,7 @@ import { }); return ( - +
{table.getHeaderGroups().map((headerGroup) => ( diff --git a/src/components/admin/shop/sales/data.js b/src/components/admin/shop/sales/data.js index 9def0c9f..fac3f175 100644 --- a/src/components/admin/shop/sales/data.js +++ b/src/components/admin/shop/sales/data.js @@ -1,57 +1,57 @@ const data = [ { name: 'Jan', - pv: 4300, + uv: 4300, amt: 2400, }, { name: 'Feb', - pv: 5600, + uv: 5600, amt: 2210, }, { name: 'Apr', - pv: 5408, + uv: 5408, amt: 2290, }, { name: 'May', - pv: 6420, + uv: 6420, amt: 2000, }, { name: 'Jun', - pv: 7500, + uv: 7500, amt: 2181, }, { name: 'Jul', - pv: 6300, + uv: 6300, amt: 2500, }, { name: 'Aug', - pv: 8600, + uv: 8600, amt: 2100, }, { name: 'Sep', - pv: 8300, + uv: 8300, amt: 2100, }, { name: 'Oct', - pv: 10200, + uv: 10200, amt: 2100, }, { name: 'Nov', - pv: 9500, + uv: 9500, amt: 2100, }, { name: 'Dev', - pv: 12200, + uv: 12200, amt: 2100, }, ]; diff --git a/src/pages/admin/shop/sales/ShopSales.jsx b/src/pages/admin/shop/sales/ShopSales.jsx index 4b00193d..d09bc409 100644 --- a/src/pages/admin/shop/sales/ShopSales.jsx +++ b/src/pages/admin/shop/sales/ShopSales.jsx @@ -3,6 +3,7 @@ import columns from "@/components/admin/shop/sales/SalesPreviewColumn"; import { Link } from "react-router-dom"; import data from "./data"; import ShopSalesTrends from "./ShopSalesTrends"; +import { ChartComponent } from "@/components/admin/AdminReportCard"; function ShopSales() { @@ -10,14 +11,21 @@ function ShopSales() { <>
-

Sales

+

Sales Report

-

Dashboard

- +

Trends In Sales

+
+ + + + +
+ +
-
+

Shop

@@ -29,7 +37,7 @@ function ShopSales() {
- +
diff --git a/src/pages/admin/shop/sales/data.js b/src/pages/admin/shop/sales/data.js index 9b37eab3..175d0983 100644 --- a/src/pages/admin/shop/sales/data.js +++ b/src/pages/admin/shop/sales/data.js @@ -1,83 +1,11 @@ const data = [ - { - id: "itm-101", - name: "SYT Beanie", - totalItems: 400, - sold: 350, - // unitCost: 350, - remaining: "50", - }, - { - id: "itm-102", - name: "SYT Hoodie", - totalItems: 100, - sold: 5, - // unitCost: 1000, - remaining: "45", - }, - { - id: "itm-103", - name: "SYT Mug", - totalItems: 20, - sold: 100, - // unitCost: 100, - remaining: "100", - }, - { - id: "itm-104", - name: "SYT Tee", - ltems: 50, - // itemSold: 350, - remaining: "50", - }, - { - id: "itm-105", - name: "SYT Beanie", - totalItems: 400, - sold: 350, - // unitCost: 350, - remaining: "50", - }, - { - id: "itm-106", - name: "SYT Hoodie", - totalItems: 100, - sold: 5, - // unitCost: 1000, - remaining: "45", - }, - { - id: "itm-107", - name: "SYT Mug", - totalItems: 20, - sold: 100, - // unitCost: 100, - remaining: "100", - }, - { - id: "itm-108", - name: "SYT Tee", - ltems: 50, - // itemSold: 350, - remaining: "50", - }, - { - id: "itm-101", - name: "SYT Beanie", - totalItems: 400, - sold: 350, - // unitCost: 350, - remaining: "50", - }, - { - id: "itm-102", - name: "SYT Hoodie", - totalItems: 100, - sold: 5, - // unitCost: 1000, - remaining: "45", - }, - ]; + { id: "ITM-101", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 50 }, + { id: "ITM-102", name: 'SYT Hoodie', totalItems: 50, noOfId: "No. of items: 5", unitCost: "Unit Cost: KES 1000", totalSales: 5000, itemsRemaining: 40 }, + { id: "ITM-103", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 500 }, + { id: "ITM-104", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 30 }, + { id: "ITM-105", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 20 }, + { id: "ITM-106", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 50 }, +]; export default data; \ No newline at end of file From 109e96046f184c3b99661ff984a971a36552192b Mon Sep 17 00:00:00 2001 From: Andrew-Ochieng Date: Tue, 3 Sep 2024 15:02:43 +0300 Subject: [PATCH 02/22] tests: add landing-page-sections tests --- src/components/admin/AdminReportCard.jsx | 16 ---- .../admin/shop/sales/SalesGraph.jsx | 31 ------- .../admin/shop/sales/SalesPreviewColumn.jsx | 39 --------- .../admin/shop/sales/SalesPreviewTable.jsx | 84 ------------------- src/components/admin/shop/sales/data.js | 62 -------------- src/pages/admin/shop/sales/ShopSales.jsx | 48 ----------- .../admin/shop/sales/ShopSalesTrends.jsx | 14 ---- src/pages/admin/shop/sales/data.js | 13 --- tests/pages/landing-page.spec.js | 82 ++++++++++++++++++ ....timestamp-1724936058326-f5c1406d3f0ad.mjs | 37 ++++++++ 10 files changed, 119 insertions(+), 307 deletions(-) create mode 100644 vite.config.js.timestamp-1724936058326-f5c1406d3f0ad.mjs diff --git a/src/components/admin/AdminReportCard.jsx b/src/components/admin/AdminReportCard.jsx index 42d8e7c8..2cec6395 100644 --- a/src/components/admin/AdminReportCard.jsx +++ b/src/components/admin/AdminReportCard.jsx @@ -202,21 +202,6 @@ function ChartComponent({ { name: "Page b", uv: 39, amt: 40 }, ]; return ( -<<<<<<< HEAD - <> -
-
-
-
- {title} - {number} -
-
- - {persontage} -
- vs last quater -=======
@@ -231,7 +216,6 @@ function ChartComponent({ {persontage} ->>>>>>> 2b09e140e1794032363f4b50c66a3b56fbf78506
vs last quater diff --git a/src/components/admin/shop/sales/SalesGraph.jsx b/src/components/admin/shop/sales/SalesGraph.jsx index cb8a075f..10d01036 100644 --- a/src/components/admin/shop/sales/SalesGraph.jsx +++ b/src/components/admin/shop/sales/SalesGraph.jsx @@ -1,11 +1,4 @@ // import React, { PureComponent } from 'react'; -<<<<<<< HEAD -import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts'; -import data from './data'; - - -export const SalesGraph = () => { -======= import { AreaChart, Area, @@ -18,7 +11,6 @@ import { import data from "./data"; export default function SalesGraph() { ->>>>>>> 2b09e140e1794032363f4b50c66a3b56fbf78506 return ( {/* */} @@ -33,28 +25,6 @@ export default function SalesGraph() { > -<<<<<<< HEAD - - - - - - - - - - - - ); -}; -======= @@ -75,4 +45,3 @@ export default function SalesGraph() { ); } ->>>>>>> 2b09e140e1794032363f4b50c66a3b56fbf78506 diff --git a/src/components/admin/shop/sales/SalesPreviewColumn.jsx b/src/components/admin/shop/sales/SalesPreviewColumn.jsx index 54cd816d..652d50e3 100644 --- a/src/components/admin/shop/sales/SalesPreviewColumn.jsx +++ b/src/components/admin/shop/sales/SalesPreviewColumn.jsx @@ -1,42 +1,4 @@ const columns = [ -<<<<<<< HEAD - { - accessorKey: "id", - header: "Item ID", - }, - { - accessorKey: "name", - header: "Name", - }, - { - accessorKey: "items-sold", - header: "Items Sold", - }, - { - accessorKey: "items-remaining", - header: "Items Remaining", - }, - - { - id: "actions", - enableHiding: false, - cell: ({ row }) => { - const orderInfo = row.original; - - return ( -
- -
- ); - }, - }, - ]; - - export default columns; - -======= { accessorKey: "id", header: "Item ID", @@ -68,4 +30,3 @@ const columns = [ ]; export default columns; ->>>>>>> 2b09e140e1794032363f4b50c66a3b56fbf78506 diff --git a/src/components/admin/shop/sales/SalesPreviewTable.jsx b/src/components/admin/shop/sales/SalesPreviewTable.jsx index d87dc2b0..025a1f5a 100644 --- a/src/components/admin/shop/sales/SalesPreviewTable.jsx +++ b/src/components/admin/shop/sales/SalesPreviewTable.jsx @@ -1,87 +1,4 @@ import { -<<<<<<< HEAD - flexRender, - getCoreRowModel, - useReactTable, - } from "@tanstack/react-table"; - - import PropTypes from "prop-types"; - import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, - } from "@/components/ui/table"; - - function SalesPreviewTable({ columns, data }) { - const table = useReactTable({ - data, - columns, - getCoreRowModel: getCoreRowModel(), - }); - - return ( -
- - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => ( - - {header.isPlaceholder - ? null - : flexRender( - header.column.columnDef.header, - header.getContext() - )} - - ))} - - ))} - - - {table.getRowModel().rows?.length ? ( - table.getRowModel().rows.map((row) => ( - - {row.getVisibleCells().map((cell) => ( - - {flexRender(cell.column.columnDef.cell, cell.getContext())} - - ))} - - )) - ) : ( - - - No results. - - - )} - -
- ); - } - - export default SalesPreviewTable; - - SalesPreviewTable.propTypes = { - columns: PropTypes.arrayOf( - PropTypes.shape({ - accessorKey: PropTypes.string, - cell: PropTypes.func, - header: PropTypes.func, - id: PropTypes.string, - }) - ).isRequired, - // eslint-disable-next-line react/forbid-prop-types - data: PropTypes.arrayOf(PropTypes.object).isRequired, - }; - -======= flexRender, getCoreRowModel, useReactTable, @@ -162,4 +79,3 @@ SalesPreviewTable.propTypes = { // eslint-disable-next-line react/forbid-prop-types data: PropTypes.arrayOf(PropTypes.object).isRequired, }; ->>>>>>> 2b09e140e1794032363f4b50c66a3b56fbf78506 diff --git a/src/components/admin/shop/sales/data.js b/src/components/admin/shop/sales/data.js index 3784fe88..5d3ab229 100644 --- a/src/components/admin/shop/sales/data.js +++ b/src/components/admin/shop/sales/data.js @@ -1,65 +1,4 @@ const data = [ -<<<<<<< HEAD - { - name: 'Jan', - uv: 4300, - amt: 2400, - }, - { - name: 'Feb', - uv: 5600, - amt: 2210, - }, - { - name: 'Apr', - uv: 5408, - amt: 2290, - }, - { - name: 'May', - uv: 6420, - amt: 2000, - }, - { - name: 'Jun', - uv: 7500, - amt: 2181, - }, - { - name: 'Jul', - uv: 6300, - amt: 2500, - }, - { - name: 'Aug', - uv: 8600, - amt: 2100, - }, - { - name: 'Sep', - uv: 8300, - amt: 2100, - }, - { - name: 'Oct', - uv: 10200, - amt: 2100, - }, - { - name: 'Nov', - uv: 9500, - amt: 2100, - }, - { - name: 'Dev', - uv: 12200, - amt: 2100, - }, - ]; - - -export default data; -======= { name: "Jan", uv: 4300, @@ -118,4 +57,3 @@ export default data; ]; export default data; ->>>>>>> 2b09e140e1794032363f4b50c66a3b56fbf78506 diff --git a/src/pages/admin/shop/sales/ShopSales.jsx b/src/pages/admin/shop/sales/ShopSales.jsx index 77bbd42b..a216d194 100644 --- a/src/pages/admin/shop/sales/ShopSales.jsx +++ b/src/pages/admin/shop/sales/ShopSales.jsx @@ -1,50 +1,3 @@ -<<<<<<< HEAD -import SalesPreviewTable from "@/components/admin/shop/sales/SalesPreviewTable"; -import columns from "@/components/admin/shop/sales/SalesPreviewColumn"; -import { Link } from "react-router-dom"; -import data from "./data"; -import ShopSalesTrends from "./ShopSalesTrends"; -import { ChartComponent } from "@/components/admin/AdminReportCard"; - -function ShopSales() { - - return ( - <> -
-
-

Sales Report

-
-

Trends In Sales

-
- - - - -
- - -
-
- -
-
-
-

Shop

- - View All - -
- - -
-
- -
- -======= import { Link } from "react-router-dom"; import { ChartComponent } from "../../../../components/admin/AdminReportCard"; import columns from "../../../../components/admin/shop/sales/SalesPreviewColumn"; @@ -92,7 +45,6 @@ function ShopSales() {
->>>>>>> 2b09e140e1794032363f4b50c66a3b56fbf78506 ); } diff --git a/src/pages/admin/shop/sales/ShopSalesTrends.jsx b/src/pages/admin/shop/sales/ShopSalesTrends.jsx index 1d6304fa..3e47f33c 100644 --- a/src/pages/admin/shop/sales/ShopSalesTrends.jsx +++ b/src/pages/admin/shop/sales/ShopSalesTrends.jsx @@ -1,20 +1,6 @@ -<<<<<<< HEAD -import { SalesGraph } from "@/components/admin/shop/sales/SalesGraph"; - - -const ShopSalesTrends = () => { - return ( - <> - - - ) -}; -export default ShopSalesTrends -======= import SalesGraph from "../../../../components/admin/shop/sales/SalesGraph"; function ShopSalesTrends() { return ; } export default ShopSalesTrends; ->>>>>>> 2b09e140e1794032363f4b50c66a3b56fbf78506 diff --git a/src/pages/admin/shop/sales/data.js b/src/pages/admin/shop/sales/data.js index 622a037a..cdc7eb82 100644 --- a/src/pages/admin/shop/sales/data.js +++ b/src/pages/admin/shop/sales/data.js @@ -1,16 +1,4 @@ const data = [ -<<<<<<< HEAD - { id: "ITM-101", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 50 }, - { id: "ITM-102", name: 'SYT Hoodie', totalItems: 50, noOfId: "No. of items: 5", unitCost: "Unit Cost: KES 1000", totalSales: 5000, itemsRemaining: 40 }, - { id: "ITM-103", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 500 }, - { id: "ITM-104", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 30 }, - { id: "ITM-105", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 20 }, - { id: "ITM-106", name: 'SYT Beanie', totalItems: 400, noOfId: "No. of items: 350", unitCost: "Unit Cost: KES 350", totalSales: 1225000, itemsRemaining: 50 }, -]; - - -export default data; -======= { id: "ITM-101", name: "SYT Beanie", @@ -68,4 +56,3 @@ export default data; ]; export default data; ->>>>>>> 2b09e140e1794032363f4b50c66a3b56fbf78506 diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index 51cba0bf..95125ad1 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -21,4 +21,86 @@ test.describe("Landing page tests", () => { }) ).toBeVisible(); }); + + + test('Check "View More" button functionality', async ({ page }) => { + // Verify that the "View More" button is present and clickable + const viewMoreButton = page.locator('text="View More"'); + await expect(viewMoreButton).toBeVisible(); + await expect(viewMoreButton).toBeEnabled(); + + await viewMoreButton.click(); + await page.waitForTimeout(1000); + + const expectedNewContent = page.locator('h1'); + await expect(expectedNewContent).toBeVisible(); + }); + + // Test "HOW WE WORK" section + test("Check 'HOW WE WORK' section title and content", async ({ page }) => { + const howWeWorkSection = page.locator('text="HOW WE WORK"'); + await expect(howWeWorkSection).toBeVisible(); + + const howWeWorkContent = page.locator('.how-we-work-content'); + await expect(howWeWorkContent).toBeVisible(); + await expect(howWeWorkContent).toContainText('Our Approach'); + }); + + + test("Check 'WHAT WE DO' section title and content", async ({ page }) => { + const whatWeDoSection = page.locator('text="WHAT WE DO"'); + await expect(whatWeDoSection).toBeVisible(); + + const whatWeDoContent = page.locator('.what-we-do-content'); + await expect(whatWeDoContent).toBeVisible(); + await expect(whatWeDoContent).toContainText('Services'); + }); + + + test("Check 'OUR EVENTS' section title, events card, and 'View More' button", async ({ page }) => { + const ourEventsSection = page.locator('text="OUR EVENTS"'); + await expect(ourEventsSection).toBeVisible(); + + const eventCards = page.locator('.event-card'); + await expect(eventCards).toHaveCountGreaterThan(0); + + const viewMoreEventsButton = page.locator('.events-view-more'); + await expect(viewMoreEventsButton).toBeVisible(); + await expect(viewMoreEventsButton).toBeEnabled(); + }); + + + test("Check 'OUR IMPACT' section title and stats card", async ({ page }) => { + const ourImpactSection = page.locator('text="OUR IMPACT"'); + await expect(ourImpactSection).toBeVisible(); + + const statsCards = page.locator('.stats-card'); + await expect(statsCards).toHaveCountGreaterThan(0); + }); + + + test("Check 'TESTIMONIALS' section title and testimonial card in marquee", async ({ page }) => { + const testimonialsSection = page.locator('text="TESTIMONIALS"'); + await expect(testimonialsSection).toBeVisible(); + + const testimonialCards = page.locator('.testimonial-card'); + await expect(testimonialCards).toHaveCountGreaterThan(0); + + const marquee = page.locator('.testimonial-marquee'); + await expect(marquee).toBeVisible(); + }); + + + test("Check 'FAQ' section title and FAQ accordion", async ({ page }) => { + const faqSection = page.locator('text="FAQ"'); + await expect(faqSection).toBeVisible(); + + const faqAccordions = page.locator('.faq-accordion'); // Adjust selector as needed + await expect(faqAccordions).toHaveCountGreaterThan(0); + + await faqAccordions.first().click(); + await expect(faqAccordions.first().locator('.accordion-content')).toBeVisible(); + }); + + }); diff --git a/vite.config.js.timestamp-1724936058326-f5c1406d3f0ad.mjs b/vite.config.js.timestamp-1724936058326-f5c1406d3f0ad.mjs new file mode 100644 index 00000000..2807eb5a --- /dev/null +++ b/vite.config.js.timestamp-1724936058326-f5c1406d3f0ad.mjs @@ -0,0 +1,37 @@ +// vite.config.js +import path, { dirname } from "path"; +import { fileURLToPath } from "url"; +import react from "file:///home/andrew-dev/Desktop/Dev/SYT/SYT-Web-Redesign/node_modules/.pnpm/@vitejs+plugin-react@4.3.1_vite@5.4.2_@types+node@20.16.2_/node_modules/@vitejs/plugin-react/dist/index.mjs"; +import million from "file:///home/andrew-dev/Desktop/Dev/SYT/SYT-Web-Redesign/node_modules/.pnpm/million@3.1.11_rollup@4.21.1/node_modules/million/dist/packages/compiler.mjs"; +import { defineConfig, loadEnv } from "file:///home/andrew-dev/Desktop/Dev/SYT/SYT-Web-Redesign/node_modules/.pnpm/vite@5.4.2_@types+node@20.16.2/node_modules/vite/dist/node/index.js"; +var __vite_injected_original_import_meta_url = "file:///home/andrew-dev/Desktop/Dev/SYT/SYT-Web-Redesign/vite.config.js"; +var __filename = fileURLToPath(__vite_injected_original_import_meta_url); +var __dirname = dirname(__filename); +var vite_config_default = defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd(), ""); + return { + define: { + "process.env.REACT_APP_API_BASE_URL": JSON.stringify( + env.REACT_APP_API_BASE_URL + ) + }, + plugins: [million.vite({ auto: true }), react()], + test: { + include: ["src/**/*.test.js"] + }, + server: { + watch: { + usePolling: true + } + }, + resolve: { + alias: { + "@": path.resolve(__dirname, "./src") + } + } + }; +}); +export { + vite_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcuanMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvaG9tZS9hbmRyZXctZGV2L0Rlc2t0b3AvRGV2L1NZVC9TWVQtV2ViLVJlZGVzaWduXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCIvaG9tZS9hbmRyZXctZGV2L0Rlc2t0b3AvRGV2L1NZVC9TWVQtV2ViLVJlZGVzaWduL3ZpdGUuY29uZmlnLmpzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9ob21lL2FuZHJldy1kZXYvRGVza3RvcC9EZXYvU1lUL1NZVC1XZWItUmVkZXNpZ24vdml0ZS5jb25maWcuanNcIjsvKiBlc2xpbnQtZGlzYWJsZSBpbXBvcnQvbm8tZXh0cmFuZW91cy1kZXBlbmRlbmNpZXMgKi9cbi8qIGVzbGludC1kaXNhYmxlIG5vLXVuZGVyc2NvcmUtZGFuZ2xlICovXG4vLy8gPHJlZmVyZW5jZSB0eXBlcz1cInZpdGVzdFwiIC8+XG5pbXBvcnQgcGF0aCwgeyBkaXJuYW1lIH0gZnJvbSBcInBhdGhcIjtcbmltcG9ydCB7IGZpbGVVUkxUb1BhdGggfSBmcm9tIFwidXJsXCI7XG5pbXBvcnQgcmVhY3QgZnJvbSBcIkB2aXRlanMvcGx1Z2luLXJlYWN0XCI7XG5pbXBvcnQgbWlsbGlvbiBmcm9tIFwibWlsbGlvbi9jb21waWxlclwiO1xuaW1wb3J0IHsgZGVmaW5lQ29uZmlnLCBsb2FkRW52IH0gZnJvbSBcInZpdGVcIjtcblxuY29uc3QgX19maWxlbmFtZSA9IGZpbGVVUkxUb1BhdGgoaW1wb3J0Lm1ldGEudXJsKTtcbmNvbnN0IF9fZGlybmFtZSA9IGRpcm5hbWUoX19maWxlbmFtZSk7XG5cbi8vIGh0dHBzOi8vdml0ZWpzLmRldi9jb25maWcvXG5leHBvcnQgZGVmYXVsdCBkZWZpbmVDb25maWcoKHsgbW9kZSB9KSA9PiB7XG4gIGNvbnN0IGVudiA9IGxvYWRFbnYobW9kZSwgcHJvY2Vzcy5jd2QoKSwgXCJcIik7XG4gIHJldHVybiB7XG4gICAgZGVmaW5lOiB7XG4gICAgICBcInByb2Nlc3MuZW52LlJFQUNUX0FQUF9BUElfQkFTRV9VUkxcIjogSlNPTi5zdHJpbmdpZnkoXG4gICAgICAgIGVudi5SRUFDVF9BUFBfQVBJX0JBU0VfVVJMXG4gICAgICApLFxuICAgIH0sXG4gICAgcGx1Z2luczogW21pbGxpb24udml0ZSh7IGF1dG86IHRydWUgfSksIHJlYWN0KCldLFxuICAgIHRlc3Q6IHtcbiAgICAgIGluY2x1ZGU6IFtcInNyYy8qKi8qLnRlc3QuanNcIl0sXG4gICAgfSxcbiAgICBzZXJ2ZXI6IHtcbiAgICAgIHdhdGNoOiB7XG4gICAgICAgIHVzZVBvbGxpbmc6IHRydWUsXG4gICAgICB9LFxuICAgIH0sXG4gICAgcmVzb2x2ZToge1xuICAgICAgYWxpYXM6IHtcbiAgICAgICAgXCJAXCI6IHBhdGgucmVzb2x2ZShfX2Rpcm5hbWUsIFwiLi9zcmNcIiksXG4gICAgICB9LFxuICAgIH0sXG4gIH07XG59KTtcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFHQSxPQUFPLFFBQVEsZUFBZTtBQUM5QixTQUFTLHFCQUFxQjtBQUM5QixPQUFPLFdBQVc7QUFDbEIsT0FBTyxhQUFhO0FBQ3BCLFNBQVMsY0FBYyxlQUFlO0FBUG9LLElBQU0sMkNBQTJDO0FBUzNQLElBQU0sYUFBYSxjQUFjLHdDQUFlO0FBQ2hELElBQU0sWUFBWSxRQUFRLFVBQVU7QUFHcEMsSUFBTyxzQkFBUSxhQUFhLENBQUMsRUFBRSxLQUFLLE1BQU07QUFDeEMsUUFBTSxNQUFNLFFBQVEsTUFBTSxRQUFRLElBQUksR0FBRyxFQUFFO0FBQzNDLFNBQU87QUFBQSxJQUNMLFFBQVE7QUFBQSxNQUNOLHNDQUFzQyxLQUFLO0FBQUEsUUFDekMsSUFBSTtBQUFBLE1BQ047QUFBQSxJQUNGO0FBQUEsSUFDQSxTQUFTLENBQUMsUUFBUSxLQUFLLEVBQUUsTUFBTSxLQUFLLENBQUMsR0FBRyxNQUFNLENBQUM7QUFBQSxJQUMvQyxNQUFNO0FBQUEsTUFDSixTQUFTLENBQUMsa0JBQWtCO0FBQUEsSUFDOUI7QUFBQSxJQUNBLFFBQVE7QUFBQSxNQUNOLE9BQU87QUFBQSxRQUNMLFlBQVk7QUFBQSxNQUNkO0FBQUEsSUFDRjtBQUFBLElBQ0EsU0FBUztBQUFBLE1BQ1AsT0FBTztBQUFBLFFBQ0wsS0FBSyxLQUFLLFFBQVEsV0FBVyxPQUFPO0FBQUEsTUFDdEM7QUFBQSxJQUNGO0FBQUEsRUFDRjtBQUNGLENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== From 5dedea0594fead9bae47db0a4451a01782dce760 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Tue, 17 Sep 2024 16:06:07 +0300 Subject: [PATCH 03/22] fix: linting issues --- tests/pages/landing-page.spec.js | 46 +++++++++++++++----------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index 95125ad1..d9e91186 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -22,17 +22,16 @@ test.describe("Landing page tests", () => { ).toBeVisible(); }); - test('Check "View More" button functionality', async ({ page }) => { // Verify that the "View More" button is present and clickable const viewMoreButton = page.locator('text="View More"'); await expect(viewMoreButton).toBeVisible(); - await expect(viewMoreButton).toBeEnabled(); + await expect(viewMoreButton[0]).toBeEnabled(); await viewMoreButton.click(); - await page.waitForTimeout(1000); + await page.waitForTimeout(1000); - const expectedNewContent = page.locator('h1'); + const expectedNewContent = page.locator("h1"); await expect(expectedNewContent).toBeVisible(); }); @@ -41,66 +40,65 @@ test.describe("Landing page tests", () => { const howWeWorkSection = page.locator('text="HOW WE WORK"'); await expect(howWeWorkSection).toBeVisible(); - const howWeWorkContent = page.locator('.how-we-work-content'); + const howWeWorkContent = page.locator(".how-we-work-content"); await expect(howWeWorkContent).toBeVisible(); - await expect(howWeWorkContent).toContainText('Our Approach'); + await expect(howWeWorkContent).toContainText("Our Approach"); }); - test("Check 'WHAT WE DO' section title and content", async ({ page }) => { const whatWeDoSection = page.locator('text="WHAT WE DO"'); await expect(whatWeDoSection).toBeVisible(); - const whatWeDoContent = page.locator('.what-we-do-content'); + const whatWeDoContent = page.locator(".what-we-do-content"); await expect(whatWeDoContent).toBeVisible(); - await expect(whatWeDoContent).toContainText('Services'); + await expect(whatWeDoContent).toContainText("Services"); }); - - test("Check 'OUR EVENTS' section title, events card, and 'View More' button", async ({ page }) => { + test("Check 'OUR EVENTS' section title, events card, and 'View More' button", async ({ + page, + }) => { const ourEventsSection = page.locator('text="OUR EVENTS"'); await expect(ourEventsSection).toBeVisible(); - const eventCards = page.locator('.event-card'); + const eventCards = page.locator(".event-card"); await expect(eventCards).toHaveCountGreaterThan(0); - const viewMoreEventsButton = page.locator('.events-view-more'); + const viewMoreEventsButton = page.locator(".events-view-more"); await expect(viewMoreEventsButton).toBeVisible(); await expect(viewMoreEventsButton).toBeEnabled(); }); - test("Check 'OUR IMPACT' section title and stats card", async ({ page }) => { const ourImpactSection = page.locator('text="OUR IMPACT"'); await expect(ourImpactSection).toBeVisible(); - const statsCards = page.locator('.stats-card'); + const statsCards = page.locator(".stats-card"); await expect(statsCards).toHaveCountGreaterThan(0); }); - - test("Check 'TESTIMONIALS' section title and testimonial card in marquee", async ({ page }) => { + test("Check 'TESTIMONIALS' section title and testimonial card in marquee", async ({ + page, + }) => { const testimonialsSection = page.locator('text="TESTIMONIALS"'); await expect(testimonialsSection).toBeVisible(); - const testimonialCards = page.locator('.testimonial-card'); + const testimonialCards = page.locator(".testimonial-card"); await expect(testimonialCards).toHaveCountGreaterThan(0); - const marquee = page.locator('.testimonial-marquee'); + const marquee = page.locator(".testimonial-marquee"); await expect(marquee).toBeVisible(); }); - test("Check 'FAQ' section title and FAQ accordion", async ({ page }) => { const faqSection = page.locator('text="FAQ"'); await expect(faqSection).toBeVisible(); - const faqAccordions = page.locator('.faq-accordion'); // Adjust selector as needed + const faqAccordions = page.locator(".faq-accordion"); // Adjust selector as needed await expect(faqAccordions).toHaveCountGreaterThan(0); await faqAccordions.first().click(); - await expect(faqAccordions.first().locator('.accordion-content')).toBeVisible(); + await expect( + faqAccordions.first().locator(".accordion-content") + ).toBeVisible(); }); - - }); From 1da557605ee118abe9579d89d646f2f51f04d884 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Tue, 17 Sep 2024 16:07:46 +0300 Subject: [PATCH 04/22] fix: linting issues --- tests/pages/landing-page.spec.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index d9e91186..c7d3e03d 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -22,8 +22,10 @@ test.describe("Landing page tests", () => { ).toBeVisible(); }); + // eslint-disable-next-line quotes test('Check "View More" button functionality', async ({ page }) => { // Verify that the "View More" button is present and clickable + // eslint-disable-next-line quotes const viewMoreButton = page.locator('text="View More"'); await expect(viewMoreButton).toBeVisible(); await expect(viewMoreButton[0]).toBeEnabled(); @@ -37,6 +39,7 @@ test.describe("Landing page tests", () => { // Test "HOW WE WORK" section test("Check 'HOW WE WORK' section title and content", async ({ page }) => { + // eslint-disable-next-line quotes const howWeWorkSection = page.locator('text="HOW WE WORK"'); await expect(howWeWorkSection).toBeVisible(); @@ -57,6 +60,7 @@ test.describe("Landing page tests", () => { test("Check 'OUR EVENTS' section title, events card, and 'View More' button", async ({ page, }) => { + // eslint-disable-next-line quotes const ourEventsSection = page.locator('text="OUR EVENTS"'); await expect(ourEventsSection).toBeVisible(); @@ -69,6 +73,7 @@ test.describe("Landing page tests", () => { }); test("Check 'OUR IMPACT' section title and stats card", async ({ page }) => { + // eslint-disable-next-line quotes const ourImpactSection = page.locator('text="OUR IMPACT"'); await expect(ourImpactSection).toBeVisible(); @@ -79,6 +84,7 @@ test.describe("Landing page tests", () => { test("Check 'TESTIMONIALS' section title and testimonial card in marquee", async ({ page, }) => { + // eslint-disable-next-line quotes const testimonialsSection = page.locator('text="TESTIMONIALS"'); await expect(testimonialsSection).toBeVisible(); @@ -90,6 +96,7 @@ test.describe("Landing page tests", () => { }); test("Check 'FAQ' section title and FAQ accordion", async ({ page }) => { + // eslint-disable-next-line quotes const faqSection = page.locator('text="FAQ"'); await expect(faqSection).toBeVisible(); From 80a8872f2098ae1be82919245f70bd41a972f6fd Mon Sep 17 00:00:00 2001 From: alvyynm Date: Tue, 17 Sep 2024 16:25:25 +0300 Subject: [PATCH 05/22] fix(test): view more btn functionality test --- tests/pages/landing-page.spec.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index c7d3e03d..1bd95b89 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -26,15 +26,12 @@ test.describe("Landing page tests", () => { test('Check "View More" button functionality', async ({ page }) => { // Verify that the "View More" button is present and clickable // eslint-disable-next-line quotes - const viewMoreButton = page.locator('text="View More"'); + const viewMoreButton = page.locator('text="View More"').first(); await expect(viewMoreButton).toBeVisible(); - await expect(viewMoreButton[0]).toBeEnabled(); + await expect(viewMoreButton).toBeEnabled(); await viewMoreButton.click(); await page.waitForTimeout(1000); - - const expectedNewContent = page.locator("h1"); - await expect(expectedNewContent).toBeVisible(); }); // Test "HOW WE WORK" section From 6de3e5d09e32421fa21d57398b5c8469923fdda0 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Tue, 17 Sep 2024 16:26:14 +0300 Subject: [PATCH 06/22] fix: linting issues --- tests/pages/landing-page.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index 1bd95b89..be004202 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -46,6 +46,7 @@ test.describe("Landing page tests", () => { }); test("Check 'WHAT WE DO' section title and content", async ({ page }) => { + // eslint-disable-next-line quotes const whatWeDoSection = page.locator('text="WHAT WE DO"'); await expect(whatWeDoSection).toBeVisible(); From c96f67e2b2090093750470921feddd2ca68d7c20 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Tue, 17 Sep 2024 16:37:48 +0300 Subject: [PATCH 07/22] fix(test): 'check how we work' test --- tests/pages/landing-page.spec.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index be004202..7d6f1be0 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -37,12 +37,8 @@ test.describe("Landing page tests", () => { // Test "HOW WE WORK" section test("Check 'HOW WE WORK' section title and content", async ({ page }) => { // eslint-disable-next-line quotes - const howWeWorkSection = page.locator('text="HOW WE WORK"'); + const howWeWorkSection = page.locator('text="How we work"').first(); await expect(howWeWorkSection).toBeVisible(); - - const howWeWorkContent = page.locator(".how-we-work-content"); - await expect(howWeWorkContent).toBeVisible(); - await expect(howWeWorkContent).toContainText("Our Approach"); }); test("Check 'WHAT WE DO' section title and content", async ({ page }) => { From 63b52febb3d5dde9cb679d11d9fe74f9bbb3f7bd Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 01:16:09 +0300 Subject: [PATCH 08/22] test: create data-testid in UpcomingEventCard component --- src/pages/landingPage/sections/OurEvents.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/landingPage/sections/OurEvents.jsx b/src/pages/landingPage/sections/OurEvents.jsx index 4b57995d..1040687b 100644 --- a/src/pages/landingPage/sections/OurEvents.jsx +++ b/src/pages/landingPage/sections/OurEvents.jsx @@ -99,6 +99,7 @@ function UpcomingEventCard({ event }) {
From cffe922343b2d71754a86a4e43644b1629d43f67 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 02:11:52 +0300 Subject: [PATCH 09/22] feat: add props to Button component --- src/components/Button.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Button.jsx b/src/components/Button.jsx index 39bb8135..304e26dc 100644 --- a/src/components/Button.jsx +++ b/src/components/Button.jsx @@ -3,13 +3,15 @@ import React from "react"; import { FiArrowRightCircle } from "react-icons/fi"; import { Link } from "react-router-dom"; -function Button({ link, title }) { +function Button({ link, title, ...props }) { return (
From 9b01d8444244054ca3185008a66962cb90ae6af6 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 02:12:40 +0300 Subject: [PATCH 10/22] test: add data-testid props to Button component --- src/pages/landingPage/sections/OurEvents.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/landingPage/sections/OurEvents.jsx b/src/pages/landingPage/sections/OurEvents.jsx index 1040687b..6e8829a2 100644 --- a/src/pages/landingPage/sections/OurEvents.jsx +++ b/src/pages/landingPage/sections/OurEvents.jsx @@ -44,7 +44,12 @@ function OurEvents() {

Upcoming Events

-
{isError && ( From b8a9b9eef99710825a3fe317d4d4364a0512d467 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 02:15:31 +0300 Subject: [PATCH 11/22] fix(test): properly check if Our Events section is visible --- tests/pages/landing-page.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index 7d6f1be0..3243d7bd 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -55,7 +55,7 @@ test.describe("Landing page tests", () => { page, }) => { // eslint-disable-next-line quotes - const ourEventsSection = page.locator('text="OUR EVENTS"'); + const ourEventsSection = page.locator('text="our events"').first(); await expect(ourEventsSection).toBeVisible(); const eventCards = page.locator(".event-card"); From 6fb3cd13e6b2086617de7638108a563173c00b92 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 02:16:30 +0300 Subject: [PATCH 12/22] fix(test): properly check if at least one event is shown --- tests/pages/landing-page.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index 3243d7bd..8b974f5e 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -58,8 +58,9 @@ test.describe("Landing page tests", () => { const ourEventsSection = page.locator('text="our events"').first(); await expect(ourEventsSection).toBeVisible(); - const eventCards = page.locator(".event-card"); - await expect(eventCards).toHaveCountGreaterThan(0); + // checks if at least one event card is displayed + const eventCards = page.locator("data-testid=event-cards").first(); + await expect(eventCards).toBeVisible(); const viewMoreEventsButton = page.locator(".events-view-more"); await expect(viewMoreEventsButton).toBeVisible(); From cbe812df588e72f305fbf6b5ff46d2c68f40f22f Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 02:18:55 +0300 Subject: [PATCH 13/22] fix(test): add appropriate selector to check for 'View More' events btn --- tests/pages/landing-page.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index 8b974f5e..f570d4a2 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -62,7 +62,7 @@ test.describe("Landing page tests", () => { const eventCards = page.locator("data-testid=event-cards").first(); await expect(eventCards).toBeVisible(); - const viewMoreEventsButton = page.locator(".events-view-more"); + const viewMoreEventsButton = page.locator("data-testid=events-view-more"); await expect(viewMoreEventsButton).toBeVisible(); await expect(viewMoreEventsButton).toBeEnabled(); }); From 009df0b8f99bc7cede4422cce685bd3b07bfa74f Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 02:20:37 +0300 Subject: [PATCH 14/22] test: assert clicking 'View More' events btn opens /events --- tests/pages/landing-page.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index f570d4a2..8eab3b2a 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -65,6 +65,8 @@ test.describe("Landing page tests", () => { const viewMoreEventsButton = page.locator("data-testid=events-view-more"); await expect(viewMoreEventsButton).toBeVisible(); await expect(viewMoreEventsButton).toBeEnabled(); + await viewMoreEventsButton.click(); + expect(page.url()).toBe("http://localhost:5173/events"); }); test("Check 'OUR IMPACT' section title and stats card", async ({ page }) => { From caed3c432df4cddb95885c06b4b88ec2598a58ca Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 02:20:37 +0300 Subject: [PATCH 15/22] fix(test): add appropriate selector to check for 'WHAT WE DO' content --- src/pages/landingPage/sections/WhatWeDo.jsx | 2 +- tests/pages/landing-page.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/landingPage/sections/WhatWeDo.jsx b/src/pages/landingPage/sections/WhatWeDo.jsx index 3036da0a..4b34ba97 100644 --- a/src/pages/landingPage/sections/WhatWeDo.jsx +++ b/src/pages/landingPage/sections/WhatWeDo.jsx @@ -25,7 +25,7 @@ function WhatWeDoCard({ card, index }) { const { title, description, image, link } = card; return (
diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index 8eab3b2a..75c286df 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -43,7 +43,7 @@ test.describe("Landing page tests", () => { test("Check 'WHAT WE DO' section title and content", async ({ page }) => { // eslint-disable-next-line quotes - const whatWeDoSection = page.locator('text="WHAT WE DO"'); + const whatWeDoSection = page.locator('text="what we do"'); await expect(whatWeDoSection).toBeVisible(); const whatWeDoContent = page.locator(".what-we-do-content"); From 4f3c64037fb3d83b46c5a4e6dad9fe58efe16820 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 02:48:40 +0300 Subject: [PATCH 16/22] fix(test): assert 'WHAT WE DO' content shows --- tests/pages/landing-page.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index 75c286df..e008f6d5 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -46,9 +46,8 @@ test.describe("Landing page tests", () => { const whatWeDoSection = page.locator('text="what we do"'); await expect(whatWeDoSection).toBeVisible(); - const whatWeDoContent = page.locator(".what-we-do-content"); + const whatWeDoContent = page.locator(".what-we-do-content").first(); await expect(whatWeDoContent).toBeVisible(); - await expect(whatWeDoContent).toContainText("Services"); }); test("Check 'OUR EVENTS' section title, events card, and 'View More' button", async ({ From 7ca29a537c42255fedf1833832016a40f7c2d276 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 10:02:59 +0300 Subject: [PATCH 17/22] fix(test): add appropriate selector to check for stats content --- src/pages/landingPage/sections/StatsSection.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/landingPage/sections/StatsSection.jsx b/src/pages/landingPage/sections/StatsSection.jsx index c941abcf..a28c0806 100644 --- a/src/pages/landingPage/sections/StatsSection.jsx +++ b/src/pages/landingPage/sections/StatsSection.jsx @@ -35,7 +35,7 @@ function StatsSection() { A community geared towards holistic results{" "} -
+
teams From 4d16a047b1c6e78cf869bf1ff5e7e3cd626ce666 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 10:04:50 +0300 Subject: [PATCH 18/22] fix(test): check 'OUR IMPACT' section title and stats card test --- tests/pages/landing-page.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index e008f6d5..ed3f1f68 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -70,11 +70,12 @@ test.describe("Landing page tests", () => { test("Check 'OUR IMPACT' section title and stats card", async ({ page }) => { // eslint-disable-next-line quotes - const ourImpactSection = page.locator('text="OUR IMPACT"'); + const ourImpactSection = page.getByText("our impact"); + await ourImpactSection.scrollIntoViewIfNeeded(); await expect(ourImpactSection).toBeVisible(); const statsCards = page.locator(".stats-card"); - await expect(statsCards).toHaveCountGreaterThan(0); + await expect(statsCards).toBeVisible(); }); test("Check 'TESTIMONIALS' section title and testimonial card in marquee", async ({ From baaaae54ef385e3cc9bfe311a36c6a170fe1828f Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 12:34:29 +0300 Subject: [PATCH 19/22] fix(test): add test id to check for testimonial content --- src/pages/landingPage/sections/TestimonialSection.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/landingPage/sections/TestimonialSection.jsx b/src/pages/landingPage/sections/TestimonialSection.jsx index 87e2bb58..2f5a9672 100644 --- a/src/pages/landingPage/sections/TestimonialSection.jsx +++ b/src/pages/landingPage/sections/TestimonialSection.jsx @@ -6,7 +6,10 @@ import { testimonialData } from "../data"; function TestimonialSection() { return ( -
+

What people are saying about us{" "}

From b67ad5c99ea15c474c1642076426a29fc4175737 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 12:36:53 +0300 Subject: [PATCH 20/22] fix(test): check 'TESTIMONIALS' section title & testimonial test --- tests/pages/landing-page.spec.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index ed3f1f68..6b4244c4 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -82,14 +82,18 @@ test.describe("Landing page tests", () => { page, }) => { // eslint-disable-next-line quotes - const testimonialsSection = page.locator('text="TESTIMONIALS"'); + const testimonialsSection = page.getByRole("heading", { + name: "testimonials", + }); + // await testimonialsSection.waitFor({ state: "visible", timeout: 60000 }); + await testimonialsSection.scrollIntoViewIfNeeded(); await expect(testimonialsSection).toBeVisible(); - const testimonialCards = page.locator(".testimonial-card"); - await expect(testimonialCards).toHaveCountGreaterThan(0); - - const marquee = page.locator(".testimonial-marquee"); - await expect(marquee).toBeVisible(); + // check if there's at least one testimonial card displayed + const testimonialCards = page.getByTestId("testimonial-card").first(); + await testimonialCards.waitFor({ state: "visible", timeout: 60000 }); + await testimonialCards.scrollIntoViewIfNeeded(); + await expect(testimonialCards).toBeVisible(); }); test("Check 'FAQ' section title and FAQ accordion", async ({ page }) => { From cb7b4cda66287b4c51188991a49be02fcf2edb72 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 13:00:49 +0300 Subject: [PATCH 21/22] fix(test): add test id to check for faq accordion --- src/components/FAQ.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/FAQ.jsx b/src/components/FAQ.jsx index efbd23b1..20cc1893 100644 --- a/src/components/FAQ.jsx +++ b/src/components/FAQ.jsx @@ -15,6 +15,7 @@ function FAQ({ questions = [] }) {

From f3435252a9f7f8f6865bad5955714ea915637e99 Mon Sep 17 00:00:00 2001 From: alvyynm Date: Wed, 18 Sep 2024 13:03:13 +0300 Subject: [PATCH 22/22] fix(test): check 'FAQ' section title & FAQ accordion test --- tests/pages/landing-page.spec.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/pages/landing-page.spec.js b/tests/pages/landing-page.spec.js index 6b4244c4..4d6ae05a 100644 --- a/tests/pages/landing-page.spec.js +++ b/tests/pages/landing-page.spec.js @@ -98,15 +98,18 @@ test.describe("Landing page tests", () => { test("Check 'FAQ' section title and FAQ accordion", async ({ page }) => { // eslint-disable-next-line quotes - const faqSection = page.locator('text="FAQ"'); + // check if faq section is visible + const faqSection = page.getByRole("heading", { name: "faq" }); await expect(faqSection).toBeVisible(); - const faqAccordions = page.locator(".faq-accordion"); // Adjust selector as needed - await expect(faqAccordions).toHaveCountGreaterThan(0); + // check if at least one FAQ accordion is visible + const faqAccordions = page.getByTestId("faq-accordion").first(); + await expect(faqAccordions).toBeVisible(); - await faqAccordions.first().click(); - await expect( - faqAccordions.first().locator(".accordion-content") - ).toBeVisible(); + // check if clicking accordion, displays answer + await faqAccordions.click(); + + const accordionContent = page.getByTestId("accordion-answer").first(); + await expect(accordionContent).toBeVisible(); }); });