diff --git a/apps/dsep/components/button/Button.tsx b/apps/dsep/components/button/Button.tsx index 403ab7399..695101583 100644 --- a/apps/dsep/components/button/Button.tsx +++ b/apps/dsep/components/button/Button.tsx @@ -7,6 +7,7 @@ export interface ButtonPropsModel { color: string handleOnClick?: () => void isDisabled: boolean + dataTest: string } const Button: React.FC = props => { @@ -26,6 +27,7 @@ const Button: React.FC = props => { marginBottom={'12px'} __css={{ '&:active': {} }} onClick={props.handleOnClick} + data-test={props.dataTest} > {props.buttonText} diff --git a/apps/dsep/components/cart/CartIcon.tsx b/apps/dsep/components/cart/CartIcon.tsx index 9a62dcf3e..9246598e7 100644 --- a/apps/dsep/components/cart/CartIcon.tsx +++ b/apps/dsep/components/cart/CartIcon.tsx @@ -5,6 +5,7 @@ import { AiOutlineShoppingCart } from 'react-icons/ai' import { cartUiActions } from '../../store/cartUI-slice' import { ICartUiRootState, ICartRootState } from '../../lib/types/cart' import { useLanguage } from '../../hooks/useLanguage' +import { testIds } from '@shared/dataTestIds' const Basket = () => { const dispatch = useDispatch() @@ -19,6 +20,7 @@ const Basket = () => { className="relative" onMouseOver={() => onMouseHoverHandler(true)} onMouseOut={() => onMouseHoverHandler(false)} + data-test={testIds.cartButton} > = ({ product, setIsLoadingForCartCountChange }) }} > {'product-name'} = ({ product, setIsLoadingForCartCountChange }) {counter === 1 ? (
decrement(product.id)} className="p-1" style={{ @@ -111,6 +114,7 @@ const CartItem: React.FC = ({ product, setIsLoadingForCartCountChange }) top: '0', right: '0' }} + data-test={testIds.cartpage_trashButton} > = ({ product, setIsLoadingForCartCountChange }) )}
= ({ product, setIsLoadingForCartCountChange }) style={{ marginRight: '10px' }} + data-test={testIds.cartpage_totalAmountText} > {t.totalAmount}

diff --git a/apps/dsep/components/cart/EmptyCart.tsx b/apps/dsep/components/cart/EmptyCart.tsx index 7f28b4fb6..2b857d2d4 100644 --- a/apps/dsep/components/cart/EmptyCart.tsx +++ b/apps/dsep/components/cart/EmptyCart.tsx @@ -6,6 +6,7 @@ import Styles from './EmptyCart.module.css' import { useLanguage } from '../../hooks/useLanguage' import Button from '../button/Button' import Router from 'next/router' +import { testIds } from '@shared/dataTestIds' const EmptyCart: React.FC = () => { const { t } = useLanguage() @@ -21,6 +22,7 @@ const EmptyCart: React.FC = () => { justifyContent={'center'} > { {t.noCourse} - {t.noCouseSubText} + + {t.noCouseSubText} +
diff --git a/apps/dsep/components/layout/Layout.tsx b/apps/dsep/components/layout/Layout.tsx index 27445a659..0f84efcc0 100644 --- a/apps/dsep/components/layout/Layout.tsx +++ b/apps/dsep/components/layout/Layout.tsx @@ -1,19 +1,17 @@ import React, { useEffect } from 'react' -import { Provider, useDispatch, useSelector } from 'react-redux' +import { useDispatch, useSelector } from 'react-redux' import Head from 'next/head' -import { ThemeProvider } from 'next-themes' import { useRouter } from 'next/router' import Header from '../header' -import Footer from '../footer' import { ToastContainer } from 'react-toastify' import { useLanguage } from '../../hooks/useLanguage' import NextNProgress from 'nextjs-progressbar' import cs from 'classnames' -import { PersistGate } from 'redux-persist/integration/react' import { Toast } from '@beckn-ui/molecules' import { ToastType } from '@beckn-ui/molecules/src/components/toast/Toast-type' import { useToast } from '@chakra-ui/react' import { feedbackActions, FeedbackRootState } from '../../store/ui-feedback-slice' +import { testIds } from '@shared/dataTestIds' const Layout: React.FC<{ children?: React.ReactNode }> = ({ children }) => { const { locale } = useLanguage() @@ -44,6 +42,7 @@ const Layout: React.FC<{ children?: React.ReactNode }> = ({ children }) => { title={message} description={description} onClose={onClose} + dataTest={testIds.feedback} /> ) }) diff --git a/apps/dsep/components/productCard/product-card-renderer.tsx b/apps/dsep/components/productCard/product-card-renderer.tsx index 7e70c1218..4c02fa76c 100644 --- a/apps/dsep/components/productCard/product-card-renderer.tsx +++ b/apps/dsep/components/productCard/product-card-renderer.tsx @@ -5,6 +5,7 @@ import { useLanguage } from '../../hooks/useLanguage' import StarIcon from '../../public/images/Star.svg' import { toBinary } from '../../utilities/common-utils' import ProductPrice from '../UI/ProductPrice' +import { testIds } from '@shared/dataTestIds' const ProductCardRenderer = (data: any) => { // const [distance, setDistance] = useState(0) @@ -33,6 +34,7 @@ const ProductCardRenderer = (data: any) => { rounded="xl" bg="#fff" position="relative" + data-test={testIds.searchpage_products} > diff --git a/apps/dsep/components/productDetails/index.tsx b/apps/dsep/components/productDetails/index.tsx index 627f22d35..0ac2417ba 100644 --- a/apps/dsep/components/productDetails/index.tsx +++ b/apps/dsep/components/productDetails/index.tsx @@ -53,7 +53,8 @@ const ProductDetails: React.FC = ({ product }) => { rating: product.item.rating, size: 20, setRating: () => {}, - starCount: 5 + starCount: 5, + dataTest: testIds.item_rating }, productCta: { noCounter: true, diff --git a/apps/dsep/components/productList/ProductList.tsx b/apps/dsep/components/productList/ProductList.tsx index 8f2f20319..113102715 100644 --- a/apps/dsep/components/productList/ProductList.tsx +++ b/apps/dsep/components/productList/ProductList.tsx @@ -6,6 +6,7 @@ import { ParsedItemModel } from '../../types/search.types' import { ProductCard } from '@beckn-ui/becknified-components' import ProductCardRenderer from '../productCard/product-card-renderer' import Typography from '@beckn-ui/molecules/src/components/typography/typography' +import { testIds } from '@shared/dataTestIds' interface ProductListPropsModel { productList: ParsedItemModel[] @@ -76,6 +77,7 @@ const ProductList: React.FC = ({ productList }) => { )} diff --git a/apps/dsep/components/productList/Sort.tsx b/apps/dsep/components/productList/Sort.tsx index cad0aacb0..2567174f6 100644 --- a/apps/dsep/components/productList/Sort.tsx +++ b/apps/dsep/components/productList/Sort.tsx @@ -3,6 +3,7 @@ import { useLanguage } from '../../hooks/useLanguage' import { BsFilterLeft, BsArrowDown } from 'react-icons/bs' import { radioBtnValue } from '../../mock/sortRadioInput' import { Box } from '@chakra-ui/react' +import { testIds } from '@shared/dataTestIds' interface Props { selectedBtn: string @@ -21,6 +22,7 @@ const Sort: React.FC = ({ selectedBtn: selectedRadioBtn, onChangeSelected padding={'20px 0 0 0'} width={'100%'} ml={'-20px'} + data-test={testIds.searchpage_filterContainer} >
= ({ selectedBtn: selectedRadioBtn, onChangeSelected ? 'text-palette-primary font-bold' : 'text-palette-mute/80 hover:text-palette-base transition-all' }`} + data-test={radioInput} > {t[radioInput]} @@ -81,6 +84,7 @@ const Sort: React.FC = ({ selectedBtn: selectedRadioBtn, onChangeSelected type="radio" className="hidden" id={radioInput} + data-test={radioInput} value={selectedRadioBtn} name="sortProduct" checked={isRadioSelected(radioInput)} diff --git a/apps/dsep/pages/cart.tsx b/apps/dsep/pages/cart.tsx index a2e5db2c2..8190f450a 100644 --- a/apps/dsep/pages/cart.tsx +++ b/apps/dsep/pages/cart.tsx @@ -14,6 +14,7 @@ import { Box } from '@chakra-ui/react' import { Item, SelectResponseModel } from '../lib/types/select.types' import LoaderWithMessage from '@beckn-ui/molecules/src/components/LoaderWithMessage/loader-with-message' import { toast } from 'react-toastify' +import { testIds } from '@shared/dataTestIds' const Cart = () => { const [itemsForCart, setItemsForCart] = useState(null) @@ -73,6 +74,7 @@ const Cart = () => { display={'grid'} height={'calc(100vh - 300px)'} alignContent={'center'} + data-test={testIds.loadingIndicator} > { const [items, setItems] = useState([]) @@ -105,6 +106,7 @@ const Search = () => { display={'grid'} height={'calc(100vh - 300px)'} alignContent={'center'} + data-test={testIds.loadingIndicator} > { + context('Signin flow', () => { + beforeEach(() => { + cy.visit(testIds.url_base) + }) + + it('should display the sign-in form with email and password fields', () => { + cy.getByData(testIds.auth_inputEmail).should('exist').and('be.visible') + cy.getByData(testIds.auth_inputPassword).should('exist').and('be.visible') + }) + + it('should display the sign-in and sign-up buttons', () => { + cy.getByData(testIds.auth_loginButton).should('exist').and('be.visible') + cy.getByData(testIds.auth_registerButton).should('exist').and('be.visible') + }) + + it('should disable the signin button when form is submitted with empty fields', () => { + cy.getByData(testIds.auth_loginButton).should('be.disabled') + }) + + it('should update email and password fields when typed into', () => { + cy.getByData(testIds.auth_inputEmail).type(testIds.user_validEmail) + cy.getByData(testIds.auth_inputEmail).should('have.value', testIds.user_validEmail) + cy.getByData(testIds.auth_inputPassword).type(testIds.user_validPassword) + cy.getByData(testIds.auth_inputPassword).should('have.value', testIds.user_validPassword) + }) + + it('should enable the Sign In button when both fields are filled', () => { + cy.getByData(testIds.auth_inputEmail).type(testIds.user_validEmail) + cy.getByData(testIds.auth_inputPassword).type(testIds.user_validPassword) + cy.getByData(testIds.auth_loginButton).should('not.be.disabled') + }) + + it('should show error toast on unsuccessful login', () => { + cy.getByData(testIds.auth_inputEmail).type(testIds.user_validEmail) + cy.getByData(testIds.auth_inputPassword).type(testIds.user_invalidPassword) + cy.getByData(testIds.auth_loginButton).click() + cy.getByData(testIds.feedback).should('contain.text', 'Invalid identifier or password') + }) + + it('should navigate to sign-up page when Sign Up button is clicked', () => { + cy.contains('button', 'Sign Up').click() + cy.url().should('include', testIds.url_signup) + }) + + it('should redirect to homePage and have token in cookie on successful login', () => { + cy.login(testIds.url_base, testIds.user_validEmail, testIds.user_validPassword) + cy.url().should('include', testIds.url_home) + cy.getCookie('authToken').should('exist') + }) + }) +}) diff --git a/cypress/e2e/dsep/cart.cy.ts b/cypress/e2e/dsep/cart.cy.ts new file mode 100644 index 000000000..fee074a47 --- /dev/null +++ b/cypress/e2e/dsep/cart.cy.ts @@ -0,0 +1,67 @@ +import { testIds } from '../../../shared/dataTestIds' +describe('Cart Page Tests', () => { + before(() => { + cy.login(testIds.url_base, testIds.user_validEmail, testIds.user_validPassword) + }) + context('When there are no items in cart', () => { + const searchTerm = 'Java' + beforeEach(() => { + cy.visit(`${testIds.url_base}${testIds.url_home}`) + cy.performSearch(searchTerm, { + fixture: 'DSEP/searchPage/searchResults.json' + }) + cy.getByData(testIds.cartButton).click() + }) + + it('should render the cart page with no items', () => { + cy.url().should('include', testIds.url_cart) + cy.getByData(testIds.cartpage_emptyheading).should('contain.text', 'No Course!') + cy.getByData(testIds.cartpage_emptySubHeading).should('contain.text', `Seems like you haven't selected a course`) + cy.getByData(testIds.cartpage_emptyImage).should('have.attr', 'src') + cy.getByData(testIds.cartpage_emptyButton).should('contain.text', 'Search Courses') + }) + }) + context('should render When there are Items in Cart', () => { + const searchTerm = 'Java' + beforeEach(() => { + cy.visit(`${testIds.url_base}${testIds.url_home}`) + cy.performSearch(searchTerm, { + fixture: 'DSEP/searchPage/searchResults.json' + }) + cy.getByData(testIds.searchpage_products).first().click() + cy.url().should('include', testIds.url_product) + cy.getByData(testIds.productpage_addTocartButton).click() + cy.intercept('POST', '/select', { fixture: 'DSEP/cart/selectResult.json' }).as('selectCall') + cy.getByData(testIds.cartButton).click() + cy.wait('@selectCall') + }) + + it('should render the cart page when counter is one and trash button is clicked', () => { + cy.getByData(testIds.cartpage_trashButton).click() + cy.url().should('include', testIds.url_cart) + cy.getByData(testIds.cartpage_emptyheading).should('contain.text', 'No Course!') + cy.getByData(testIds.cartpage_emptySubHeading).should('contain.text', `Seems like you haven't selected a course`) + cy.getByData(testIds.cartpage_emptyImage).should('have.attr', 'src') + cy.getByData(testIds.cartpage_emptyButton).should('contain.text', 'Search Courses') + cy.getByData(testIds.cartpage_emptyButton).click() + cy.visit(`${testIds.url_base}${testIds.url_home}`) + }) + + it('should render and display cart page with result', () => { + cy.getByData(testIds.cartpage_itemImage).should('have.attr', 'src') + cy.getByData(testIds.cartpage_itemName).should('be.visible') + cy.getByData('item-price').should('be.visible') + cy.url().should('include', testIds.url_cart) + }) + it('should render and display cart page Order Summary ', () => { + cy.getByData(testIds.cartpage_orderSummaryText).should('contain.text', 'Order Summary') + cy.getByData(testIds.cartSubTotal_Text).should('contain.text', 'Sub-Total') + cy.getByData(testIds.cartpage_totalAmountText).should('contain.text', 'Total') + }) + + it('Should conatin order Button and click on it render it on checkout page', () => { + cy.getByData(testIds.cartpage_cartOrderButton).should('contain.text', 'Checkout') + cy.getByData(testIds.cartpage_cartOrderButton).click() + }) + }) +}) diff --git a/cypress/e2e/dsep/homePage.cy.ts b/cypress/e2e/dsep/homePage.cy.ts new file mode 100644 index 000000000..cc82178c2 --- /dev/null +++ b/cypress/e2e/dsep/homePage.cy.ts @@ -0,0 +1,28 @@ +import { testIds } from '../../../shared/dataTestIds' + +describe('Home Page Tests', () => { + before(() => { + cy.login(testIds.url_base, testIds.user_validEmail, testIds.user_validPassword) + }) + it('should render the homepage components', () => { + cy.getByData(testIds.homepage_appTitle).should('be.visible') + cy.getByData(testIds.homepage_appDescription).should('be.visible') + cy.getByData(testIds.searchInput).should('be.visible') + cy.getByData(testIds.homepage_footer).should('be.visible') + }) + + it('should render the app title & description', () => { + cy.getByData(testIds.homepage_appTitle).should('contain.text', 'Skill Up') + cy.getByData(testIds.homepage_appDescription).should( + 'contain.text', + 'Discover diverse online resources, scholarships, and job opportunities in one convenient platform, enhancing your expertise across multiple fields.' + ) + }) + + it('should perform search and navigate to search results', () => { + cy.getByData(testIds.searchInput).type('java') + cy.getByData(testIds.searchButton).click() + cy.getByData(testIds.loadingIndicator).should('be.visible') + cy.url().should('include', `${testIds.url_search}?searchTerm=java`) + }) +}) diff --git a/cypress/e2e/dsep/product.cy.ts b/cypress/e2e/dsep/product.cy.ts new file mode 100644 index 000000000..6002ee369 --- /dev/null +++ b/cypress/e2e/dsep/product.cy.ts @@ -0,0 +1,45 @@ +import { testIds } from '../../../shared/dataTestIds' + +describe('Product details Page Tests', () => { + const searchTerm = 'Java' + + before(() => { + cy.login(testIds.url_base, testIds.user_validEmail, testIds.user_validPassword) + }) + + beforeEach(() => { + cy.visit(`${testIds.url_base}${testIds.url_home}`) + cy.performSearch(searchTerm, { + fixture: 'DSEP/searchPage/searchResults.json' + }) + cy.selectProduct(0) + }) + + it('should render the product details component', () => { + cy.url().should('include', testIds.url_product) + cy.getByData(testIds.productpage_addTocartButton).should('be.visible') + }) + it('should navigate to cart on cart icon click', () => { + cy.getByData(testIds.cartButton).click() + cy.url().should('include', testIds.url_cart) + }) + + it('should render details of selected product', () => { + cy.getByData(testIds.item_title).should('contain.text', 'java springboot book One') + cy.getByData('rating-container').should('be.visible') + cy.getByData(testIds.item_description).should('contain.text', 'java springboot book One') + cy.getByData(testIds.item_price).should('contain.text', '₹2,000.00') + cy.getByData(testIds.productpage_addTocartButton).should('contain.text', 'Add to Cart') + }) + + it('should add product in cart on add to cart btn click', () => { + cy.getByData(testIds.productpage_addTocartButton).click() + cy.getByData(testIds.feedback).should('contain.text', 'Product added to cart') + }) + + it('should navigate to cart on cart icon click', () => { + cy.getByData(testIds.cartButton).click() + cy.getByData(testIds.loadingIndicator).should('be.visible') + cy.url().should('include', testIds.url_cart) + }) +}) diff --git a/cypress/e2e/dsep/searchPage.cy.ts b/cypress/e2e/dsep/searchPage.cy.ts new file mode 100644 index 000000000..b19318f2f --- /dev/null +++ b/cypress/e2e/dsep/searchPage.cy.ts @@ -0,0 +1,91 @@ +import { testIds } from '../../../shared/dataTestIds' + +describe('Search Page Tests', () => { + before(() => { + cy.login(testIds.url_base, testIds.user_validEmail, testIds.user_validPassword) + }) + + context('When there are no search results', () => { + const searchTerm = 'java' + + beforeEach(() => { + cy.visit(testIds.url_base) + cy.performSearch(searchTerm, { + fixture: 'searchPage/emptySearchResults.json' + }) + }) + + it('should render the search page components', () => { + cy.getByData(testIds.searchInput).should('be.visible') + cy.getByData(testIds.searchpage_filterContainer).should('be.visible') + }) + + it('should render the search page components', () => { + cy.getByData(testIds.searchInput).should('be.visible') + cy.getByData(testIds.searchpage_filterContainer).should('be.visible') + }) + it('should render the message if no product to display', () => { + cy.getByData(testIds.noDataAvailable).should('be.visible') + cy.getByData(testIds.noDataAvailable).should( + 'contain.text', + 'There are no products in this category yet! New products will be added soon.' + ) + }) + + it('should render the filter section with sort option', () => { + cy.getByData(testIds.searchpage_filterContainer).should('be.visible') + cy.getByData('all').should('be.visible') + cy.getByData('cheapest').should('be.visible') + cy.getByData('expensive').should('be.visible') + }) + + it('should render the sort option with default values', () => { + cy.getByData('all').should('contain.text', 'All') + cy.getByData('expensive').should('contain.text', 'Expensive') + cy.getByData('cheapest').should('contain.text', 'Cheapest') + }) + it('should navigate to cart on cart icon click', () => { + cy.getByData(testIds.cartButton).click() + cy.url().should('include', testIds.url_cart) + }) + }) + + context('When there are search results', () => { + const searchTerm = 'java' + + beforeEach(() => { + cy.visit(testIds.url_base) + cy.performSearch(searchTerm, { + fixture: 'DSEP/searchPage/searchResults.json' + }) + }) + + it('should perform search and display results', () => { + cy.url().should('include', `searchTerm=${searchTerm}`) + cy.getByData(testIds.searchpage_products).should('have.length.greaterThan', 0) + }) + + it('should handle sort by All Option', () => { + cy.getByData(testIds.searchpage_products).eq(0).should('contain.text', 'java springboot book One') + }) + + it('should handle sort by Cheapest Option', () => { + cy.getByData('cheapest').eq(0).click() + cy.getByData(testIds.searchpage_products).eq(0).should('contain.text', 'java springboot book Three') + }) + + it('should handle sort by Expensive Option', () => { + cy.getByData('expensive').eq(0).click() + cy.getByData(testIds.searchpage_products).eq(0).should('contain.text', 'java springboot book One') + }) + + it('should navigate to cart on cart icon click', () => { + cy.getByData(testIds.cartButton).click() + cy.url().should('include', testIds.url_cart) + }) + it('should navigate to product details on item click', () => { + cy.getByData(testIds.searchpage_products).first().click() + cy.url().should('include', testIds.url_product) + }) + }) +}) diff --git a/cypress/fixtures/DSEP/cart/selectResult.json b/cypress/fixtures/DSEP/cart/selectResult.json new file mode 100644 index 000000000..35d6cf686 --- /dev/null +++ b/cypress/fixtures/DSEP/cart/selectResult.json @@ -0,0 +1,157 @@ +{ + "data": [ + { + "context": { + "domain": "dsep:courses", + "action": "on_select", + "version": "1.1.0", + "bpp_id": "bpp-ps-network-strapi1-prod.becknprotocol.io", + "bpp_uri": "https://bpp-ps-network-strapi1-prod.becknprotocol.io", + "country": "IND", + "city": "std:080", + "location": { + "country": { + "name": "India", + "code": "IND" + }, + "city": { + "name": "Bangalore", + "code": "std:080" + } + }, + "bap_id": "bap-ps-network-prod.becknprotocol.io", + "bap_uri": "https://bap-ps-network-prod.becknprotocol.io", + "transaction_id": "dd3d7bbc-fd7e-4baa-851f-ab3d7efba90b", + "message_id": "089bbfc8-bd48-4d6c-8f1c-3637365a7c5e", + "ttl": "PT10M", + "timestamp": "2024-09-27T10:57:18.909Z" + }, + "message": { + "order": { + "type": "DEFAULT", + "quote": { + "price": { + "value": "2000", + "currency": "INR" + }, + "breakup": [ + { + "title": "Course Fee", + "price": { + "currency": "INR", + "value": "2000" + } + }, + { + "title": "Course Discount", + "price": { + "currency": "INR", + "value": "-1000" + } + } + ] + }, + "provider": { + "id": "1", + "name": "Edureka", + "short_desc": "Online course provider", + "long_desc": "Online course provider", + "rating": "4.8", + "images": { + "url": "https://miro.medium.com/v2/resize:fit:1200/0*CnvREDstX45u4ruk.png", + "size_type": "sm" + }, + "fulfillments": [ + { + "id": "8", + "type": "RECORDED COURSE", + "rating": "4.5", + "rateable": true, + "tracking": false + } + ] + }, + "items": [ + { + "id": "1", + "name": "java springboot book One", + "short_desc": "java springboot book One", + "long_desc": "java springboot book One", + "images": [ + { + "url": "https://miro.medium.com/v2/resize:fit:1200/0*CnvREDstX45u4ruk.png", + "size_type": "sm" + } + ], + "price": { + "value": "2000", + "currency": "INR" + }, + "rating": "4.3", + "rateable": true, + "quantity": { + "available": { + "count": 100, + "measure": { + "value": "100", + "unit": "kWh" + } + } + }, + "categories": [ + { + "id": "1", + "name": "IT" + } + ], + "locations": [ + { + "id": "6", + "city": "Bengaluru", + "state": "Karnataka", + "country": "India" + } + ], + "tags": [ + { + "display": true, + "list": [ + { + "code": "springboot", + "value": "springboot" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-duration", + "value": "30 days" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-url", + "value": "https://www.edureka.co/spring-certification-course" + } + ] + } + ], + "fulfillments": [ + { + "id": "8", + "type": "RECORDED COURSE", + "rating": "4.5" + } + ] + } + ] + } + } + } + ] +} diff --git a/cypress/fixtures/DSEP/searchPage/emptySearchResults.json b/cypress/fixtures/DSEP/searchPage/emptySearchResults.json new file mode 100644 index 000000000..ecab567d2 --- /dev/null +++ b/cypress/fixtures/DSEP/searchPage/emptySearchResults.json @@ -0,0 +1,15 @@ +{ + "data": [ + { + "context": { + "domain": "retail", + "transaction_id": "12345", + "bpp_id": "bpp123", + "bpp_uri": "https://bpp.example.com" + }, + "message": { + "providers": [] + } + } + ] +} diff --git a/cypress/fixtures/DSEP/searchPage/searchResults.json b/cypress/fixtures/DSEP/searchPage/searchResults.json new file mode 100644 index 000000000..dad7dc59e --- /dev/null +++ b/cypress/fixtures/DSEP/searchPage/searchResults.json @@ -0,0 +1,383 @@ +{ + "data": [ + { + "context": { + "domain": "dsep:courses", + "action": "on_search", + "version": "1.1.0", + "bpp_id": "bpp-ps-network-strapi1-prod.becknprotocol.io", + "bpp_uri": "https://bpp-ps-network-strapi1-prod.becknprotocol.io", + "country": "IND", + "city": "std:080", + "location": { + "country": { + "name": "India", + "code": "IND" + }, + "city": { + "name": "Bangalore", + "code": "std:080" + } + }, + "bap_id": "bap-ps-network-prod.becknprotocol.io", + "bap_uri": "https://bap-ps-network-prod.becknprotocol.io", + "transaction_id": "b139c97a-0e08-4793-8c4c-bb8c034eab4a", + "message_id": "192cbb11-43b6-4d05-9131-b17d9552676a", + "ttl": "PT10M", + "timestamp": "2024-09-17T16:38:31.703Z" + }, + "message": { + "name": "BPP", + "providers": [ + { + "id": "1", + "name": "Edureka", + "rating": "4.8", + "short_desc": "Online course provider", + "long_desc": "Online course provider", + "locations": [ + { + "id": "1", + "address": "Course provider, 3 rd floor", + "city": { + "name": "jaipur" + }, + "country": { + "name": "India" + }, + "state": { + "name": "rajasthan" + }, + "area_code": "302012" + }, + { + "id": "6", + "address": "Sparsh Hospital - Infantry Road", + "city": { + "name": "Bengaluru" + }, + "country": { + "name": "India" + }, + "state": { + "name": "Karnataka" + }, + "area_code": "560001" + } + ], + "items": [ + { + "id": "1", + "short_desc": "java springboot book One", + "long_desc": "java springboot book One", + "name": "java springboot book One", + "price": { + "value": "2000", + "currency": "INR" + }, + "categories": [ + { + "id": "1", + "name": "IT" + } + ], + "locations": [ + { + "id": "6", + "city": "Bengaluru", + "state": "Karnataka", + "country": "India" + } + ], + "fulfillments": [ + { + "id": "8", + "type": "RECORDED COURSE", + "tracking": false, + "tags": [ + { + "display": true, + "list": [ + { + "code": "springboot", + "value": "springboot" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-duration", + "value": "30 days" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-url", + "value": "https://www.edureka.co/spring-certification-course" + } + ] + } + ] + } + ], + "images": [ + { + "url": "https://miro.medium.com/v2/resize:fit:1200/0*CnvREDstX45u4ruk.png" + } + ], + "rating": "4.3", + "rateable": true, + "tags": [ + { + "display": true, + "list": [ + { + "code": "springboot", + "value": "springboot" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-duration", + "value": "30 days" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-url", + "value": "https://www.edureka.co/spring-certification-course" + } + ] + } + ], + "quantity": { + "available": { + "count": 100 + } + } + }, + { + "id": "2", + "short_desc": "java springboot book Two", + "long_desc": "java springboot book Two", + "name": "java springboot book Two", + "price": { + "value": "1000", + "currency": "INR" + }, + "categories": [ + { + "id": "1", + "name": "IT" + } + ], + "locations": [ + { + "id": "6", + "city": "Bengaluru", + "state": "Karnataka", + "country": "India" + } + ], + "fulfillments": [ + { + "id": "8", + "type": "RECORDED COURSE", + "tracking": false, + "tags": [ + { + "display": true, + "list": [ + { + "code": "springboot", + "value": "springboot" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-duration", + "value": "30 days" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-url", + "value": "https://www.edureka.co/spring-certification-course" + } + ] + } + ] + } + ], + "images": [ + { + "url": "https://miro.medium.com/v2/resize:fit:1200/0*CnvREDstX45u4ruk.png" + } + ], + "rating": "4.0", + "rateable": true, + "tags": [ + { + "display": true, + "list": [ + { + "code": "springboot", + "value": "springboot" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-duration", + "value": "30 days" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-url", + "value": "https://www.edureka.co/spring-certification-course" + } + ] + } + ], + "quantity": { + "available": { + "count": 100 + } + } + }, + { + "id": "2", + "short_desc": "java springboot book Three", + "long_desc": "java springboot book Three", + "name": "java springboot book Three", + "price": { + "value": "500", + "currency": "INR" + }, + "categories": [ + { + "id": "1", + "name": "IT" + } + ], + "locations": [ + { + "id": "6", + "city": "Bengaluru", + "state": "Karnataka", + "country": "India" + } + ], + "fulfillments": [ + { + "id": "8", + "type": "RECORDED COURSE", + "tracking": false, + "tags": [ + { + "display": true, + "list": [ + { + "code": "springboot", + "value": "springboot" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-duration", + "value": "30 days" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-url", + "value": "https://www.edureka.co/spring-certification-course" + } + ] + } + ] + } + ], + "images": [ + { + "url": "https://miro.medium.com/v2/resize:fit:1200/0*CnvREDstX45u4ruk.png" + } + ], + "rating": "4.8", + "rateable": true, + "tags": [ + { + "display": true, + "list": [ + { + "code": "springboot", + "value": "springboot" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-duration", + "value": "30 days" + } + ] + }, + { + "display": true, + "list": [ + { + "code": "course-url", + "value": "https://www.edureka.co/spring-certification-course" + } + ] + } + ], + "quantity": { + "available": { + "count": 100 + } + } + } + ], + "images": [ + { + "url": "https://makerspace/assembly/makerspace_logo.png" + } + ] + } + ] + } + } + ] +} diff --git a/packages/becknified-components/src/components/star-rating/star-rating.tsx b/packages/becknified-components/src/components/star-rating/star-rating.tsx index 44f222566..e20adb502 100644 --- a/packages/becknified-components/src/components/star-rating/star-rating.tsx +++ b/packages/becknified-components/src/components/star-rating/star-rating.tsx @@ -39,7 +39,10 @@ const StarRating: React.FC = props => { text={ratingText} /> - + {[...Array(starCount)].map((star, index) => { const ratingValue = index + 1 return ( diff --git a/shared/dataTestIds.ts b/shared/dataTestIds.ts index ad76a7bc3..c41deb4c4 100644 --- a/shared/dataTestIds.ts +++ b/shared/dataTestIds.ts @@ -104,6 +104,7 @@ const testIds = { cartpage_itemImage: 'cart-card-image', cartpage_itemName: 'cart-item-name', cartpage_productPrice: 'product-price', + cartSubTotal_Text: 'cartSub-Total-Text', cartpage_orderSummaryText: 'order-summary', cartpage_totalQuantityText: 'total-qunatity-text', cartpage_totalAmountText: 'total-amount-text',