Skip to content

Commit

Permalink
Merge pull request #2687 from beckn/sky-analytics-e2e-testing
Browse files Browse the repository at this point in the history
Sky analytics e2e testing
  • Loading branch information
aniketceminds authored Dec 9, 2024
2 parents f178625 + 3ae02da commit a3f3a69
Show file tree
Hide file tree
Showing 8 changed files with 335 additions and 3 deletions.
2 changes: 2 additions & 0 deletions apps/sky-analytics/components/cart/cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { CartProps } from './cart.types'
import CartList from './cart-list'
import Styles from './cart.module.css'
import { Loader, Typography, Button as BecknButton, Button } from '@beckn-ui/molecules'
import { testIds } from '@shared/dataTestIds'

const Cart: React.FC<CartProps> = ({
schema: { loader, cartItems, actionButton, emptyCard }, // Destructure props
Expand Down Expand Up @@ -81,6 +82,7 @@ const Cart: React.FC<CartProps> = ({
<Typography
variant="subTitleRegular"
text="Request Overview"
dataTest={testIds.request_overview}
sx={{ paddingTop: '20px' }}
/>
<CartList cartItems={cartItems} />
Expand Down
1 change: 1 addition & 0 deletions apps/sky-analytics/components/cart/cart.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface CartProps {
loader: LoaderProps
emptyCard?: EmptyCardProps
actionButton?: {
dataTest?: string
text: string
handleOnClick: MouseEventHandler<HTMLButtonElement>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Box, CardBody, Flex, Icon, Image, Stack, Card, useTheme, Text } from '@
import { Typography } from '@beckn-ui/molecules'
import { StarIcon, TimeIcon } from '@chakra-ui/icons'
import { CurrencyType, ProductPrice } from '@beckn-ui/becknified-components'
import { testIds } from '@shared/dataTestIds'

type FrequentlyAccessedProps = {
frequentlyAccessedData: Array<{
Expand Down Expand Up @@ -33,6 +34,7 @@ const FrequentlyAccessed: React.FC<FrequentlyAccessedProps> = ({ frequentlyAcces
fontSize="17px"
fontWeight="400"
text="Frequently Accessed"
data-test={testIds.Frequently_accessed_text}
sx={{ mb: '20px' }}
/>

Expand All @@ -45,6 +47,7 @@ const FrequentlyAccessed: React.FC<FrequentlyAccessedProps> = ({ frequentlyAcces
>
{frequentlyAccessedData.map((item, index) => (
<Card
data-test={testIds.Frequently_accessed_item}
key={index}
mb={'20px'}
boxShadow={'0px 8px 10px -6px rgba(0, 0, 0, 0.1), 0px 20px 25px -5px rgba(0, 0, 0, 0.1)'}
Expand Down
1 change: 1 addition & 0 deletions apps/sky-analytics/pages/cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const RequestOverview = () => {
},
actionButton: {
text: 'Proceed',
dataTest: testIds.Proceed,
handleOnClick: () => {
router.push('/checkout')
}
Expand Down
1 change: 1 addition & 0 deletions apps/sky-analytics/pages/orderHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ const OrderHistory = () => {
text={order.attributes.items[0].name}
fontWeight="600"
fontSize={'15px'}
dataTest="order_history_item_name"
/>
<Text
as={Typography}
Expand Down
8 changes: 6 additions & 2 deletions apps/sky-analytics/pages/product.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ const Product = () => {
<Typography
text={`About ${selectedProduct.providerName}`}
fontWeight={'800'}
dataTest={testIds.item_title}
/>
<Typography text={selectedProduct.item.short_desc!} />
<Typography
text={selectedProduct.item.productInfo! as string}
style={{ marginTop: '1rem' }}
dataTest={testIds.product_page_short_desc}
/>
</Box>
<Box
Expand Down Expand Up @@ -178,6 +180,7 @@ const Product = () => {
textDecoration="underline"
href="https://www.google.com"
target="_blank"
data-test={testIds.TermsandConditions_link}
>
Terms and Conditions
</Link>
Expand All @@ -194,12 +197,13 @@ const Product = () => {
mr="20px"
>
<Button
text="proceed"
text="Proceed"
dataTest={testIds.Proceed_to_product}
disabled={!checkIsDisabled()}
handleClick={handleOnProceed}
/>
</Box>
** Contains non-personal data only
** Contains non-personal data only dataTest={testIds.disclaimer_text}
</Flex>
</Box>
)
Expand Down
316 changes: 316 additions & 0 deletions cypress/e2e/climate-resilience/skyAnalytics_e2eTests.cy.ts

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion shared/dataTestIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,11 @@ const testIds = {
sort_menu_item_2: 'menu-item-2',
rating_container: 'rating-container',
Proceed: 'Proceed',
Proceed_to_product: 'Proceed-to-product'
Proceed_to_product: 'Proceed-to-product',
Frequently_accessed_item: 'Frequently_accessed_item',
Frequently_accessed_text: 'Frequently_accessed_text',
TermsandConditions_link: 'TermsandConditions_link',
disclaimer_text: 'disclaimer_text'
}

export { testIds }

0 comments on commit a3f3a69

Please sign in to comment.