-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(P2P-ENERGY): added cypress test case for open spark cart page in…
… p2p
- Loading branch information
Showing
5 changed files
with
210 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { testIds } from '../../../shared/dataTestIds' | ||
|
||
describe('Open spark Cart Page Tests in p2p-energy', () => { | ||
beforeEach(() => { | ||
cy.visit(testIds.url_base) | ||
cy.getByData(testIds.clickable_card_open_spark).click() | ||
cy.wait(2000) | ||
cy.intercept('POST', '**/search', { | ||
fixture: 'P2P/searchResponse.json' | ||
}).as('searchResponse') | ||
cy.getByData(testIds.P2P_hompage_button).click() | ||
cy.wait(2000) | ||
cy.url().should('include', `${testIds.url_search}?searchTerm`) | ||
|
||
cy.getByData(testIds.searchpage_products).first().click() | ||
cy.url().should('include', testIds.url_product) | ||
cy.intercept('POST', '/select', { fixture: 'P2P/selectResult.json' }).as('selectCall') | ||
cy.getByData(testIds.productpage_addTocartButton).click() | ||
cy.wait('@selectCall') | ||
}) | ||
afterEach(() => { | ||
cy.clearAllLocalStorage() | ||
}) | ||
context('should render When there are Items in Cart', () => { | ||
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(testIds.cartpage_productPrice).should('be.visible') | ||
cy.getByData(testIds.cartpage_trashButton).should('be.visible') | ||
cy.getByData(testIds.cartpage_incrementButton).should('be.visible') | ||
cy.getByData(testIds.cartpage_input).should('have.value', '1') | ||
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.cartpage_totalQuantityText).should('contain.text', 'Total Quantity') | ||
cy.getByData(testIds.cartpage_totalAmountText).should('contain.text', 'Total Amount') | ||
}) | ||
|
||
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_emptyImage).should('have.attr', 'src') | ||
cy.getByData(testIds.cartpage_emptyheading).should('contain.text', 'The Cart is Empty') | ||
cy.getByData(testIds.cartpage_emptySubHeading).should( | ||
'contain.text', | ||
'Looks like you haven’t made your choice yet' | ||
) | ||
cy.getByData(testIds.cartpage_emptyButton).should('contain.text', 'Shop') | ||
}) | ||
it('increments the counter and updates the total amount when the increment button is clicked', () => { | ||
cy.getByData(testIds.cartpage_incrementButton).click() | ||
cy.getByData(testIds.cartpage_input).should('have.value', '2') | ||
}) | ||
it('decrement the counter and updates the total amount when the decrement button is clicked', () => { | ||
cy.getByData(testIds.cartpage_incrementButton).click() | ||
cy.getByData(testIds.cartpage_input).should('have.value', '2') | ||
cy.getByData(testIds.cartpage_decrementButton).click() | ||
cy.getByData(testIds.cartpage_input).should('have.value', '1') | ||
}) | ||
it('Should conatin order Button and click on it render it on checkout page', () => { | ||
cy.getByData(testIds.cartpage_cartOrderButton).should('contain.text', 'Proceed') | ||
cy.getByData(testIds.cartpage_cartOrderButton).click() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"context": { | ||
"domain": "uei:p2p_trading", | ||
"action": "on_select", | ||
"version": "1.1.0", | ||
"bpp_id": "bpp-ps-network-strapi-dev.becknprotocol.io", | ||
"bpp_uri": "http://bpp-ps-network-strapi-dev.becknprotocol.io", | ||
"country": "IND", | ||
"city": "std:080", | ||
"location": { | ||
"country": { | ||
"name": "India", | ||
"code": "IND" | ||
}, | ||
"city": { | ||
"name": "Bangalore", | ||
"code": "std:080" | ||
} | ||
}, | ||
"bap_id": "bap-ps-network-dev.becknprotocol.io", | ||
"bap_uri": "https://bap-ps-network-dev.becknprotocol.io", | ||
"transaction_id": "9801be1d-52b5-492a-b8dd-2afdba1ae7f5", | ||
"message_id": "b750655f-0006-43ef-8e63-703d7c60fff2", | ||
"ttl": "PT10M", | ||
"timestamp": "2024-12-05T07:30:19.569Z" | ||
}, | ||
"message": { | ||
"order": { | ||
"quote": { | ||
"price": { | ||
"value": "13" | ||
}, | ||
"breakup": [ | ||
{ | ||
"title": "CGST", | ||
"price": { | ||
"currency": "INR", | ||
"value": "5" | ||
} | ||
}, | ||
{ | ||
"title": "SGST", | ||
"price": { | ||
"currency": "INR", | ||
"value": "5" | ||
} | ||
}, | ||
{ | ||
"title": "Convenience charges", | ||
"price": { | ||
"currency": "INR", | ||
"value": "1" | ||
} | ||
}, | ||
{ | ||
"title": "Wheeling charges @ 0.5/unit", | ||
"price": { | ||
"currency": "INR", | ||
"value": "1" | ||
} | ||
}, | ||
{ | ||
"title": "P2P Energy Cost", | ||
"price": { | ||
"currency": "INR" | ||
} | ||
} | ||
] | ||
}, | ||
"provider": { | ||
"id": "798", | ||
"name": "Leela Energy Corp", | ||
"short_desc": "Leela Energy Company", | ||
"long_desc": "Big Leela Energy Company", | ||
"images": { | ||
"url": "https://file.aiquickdraw.com/imgcompressed/img/compressed_56a2f2ed06b49ceb7f8580c4bed33b52.webp", | ||
"size_type": "sm" | ||
}, | ||
"fulfillments": [ | ||
{ | ||
"id": "27", | ||
"type": "END", | ||
"rateable": true | ||
}, | ||
{ | ||
"id": "26", | ||
"type": "START", | ||
"rateable": true | ||
} | ||
] | ||
}, | ||
"items": [ | ||
{ | ||
"id": "322", | ||
"name": "Energy", | ||
"short_desc": "Excess power from my rooftop system to sell", | ||
"images": [ | ||
{ | ||
"url": "https://file.aiquickdraw.com/imgcompressed/img/compressed_56a2f2ed06b49ceb7f8580c4bed33b52.webp", | ||
"size_type": "sm" | ||
} | ||
], | ||
"price": { | ||
"value": "13" | ||
}, | ||
"rating": "null", | ||
"rateable": true, | ||
"quantity": { | ||
"available": { | ||
"count": 120, | ||
"measure": { | ||
"value": "120", | ||
"unit": "kWh" | ||
} | ||
} | ||
}, | ||
"categories": [ | ||
{ | ||
"id": "100", | ||
"name": "SOLAR ENERGY" | ||
} | ||
], | ||
"fulfillments": [ | ||
{ | ||
"id": "27", | ||
"type": "END" | ||
}, | ||
{ | ||
"id": "26", | ||
"type": "START" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters