I'm working on the automation of testing in SAP Hybris with Cypress. I've received a blocker where Cypress can't find a component. You may see the component I'm talking about on the screenshot below. It is a section on the page that contains multiple products listed (for replacement). My goal is to test does this section contains all the products requested for replacement.
I've tried using this piece of code:
cy.get('.ye-default-reference-editor-selected-listbox') // Target the scrollable body of the list
.eq(18)
.scrollIntoView() // Scroll into view if it's not initially visible
.should('exist')
.should('be.visible',{ force: true }) // Ensure the element is visible
.within(() => {
// Select the specific row based on the title attribute
cy.get('tr[title="CAN_BE_REPLACED_BY -> [] - IQOS ILUMA One Holder Moss Green [G0000607] - Tunisia Product Catalog : Staged"]')
.should('be.visible') // Ensure the row is visible
.click({ force: true }); // Click on the row forcefully if necessary
What I have noticed is that Cypress gets stuck at this part: .should('be.visible',{ force: true })
.
When the list box is disabled, it's generally because it needs a click to open it up. The click action by the user makes it visible.
Generally the pattern is
.should('be.visible')
This is a typical example
cy.get('[placeholder="text of placeholder"]').click() // 1,2,3
cy.get('.listbox').should('be.visible') // 4
cy.get('.listbox-items').eq(18) // 5
.scrollIntoView() // 6
.click() // 7
If you post details, can make the example more relevant.