Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(P2P-ENERGY): added cypress test case for open spark product deta… #2684

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions cypress/e2e/p2p-energy/p2p-energy-productDetails.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { testIds } from '../../../shared/dataTestIds'

describe('p2p energy product details Page Tests', () => {
before(() => {
cy.visit(testIds.url_base)
cy.getByData(testIds.clickable_card_open_spark).click()
cy.getByData(testIds.P2P_hompage_button).click()
cy.intercept('POST', '**/search', {
fixture: 'P2P/searchResponse.json'
}).as('searchResponse')
cy.wait(1000)
cy.url().should('include', `${testIds.url_search}?searchTerm`)
cy.getByData(testIds.searchpage_products).first().click()
})

it('should render details of selected product', () => {
cy.getByData(testIds.item_title).should('contain.text', 'energy')
cy.getByData(testIds.item_rating).eq(4)
cy.getByData(testIds.item_description).should('contain.text', 'Big Leela Energy Company')
cy.getByData(testIds.P2P_productpage_price_text).should('be.visible')
cy.getByData(testIds.item_price).should('contain.text', '₹7.00 per unit')
cy.getByData(testIds.P2P_productpage_energyUnit_text).should('be.visible')
cy.getByData(testIds.P2P_productpage_input).should('be.visible')
})
it('should edit the input value', () => {
cy.getByData(testIds.P2P_productpage_input).should('have.value', '1')
cy.getByData(testIds.P2P_productpage_input).clear({ force: true }).type('02').should('have.value', '2')
cy.getByData(testIds.P2P_productpage_input).clear().type('01').should('have.value', '1')
})
it('should navigate to cart on order button click', () => {
cy.getByData(testIds.productpage_addTocartButton).click()
cy.getByData(testIds.loadingIndicator).should('be.visible')
cy.url().should('include', testIds.url_cart)
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/p2p-energy/p2p-searchPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Search Page Tests', () => {
cy.intercept('POST', '**/search', {
fixture: 'P2P/searchResponse.json'
}).as('searchResponse')
cy.wait(10000)
cy.wait(1000)
cy.url().should('include', `${testIds.url_search}?searchTerm`)
})

Expand Down
3 changes: 3 additions & 0 deletions shared/dataTestIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ const testIds = {
footer_postfix_text: 'footer-postfix-text',
footer_bottomfix_text: 'footer-bottomfix-text',
P2P_hompage_button: 'p2p-homePage-btn',
P2P_productpage_price_text: 'P2P-productpage-price-text',
P2P_productpage_energyUnit_text: 'P2P-productpage-energyUnit-text',
P2P_productpage_input: 'P2P-productpage-input',

////////////// Envirogrowth data test ////////////////

Expand Down