I’m working on automated testing of SAP Hybris with Cypress. I have successfully solved more steps than I initially thought, lol. Namely, here is the code I’m currently using:
cy.get('span.z-label')
.contains("Products")
.click()
.wait(300);
cy.get('.yw-fulltextsearch-search-button').eq(0).click();
cy.get('.z-bandbox-input').eq(3).should('be.visible').type("G0000605",{ force: true }).wait(300);
cy.get('.yw-fulltextsearch-search-button').eq(0).click().wait(300);
cy.get('span.yw-coll-browser-hyperlink').contains("[] - IQOS ILUMA One Holder Sunset Red [G0000605] - Tunisia Product Catalog : Staged").scrollIntoView().should('be.visible').click({force:true});
cy.wait(5000)
cy.get('.yw-editorarea-tabbox-tabs-tab').contains("Categories").click().wait(300);
// Check products listed for replacement by products codes
cy.get('.z-listitem')
.contains("G0000605");
cy.get('.z-listitem')
.contains("G0000607");
cy.get('.z-listitem')
.contains("G0000608");
cy.get('.z-listitem')
.contains("G0000604");
cy.get('.z-listitem')
.contains("G0000592");
cy.get('.yw-navigationhistory-back').eq(0).should('be.visible').click({ force: true });
cy.get('button[title="Clear"]').eq(0).click().wait(1000);
cy.get('.yw-fulltextsearch-search-button').eq(0).click().wait(1000);
// Ensure the parent element is visible
cy.get('.z-bandbox-input').eq(3).then($span => {
if ($span.css('display') === 'none') {
$span.css('display', 'block');
}
});
cy.get('.z-bandbox-input').eq(3).wait(1000).type("G0000606",{ force: true });
cy.get('.yw-fulltextsearch-search-button').eq(0).click().wait(300);
cy.get('span.yw-coll-browser-hyperlink').contains("[] - IQOS ILUMA One Holder Pebbe Grey [G0000606] - Tunisia Product Catalog : Staged").scrollIntoView().should('be.visible').click({force:true});
cy.wait(10000)
cy.get('.yw-editorarea-tabbox-tabs-tab').contains("Categories").click().wait(300);
// Check products listed for replacement by products codes
cy.get('.z-listitem')
.contains("G0000605");
cy.get('.z-listitem')
.contains("G0000607");
cy.get('.z-listitem')
.contains("G0000608");
cy.get('.z-listitem')
.contains("G0000604");
cy.get('.z-listitem')
.contains("G0000592");
The blocker is with this part:
cy.get('.yw-fulltextsearch-search-button').eq(0).click().wait(1000);
// Ensure the parent element is visible
cy.get('.z-bandbox-input').eq(3).then($span => {
if ($span.css('display') === 'none') {
$span.css('display', 'block');
}
});
cy.get('.z-bandbox-input').eq(3).wait(1000).type("G0000606",{ force: true });
As you may see on the screenshot, Cypress has recognised the type of the G0000606 code as successful, although it actually didn’t type in anything but searched for an empty result. It’s strange since I used the same class name (.z-bandbox-input) as I did in the previous part of the code when it successfully typed and searched for the G0000605 code.
Here is a brief description of steps I’m trying to reproduce for better comprehension:
- Search for product 1 (G0000605) on the Product page
- Choose the market from the list provided
- Check are the products listed available for replacement
- Click on back button (go back to the product page)
- On the product page clear the previous result from the search bar (G0000605) and type in (G0000606). (Here is the blocker)
- Basically, from here, there should be a repetition of the same steps for each of the new products.